Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
509 changes: 509 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Create an OAuth2 client credentials auth method returns "CREATED" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::WebhooksIntegrationAPI.new

body = DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsCreateRequest.new({
data: DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsCreateData.new({
attributes: DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsCreateAttributes.new({
access_token_url: "https://example.com/oauth/token",
audience: "https://api.example.com",
client_id: "my-client-id",
client_secret: "my-client-secret",
name: "my-oauth2-auth",
scope: "read:webhooks write:webhooks",
}),
type: DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsType::WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS,
}),
})
p api_instance.create_o_auth2_client_credentials(body)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Delete an OAuth2 client credentials auth method returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::WebhooksIntegrationAPI.new
api_instance.delete_o_auth2_client_credentials("auth_method_id")
5 changes: 5 additions & 0 deletions examples/v2/webhooks-integration/GetAllAuthMethods.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Get all auth methods returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::WebhooksIntegrationAPI.new
p api_instance.get_all_auth_methods()
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Get an OAuth2 client credentials auth method returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::WebhooksIntegrationAPI.new
p api_instance.get_o_auth2_client_credentials("auth_method_id")
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Update an OAuth2 client credentials auth method returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::WebhooksIntegrationAPI.new

body = DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsUpdateRequest.new({
data: DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsUpdateData.new({
attributes: DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsUpdateAttributes.new({
access_token_url: "https://example.com/oauth/token",
audience: "https://api.example.com",
client_id: "my-client-id",
client_secret: "my-client-secret",
name: "my-oauth2-auth",
scope: "read:webhooks write:webhooks",
}),
type: DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsType::WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS,
}),
})
p api_instance.update_o_auth2_client_credentials("auth_method_id", body)
16 changes: 16 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3470,6 +3470,22 @@
"v2.ListServiceNowUsers" => {
"instance_id" => "UUID",
},
"v2.GetAllAuthMethods" => {
"include" => "WebhooksAuthMethodProtocol",
},
"v2.CreateOAuth2ClientCredentials" => {
"body" => "WebhooksOAuth2ClientCredentialsCreateRequest",
},
"v2.DeleteOAuth2ClientCredentials" => {
"auth_method_id" => "String",
},
"v2.GetOAuth2ClientCredentials" => {
"auth_method_id" => "String",
},
"v2.UpdateOAuth2ClientCredentials" => {
"auth_method_id" => "String",
"body" => "WebhooksOAuth2ClientCredentialsUpdateRequest",
},
"v2.CreateCloudflareAccount" => {
"body" => "CloudflareAccountCreateRequest",
},
Expand Down
12 changes: 12 additions & 0 deletions features/v2/given.json
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,18 @@
"tag": "Opsgenie Integration",
"operationId": "CreateOpsgenieService"
},
{
"parameters": [
{
"name": "body",
"value": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"access_token_url\": \"https://example.com/oauth/token\",\n \"client_id\": \"my-client-id\",\n \"client_secret\": \"my-client-secret\"\n },\n \"type\": \"webhooks-auth-method-oauth2-client-credentials\"\n }\n}"
}
],
"step": "there is a valid \"webhooks_oauth2_client_credentials\" in the system",
"key": "webhooks_oauth2_client_credentials",
"tag": "Webhooks Integration",
"operationId": "CreateOAuth2ClientCredentials"
},
{
"parameters": [
{
Expand Down
37 changes: 37 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3554,6 +3554,43 @@
"type": "safe"
}
},
"GetAllAuthMethods": {
"tag": "Webhooks Integration",
"undo": {
"type": "safe"
}
},
"CreateOAuth2ClientCredentials": {
"tag": "Webhooks Integration",
"undo": {
"operationId": "DeleteOAuth2ClientCredentials",
"parameters": [
{
"name": "auth_method_id",
"source": "data.id"
}
],
"type": "unsafe"
}
},
"DeleteOAuth2ClientCredentials": {
"tag": "Webhooks Integration",
"undo": {
"type": "idempotent"
}
},
"GetOAuth2ClientCredentials": {
"tag": "Webhooks Integration",
"undo": {
"type": "safe"
}
},
"UpdateOAuth2ClientCredentials": {
"tag": "Webhooks Integration",
"undo": {
"type": "idempotent"
}
},
"ListIntegrations": {
"tag": "Integrations",
"undo": {
Expand Down
97 changes: 97 additions & 0 deletions features/v2/webhooks_integration.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
@endpoint(webhooks-integration) @endpoint(webhooks-integration-v2)
Feature: Webhooks Integration
Configure your [Datadog Webhooks
integration](https://docs.datadoghq.com/integrations/webhooks/) directly
through the Datadog API.

Background:
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "WebhooksIntegration" API

@generated @skip @team:Datadog/collaboration-integrations
Scenario: Create an OAuth2 client credentials auth method returns "Bad Request" response
Given new "CreateOAuth2ClientCredentials" request
And body with value {"data": {"attributes": {"access_token_url": "https://example.com/oauth/token", "audience": "https://api.example.com", "client_id": "my-client-id", "client_secret": "my-client-secret", "name": "my-oauth2-auth", "scope": "read:webhooks write:webhooks"}, "type": "webhooks-auth-method-oauth2-client-credentials"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:Datadog/collaboration-integrations
Scenario: Create an OAuth2 client credentials auth method returns "CREATED" response
Given new "CreateOAuth2ClientCredentials" request
And body with value {"data": {"attributes": {"access_token_url": "https://example.com/oauth/token", "audience": "https://api.example.com", "client_id": "my-client-id", "client_secret": "my-client-secret", "name": "my-oauth2-auth", "scope": "read:webhooks write:webhooks"}, "type": "webhooks-auth-method-oauth2-client-credentials"}}
When the request is sent
Then the response status is 201 CREATED

@generated @skip @team:Datadog/collaboration-integrations
Scenario: Create an OAuth2 client credentials auth method returns "Conflict" response
Given new "CreateOAuth2ClientCredentials" request
And body with value {"data": {"attributes": {"access_token_url": "https://example.com/oauth/token", "audience": "https://api.example.com", "client_id": "my-client-id", "client_secret": "my-client-secret", "name": "my-oauth2-auth", "scope": "read:webhooks write:webhooks"}, "type": "webhooks-auth-method-oauth2-client-credentials"}}
When the request is sent
Then the response status is 409 Conflict

@generated @skip @team:Datadog/collaboration-integrations
Scenario: Delete an OAuth2 client credentials auth method returns "Not Found" response
Given new "DeleteOAuth2ClientCredentials" request
And request contains "auth_method_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:Datadog/collaboration-integrations
Scenario: Delete an OAuth2 client credentials auth method returns "OK" response
Given new "DeleteOAuth2ClientCredentials" request
And request contains "auth_method_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 204 OK

@generated @skip @team:Datadog/collaboration-integrations
Scenario: Get all auth methods returns "OK" response
Given new "GetAllAuthMethods" request
When the request is sent
Then the response status is 200 OK

@generated @skip @team:Datadog/collaboration-integrations
Scenario: Get an OAuth2 client credentials auth method returns "Not Found" response
Given new "GetOAuth2ClientCredentials" request
And request contains "auth_method_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:Datadog/collaboration-integrations
Scenario: Get an OAuth2 client credentials auth method returns "OK" response
Given new "GetOAuth2ClientCredentials" request
And request contains "auth_method_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 200 OK

@generated @skip @team:Datadog/collaboration-integrations
Scenario: Update an OAuth2 client credentials auth method returns "Bad Request" response
Given new "UpdateOAuth2ClientCredentials" request
And request contains "auth_method_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"access_token_url": "https://example.com/oauth/token", "audience": "https://api.example.com", "client_id": "my-client-id", "client_secret": "my-client-secret", "name": "my-oauth2-auth", "scope": "read:webhooks write:webhooks"}, "type": "webhooks-auth-method-oauth2-client-credentials"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:Datadog/collaboration-integrations
Scenario: Update an OAuth2 client credentials auth method returns "Conflict" response
Given new "UpdateOAuth2ClientCredentials" request
And request contains "auth_method_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"access_token_url": "https://example.com/oauth/token", "audience": "https://api.example.com", "client_id": "my-client-id", "client_secret": "my-client-secret", "name": "my-oauth2-auth", "scope": "read:webhooks write:webhooks"}, "type": "webhooks-auth-method-oauth2-client-credentials"}}
When the request is sent
Then the response status is 409 Conflict

@generated @skip @team:Datadog/collaboration-integrations
Scenario: Update an OAuth2 client credentials auth method returns "Not Found" response
Given new "UpdateOAuth2ClientCredentials" request
And request contains "auth_method_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"access_token_url": "https://example.com/oauth/token", "audience": "https://api.example.com", "client_id": "my-client-id", "client_secret": "my-client-secret", "name": "my-oauth2-auth", "scope": "read:webhooks write:webhooks"}, "type": "webhooks-auth-method-oauth2-client-credentials"}}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:Datadog/collaboration-integrations
Scenario: Update an OAuth2 client credentials auth method returns "OK" response
Given new "UpdateOAuth2ClientCredentials" request
And request contains "auth_method_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"access_token_url": "https://example.com/oauth/token", "audience": "https://api.example.com", "client_id": "my-client-id", "client_secret": "my-client-secret", "name": "my-oauth2-auth", "scope": "read:webhooks write:webhooks"}, "type": "webhooks-auth-method-oauth2-client-credentials"}}
When the request is sent
Then the response status is 200 OK
19 changes: 19 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6996,6 +6996,24 @@ def overrides
"v2.watcher_data" => "WatcherData",
"v2.watcher_data_attributes" => "WatcherDataAttributes",
"v2.watcher_data_type" => "WatcherDataType",
"v2.webhooks_auth_method_attributes" => "WebhooksAuthMethodAttributes",
"v2.webhooks_auth_method_protocol" => "WebhooksAuthMethodProtocol",
"v2.webhooks_auth_method_relationships" => "WebhooksAuthMethodRelationships",
"v2.webhooks_auth_method_response_data" => "WebhooksAuthMethodResponseData",
"v2.webhooks_auth_methods_response" => "WebhooksAuthMethodsResponse",
"v2.webhooks_auth_method_type" => "WebhooksAuthMethodType",
"v2.webhooks_o_auth2_client_credentials_create_attributes" => "WebhooksOAuth2ClientCredentialsCreateAttributes",
"v2.webhooks_o_auth2_client_credentials_create_data" => "WebhooksOAuth2ClientCredentialsCreateData",
"v2.webhooks_o_auth2_client_credentials_create_request" => "WebhooksOAuth2ClientCredentialsCreateRequest",
"v2.webhooks_o_auth2_client_credentials_relationship" => "WebhooksOAuth2ClientCredentialsRelationship",
"v2.webhooks_o_auth2_client_credentials_relationship_data" => "WebhooksOAuth2ClientCredentialsRelationshipData",
"v2.webhooks_o_auth2_client_credentials_response" => "WebhooksOAuth2ClientCredentialsResponse",
"v2.webhooks_o_auth2_client_credentials_response_attributes" => "WebhooksOAuth2ClientCredentialsResponseAttributes",
"v2.webhooks_o_auth2_client_credentials_response_data" => "WebhooksOAuth2ClientCredentialsResponseData",
"v2.webhooks_o_auth2_client_credentials_type" => "WebhooksOAuth2ClientCredentialsType",
"v2.webhooks_o_auth2_client_credentials_update_attributes" => "WebhooksOAuth2ClientCredentialsUpdateAttributes",
"v2.webhooks_o_auth2_client_credentials_update_data" => "WebhooksOAuth2ClientCredentialsUpdateData",
"v2.webhooks_o_auth2_client_credentials_update_request" => "WebhooksOAuth2ClientCredentialsUpdateRequest",
"v2.web_integration_account_create_request" => "WebIntegrationAccountCreateRequest",
"v2.web_integration_account_create_request_attributes" => "WebIntegrationAccountCreateRequestAttributes",
"v2.web_integration_account_create_request_data" => "WebIntegrationAccountCreateRequestData",
Expand Down Expand Up @@ -7196,6 +7214,7 @@ def overrides
"v2.usage_metering_api" => "UsageMeteringAPI",
"v2.users_api" => "UsersAPI",
"v2.web_integrations_api" => "WebIntegrationsAPI",
"v2.webhooks_integration_api" => "WebhooksIntegrationAPI",
"v2.widgets_api" => "WidgetsAPI",
"v2.workflow_automation_api" => "WorkflowAutomationAPI"
}
Expand Down
Loading
Loading