From 127205baf8451765290c592205fb3b80dbd471bf Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 28 May 2026 21:33:31 +0000 Subject: [PATCH] Regenerate client from commit beecbd3 of spec repo --- .generator/schemas/v2/openapi.yaml | 509 ++++++++++++++++++ .../CreateOAuth2ClientCredentials.rb | 19 + .../DeleteOAuth2ClientCredentials.rb | 5 + .../webhooks-integration/GetAllAuthMethods.rb | 5 + .../GetOAuth2ClientCredentials.rb | 5 + .../UpdateOAuth2ClientCredentials.rb | 19 + features/scenarios_model_mapping.rb | 16 + features/v2/given.json | 12 + features/v2/undo.json | 37 ++ features/v2/webhooks_integration.feature | 97 ++++ lib/datadog_api_client/inflector.rb | 19 + .../v2/api/webhooks_integration_api.rb | 363 +++++++++++++ .../models/webhooks_auth_method_attributes.rb | 105 ++++ .../models/webhooks_auth_method_protocol.rb | 26 + .../webhooks_auth_method_relationships.rb | 105 ++++ .../webhooks_auth_method_response_data.rb | 175 ++++++ .../v2/models/webhooks_auth_method_type.rb | 26 + .../models/webhooks_auth_methods_response.rb | 137 +++++ ...h2_client_credentials_create_attributes.rb | 278 ++++++++++ ..._o_auth2_client_credentials_create_data.rb | 144 +++++ ...auth2_client_credentials_create_request.rb | 123 +++++ ...o_auth2_client_credentials_relationship.rb | 105 ++++ ...h2_client_credentials_relationship_data.rb | 115 ++++ ...oks_o_auth2_client_credentials_response.rb | 123 +++++ ..._client_credentials_response_attributes.rb | 164 ++++++ ..._auth2_client_credentials_response_data.rb | 165 ++++++ ...ebhooks_o_auth2_client_credentials_type.rb | 26 + ...h2_client_credentials_update_attributes.rb | 262 +++++++++ ..._o_auth2_client_credentials_update_data.rb | 144 +++++ ...auth2_client_credentials_update_request.rb | 123 +++++ 30 files changed, 3452 insertions(+) create mode 100644 examples/v2/webhooks-integration/CreateOAuth2ClientCredentials.rb create mode 100644 examples/v2/webhooks-integration/DeleteOAuth2ClientCredentials.rb create mode 100644 examples/v2/webhooks-integration/GetAllAuthMethods.rb create mode 100644 examples/v2/webhooks-integration/GetOAuth2ClientCredentials.rb create mode 100644 examples/v2/webhooks-integration/UpdateOAuth2ClientCredentials.rb create mode 100644 features/v2/webhooks_integration.feature create mode 100644 lib/datadog_api_client/v2/api/webhooks_integration_api.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_auth_method_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_auth_method_protocol.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_auth_method_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_auth_method_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_auth_method_type.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_auth_methods_response.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_create_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_create_data.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_relationship.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_relationship_data.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_response.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_response_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_type.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_update_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_update_data.rb create mode 100644 lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_update_request.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4d59bfade193..91d04c226717 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1763,6 +1763,21 @@ components: required: true schema: type: string + WebhooksAuthMethodIDPathParameter: + description: The UUID of the auth method. + in: path + name: auth_method_id + required: true + schema: + type: string + WebhooksAuthMethodInclude: + description: Comma-separated list of relationships to include in the response. + explode: true + in: query + name: include + required: false + schema: + $ref: "#/components/schemas/WebhooksAuthMethodProtocol" WorkflowId: description: The ID of the workflow. in: path @@ -95268,6 +95283,277 @@ components: $ref: "#/components/schemas/WebIntegrationAccountResponseData" type: array type: object + WebhooksAuthMethodAttributes: + description: Attributes of a webhooks auth method. + properties: + protocol: + $ref: "#/components/schemas/WebhooksAuthMethodProtocol" + type: object + WebhooksAuthMethodProtocol: + description: Authentication protocol used by the auth method. + enum: + - oauth2-client-credentials + example: oauth2-client-credentials + type: string + x-enum-varnames: + - OAUTH2_CLIENT_CREDENTIALS + WebhooksAuthMethodRelationships: + description: Relationships of a webhooks auth method to its protocol-specific resource. + properties: + oauth2-client-credentials: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsRelationship" + type: object + WebhooksAuthMethodResponseData: + description: Webhooks auth method data from a response. + properties: + attributes: + $ref: "#/components/schemas/WebhooksAuthMethodAttributes" + id: + description: The ID of the auth method. + example: "596da4af-0563-4097-90ff-07230c3f9db3" + type: string + relationships: + $ref: "#/components/schemas/WebhooksAuthMethodRelationships" + type: + $ref: "#/components/schemas/WebhooksAuthMethodType" + required: + - id + - type + - attributes + type: object + WebhooksAuthMethodType: + default: webhooks-auth-method + description: Webhooks auth method resource type. + enum: + - webhooks-auth-method + example: webhooks-auth-method + type: string + x-enum-varnames: + - WEBHOOKS_AUTH_METHOD + WebhooksAuthMethodsResponse: + description: Response containing a list of webhooks auth methods. + properties: + data: + description: An array of webhooks auth methods. + items: + $ref: "#/components/schemas/WebhooksAuthMethodResponseData" + type: array + included: + description: Resources related to the auth methods, included when requested via the `include` query parameter. + items: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsResponseData" + type: array + required: + - data + type: object + WebhooksOAuth2ClientCredentialsCreateAttributes: + description: OAuth2 client credentials attributes for a create request. + properties: + access_token_url: + description: URL of the OAuth2 access token endpoint. + example: "https://example.com/oauth/token" + maxLength: 2048 + minLength: 1 + type: string + audience: + description: The intended audience for the OAuth2 access token. + example: "https://api.example.com" + maxLength: 2048 + minLength: 1 + nullable: true + type: string + client_id: + description: The OAuth2 client ID issued by the authorization server. + example: "my-client-id" + maxLength: 2048 + minLength: 1 + type: string + client_secret: + description: |- + The OAuth2 client secret issued by the authorization server. + Write-only; never returned by the API. + example: "my-client-secret" + maxLength: 2048 + minLength: 1 + type: string + name: + description: Human-readable name for this auth method. Must be unique within your organization. + example: "my-oauth2-auth" + maxLength: 100 + minLength: 1 + type: string + scope: + description: Space-separated list of OAuth2 scopes to request. + example: "read:webhooks write:webhooks" + maxLength: 2048 + minLength: 1 + nullable: true + type: string + required: + - name + - access_token_url + - client_id + - client_secret + type: object + WebhooksOAuth2ClientCredentialsCreateData: + description: OAuth2 client credentials data for a create request. + properties: + attributes: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsCreateAttributes" + type: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsType" + required: + - type + - attributes + type: object + WebhooksOAuth2ClientCredentialsCreateRequest: + description: Create request for an OAuth2 client credentials auth method. + properties: + data: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsCreateData" + required: + - data + type: object + WebhooksOAuth2ClientCredentialsRelationship: + description: Relationship pointing to the OAuth2 client credentials resource for this auth method. + properties: + data: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsRelationshipData" + type: object + WebhooksOAuth2ClientCredentialsRelationshipData: + description: Relationship data referencing an OAuth2 client credentials resource. + properties: + id: + description: The ID of the OAuth2 client credentials resource. + example: "596da4af-0563-4097-90ff-07230c3f9db3" + type: string + type: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsType" + type: object + WebhooksOAuth2ClientCredentialsResponse: + description: Response containing an OAuth2 client credentials auth method. + properties: + data: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsResponseData" + required: + - data + type: object + WebhooksOAuth2ClientCredentialsResponseAttributes: + description: OAuth2 client credentials attributes returned by the API. The `client_secret` is never echoed. + properties: + access_token_url: + description: URL of the OAuth2 access token endpoint. + example: "https://example.com/oauth/token" + type: string + audience: + description: The intended audience for the OAuth2 access token. + example: "https://api.example.com" + nullable: true + type: string + client_id: + description: The OAuth2 client ID issued by the authorization server. + example: "my-client-id" + type: string + name: + description: Human-readable name for this auth method. + example: "my-oauth2-auth" + type: string + protocol: + $ref: "#/components/schemas/WebhooksAuthMethodProtocol" + scope: + description: Space-separated list of OAuth2 scopes to request. + example: "read:webhooks write:webhooks" + nullable: true + type: string + type: object + WebhooksOAuth2ClientCredentialsResponseData: + description: OAuth2 client credentials data from a response. + properties: + attributes: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsResponseAttributes" + id: + description: The ID of the OAuth2 client credentials auth method. + example: "596da4af-0563-4097-90ff-07230c3f9db3" + type: string + type: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsType" + required: + - id + - type + - attributes + type: object + WebhooksOAuth2ClientCredentialsType: + default: webhooks-auth-method-oauth2-client-credentials + description: OAuth2 client credentials resource type. + enum: + - webhooks-auth-method-oauth2-client-credentials + example: webhooks-auth-method-oauth2-client-credentials + type: string + x-enum-varnames: + - WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS + WebhooksOAuth2ClientCredentialsUpdateAttributes: + description: OAuth2 client credentials attributes for an update request. + properties: + access_token_url: + description: URL of the OAuth2 access token endpoint. + example: "https://example.com/oauth/token" + maxLength: 2048 + minLength: 1 + type: string + audience: + description: The intended audience for the OAuth2 access token. + example: "https://api.example.com" + maxLength: 2048 + minLength: 1 + nullable: true + type: string + client_id: + description: The OAuth2 client ID issued by the authorization server. + example: "my-client-id" + maxLength: 2048 + minLength: 1 + type: string + client_secret: + description: |- + The OAuth2 client secret issued by the authorization server. + Write-only; never returned by the API. + example: "my-client-secret" + maxLength: 2048 + minLength: 1 + type: string + name: + description: Human-readable name for this auth method. + example: "my-oauth2-auth" + maxLength: 100 + minLength: 1 + type: string + scope: + description: Space-separated list of OAuth2 scopes to request. + example: "read:webhooks write:webhooks" + maxLength: 2048 + minLength: 1 + nullable: true + type: string + type: object + WebhooksOAuth2ClientCredentialsUpdateData: + description: OAuth2 client credentials data for an update request. + properties: + attributes: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsUpdateAttributes" + type: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsType" + required: + - type + - attributes + type: object + WebhooksOAuth2ClientCredentialsUpdateRequest: + description: Update request for an OAuth2 client credentials auth method. + properties: + data: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsUpdateData" + required: + - data + type: object Weekday: description: A day of the week. enum: @@ -125611,6 +125897,223 @@ paths: summary: List ServiceNow users tags: - ServiceNow Integration + /api/v2/integration/webhooks/configuration/auth-method: + get: + description: |- + Get a list of all auth methods configured for the Webhooks integration in + your organization. + operationId: GetAllAuthMethods + parameters: + - $ref: "#/components/parameters/WebhooksAuthMethodInclude" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + protocol: oauth2-client-credentials + id: 00000000-0000-0000-0000-000000000001 + relationships: + oauth2-client-credentials: + data: + id: 00000000-0000-0000-0000-000000000001 + type: webhooks-auth-method-oauth2-client-credentials + type: webhooks-auth-method + schema: + $ref: "#/components/schemas/WebhooksAuthMethodsResponse" + description: OK + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get all auth methods + tags: + - Webhooks Integration + "x-permission": + operator: OR + permissions: + - integrations_read + /api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials: + post: + description: |- + Create a new OAuth2 client credentials auth method for the Webhooks + integration. The `client_secret` is stored securely and never returned. + operationId: CreateOAuth2ClientCredentials + requestBody: + content: + application/json: + examples: + default: + 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 + schema: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsCreateRequest" + description: OAuth2 client credentials payload. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + access_token_url: https://example.com/oauth/token + audience: https://api.example.com + client_id: my-client-id + name: my-oauth2-auth + protocol: oauth2-client-credentials + scope: read:webhooks write:webhooks + id: 00000000-0000-0000-0000-000000000002 + type: webhooks-auth-method-oauth2-client-credentials + schema: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsResponse" + description: CREATED + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "409": + $ref: "#/components/responses/ConflictResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create an OAuth2 client credentials auth method + tags: + - Webhooks Integration + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - manage_integrations + /api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id}: + delete: + description: Delete an OAuth2 client credentials auth method by ID. + operationId: DeleteOAuth2ClientCredentials + parameters: + - $ref: "#/components/parameters/WebhooksAuthMethodIDPathParameter" + responses: + "204": + description: OK + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete an OAuth2 client credentials auth method + tags: + - Webhooks Integration + "x-permission": + operator: OR + permissions: + - manage_integrations + get: + description: Get a single OAuth2 client credentials auth method by ID. + operationId: GetOAuth2ClientCredentials + parameters: + - $ref: "#/components/parameters/WebhooksAuthMethodIDPathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + access_token_url: https://example.com/oauth/token + audience: https://api.example.com + client_id: my-client-id + name: my-oauth2-auth + protocol: oauth2-client-credentials + scope: read:webhooks write:webhooks + id: 00000000-0000-0000-0000-000000000003 + type: webhooks-auth-method-oauth2-client-credentials + schema: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsResponse" + description: OK + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get an OAuth2 client credentials auth method + tags: + - Webhooks Integration + "x-permission": + operator: OR + permissions: + - integrations_read + patch: + description: Update an existing OAuth2 client credentials auth method. + operationId: UpdateOAuth2ClientCredentials + parameters: + - $ref: "#/components/parameters/WebhooksAuthMethodIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + name: my-oauth2-auth-renamed + type: webhooks-auth-method-oauth2-client-credentials + schema: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsUpdateRequest" + description: OAuth2 client credentials payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + access_token_url: https://example.com/oauth/token + audience: https://api.example.com + client_id: my-client-id + name: my-oauth2-auth-renamed + protocol: oauth2-client-credentials + scope: read:webhooks write:webhooks + id: 00000000-0000-0000-0000-000000000004 + type: webhooks-auth-method-oauth2-client-credentials + schema: + $ref: "#/components/schemas/WebhooksOAuth2ClientCredentialsResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "409": + $ref: "#/components/responses/ConflictResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Update an OAuth2 client credentials auth method + tags: + - Webhooks Integration + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - manage_integrations /api/v2/integrations: get: operationId: ListIntegrations @@ -170287,6 +170790,12 @@ tags: Manage web integration accounts programmatically through the Datadog API. See the [Web Integrations page](https://app.datadoghq.com/integrations) for more information. name: Web Integrations + - description: |- + Configure your [Datadog Webhooks integration](https://docs.datadoghq.com/integrations/webhooks/) + directly through the Datadog API. + externalDocs: + url: https://docs.datadoghq.com/api/latest/webhooks-integration + name: Webhooks Integration - description: |- Create, read, update, and delete saved widgets. Widgets are reusable visualization components stored independently from any dashboard or notebook, diff --git a/examples/v2/webhooks-integration/CreateOAuth2ClientCredentials.rb b/examples/v2/webhooks-integration/CreateOAuth2ClientCredentials.rb new file mode 100644 index 000000000000..a068d2861bfd --- /dev/null +++ b/examples/v2/webhooks-integration/CreateOAuth2ClientCredentials.rb @@ -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) diff --git a/examples/v2/webhooks-integration/DeleteOAuth2ClientCredentials.rb b/examples/v2/webhooks-integration/DeleteOAuth2ClientCredentials.rb new file mode 100644 index 000000000000..83c2578a6b27 --- /dev/null +++ b/examples/v2/webhooks-integration/DeleteOAuth2ClientCredentials.rb @@ -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") diff --git a/examples/v2/webhooks-integration/GetAllAuthMethods.rb b/examples/v2/webhooks-integration/GetAllAuthMethods.rb new file mode 100644 index 000000000000..e9d8a4d56fe1 --- /dev/null +++ b/examples/v2/webhooks-integration/GetAllAuthMethods.rb @@ -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() diff --git a/examples/v2/webhooks-integration/GetOAuth2ClientCredentials.rb b/examples/v2/webhooks-integration/GetOAuth2ClientCredentials.rb new file mode 100644 index 000000000000..4592e2b6e606 --- /dev/null +++ b/examples/v2/webhooks-integration/GetOAuth2ClientCredentials.rb @@ -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") diff --git a/examples/v2/webhooks-integration/UpdateOAuth2ClientCredentials.rb b/examples/v2/webhooks-integration/UpdateOAuth2ClientCredentials.rb new file mode 100644 index 000000000000..c01ad48b5885 --- /dev/null +++ b/examples/v2/webhooks-integration/UpdateOAuth2ClientCredentials.rb @@ -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) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index fb9b295c7eca..295fc6a97454 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -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", }, diff --git a/features/v2/given.json b/features/v2/given.json index 7139a86ede5c..f7533901108b 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -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": [ { diff --git a/features/v2/undo.json b/features/v2/undo.json index b6003df86834..286a2c3af8a0 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -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": { diff --git a/features/v2/webhooks_integration.feature b/features/v2/webhooks_integration.feature new file mode 100644 index 000000000000..c97a2d403753 --- /dev/null +++ b/features/v2/webhooks_integration.feature @@ -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 diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 6ed9f06191bc..0e2cf6ae78c0 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -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", @@ -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" } diff --git a/lib/datadog_api_client/v2/api/webhooks_integration_api.rb b/lib/datadog_api_client/v2/api/webhooks_integration_api.rb new file mode 100644 index 000000000000..bf89844dff1a --- /dev/null +++ b/lib/datadog_api_client/v2/api/webhooks_integration_api.rb @@ -0,0 +1,363 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class WebhooksIntegrationAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Create an OAuth2 client credentials auth method. + # + # @see #create_o_auth2_client_credentials_with_http_info + def create_o_auth2_client_credentials(body, opts = {}) + data, _status_code, _headers = create_o_auth2_client_credentials_with_http_info(body, opts) + data + end + + # Create an OAuth2 client credentials auth method. + # + # Create a new OAuth2 client credentials auth method for the Webhooks + # integration. The `client_secret` is stored securely and never returned. + # + # @param body [WebhooksOAuth2ClientCredentialsCreateRequest] OAuth2 client credentials payload. + # @param opts [Hash] the optional parameters + # @return [Array<(WebhooksOAuth2ClientCredentialsResponse, Integer, Hash)>] WebhooksOAuth2ClientCredentialsResponse data, response status code and response headers + def create_o_auth2_client_credentials_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.create_o_auth2_client_credentials ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling WebhooksIntegrationAPI.create_o_auth2_client_credentials" + end + # resource path + local_var_path = '/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'WebhooksOAuth2ClientCredentialsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_o_auth2_client_credentials, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksIntegrationAPI#create_o_auth2_client_credentials\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete an OAuth2 client credentials auth method. + # + # @see #delete_o_auth2_client_credentials_with_http_info + def delete_o_auth2_client_credentials(auth_method_id, opts = {}) + delete_o_auth2_client_credentials_with_http_info(auth_method_id, opts) + nil + end + + # Delete an OAuth2 client credentials auth method. + # + # Delete an OAuth2 client credentials auth method by ID. + # + # @param auth_method_id [String] The UUID of the auth method. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_o_auth2_client_credentials_with_http_info(auth_method_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.delete_o_auth2_client_credentials ...' + end + # verify the required parameter 'auth_method_id' is set + if @api_client.config.client_side_validation && auth_method_id.nil? + fail ArgumentError, "Missing the required parameter 'auth_method_id' when calling WebhooksIntegrationAPI.delete_o_auth2_client_credentials" + end + # resource path + local_var_path = '/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id}'.sub('{auth_method_id}', CGI.escape(auth_method_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_o_auth2_client_credentials, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksIntegrationAPI#delete_o_auth2_client_credentials\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get all auth methods. + # + # @see #get_all_auth_methods_with_http_info + def get_all_auth_methods(opts = {}) + data, _status_code, _headers = get_all_auth_methods_with_http_info(opts) + data + end + + # Get all auth methods. + # + # Get a list of all auth methods configured for the Webhooks integration in + # your organization. + # + # @param opts [Hash] the optional parameters + # @option opts [WebhooksAuthMethodProtocol] :include Comma-separated list of relationships to include in the response. + # @return [Array<(WebhooksAuthMethodsResponse, Integer, Hash)>] WebhooksAuthMethodsResponse data, response status code and response headers + def get_all_auth_methods_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.get_all_auth_methods ...' + end + allowable_values = ['oauth2-client-credentials'] + if @api_client.config.client_side_validation && opts[:'include'] && !allowable_values.include?(opts[:'include']) + fail ArgumentError, "invalid value for \"include\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/api/v2/integration/webhooks/configuration/auth-method' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'WebhooksAuthMethodsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_all_auth_methods, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksIntegrationAPI#get_all_auth_methods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get an OAuth2 client credentials auth method. + # + # @see #get_o_auth2_client_credentials_with_http_info + def get_o_auth2_client_credentials(auth_method_id, opts = {}) + data, _status_code, _headers = get_o_auth2_client_credentials_with_http_info(auth_method_id, opts) + data + end + + # Get an OAuth2 client credentials auth method. + # + # Get a single OAuth2 client credentials auth method by ID. + # + # @param auth_method_id [String] The UUID of the auth method. + # @param opts [Hash] the optional parameters + # @return [Array<(WebhooksOAuth2ClientCredentialsResponse, Integer, Hash)>] WebhooksOAuth2ClientCredentialsResponse data, response status code and response headers + def get_o_auth2_client_credentials_with_http_info(auth_method_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.get_o_auth2_client_credentials ...' + end + # verify the required parameter 'auth_method_id' is set + if @api_client.config.client_side_validation && auth_method_id.nil? + fail ArgumentError, "Missing the required parameter 'auth_method_id' when calling WebhooksIntegrationAPI.get_o_auth2_client_credentials" + end + # resource path + local_var_path = '/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id}'.sub('{auth_method_id}', CGI.escape(auth_method_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'WebhooksOAuth2ClientCredentialsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_o_auth2_client_credentials, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksIntegrationAPI#get_o_auth2_client_credentials\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update an OAuth2 client credentials auth method. + # + # @see #update_o_auth2_client_credentials_with_http_info + def update_o_auth2_client_credentials(auth_method_id, body, opts = {}) + data, _status_code, _headers = update_o_auth2_client_credentials_with_http_info(auth_method_id, body, opts) + data + end + + # Update an OAuth2 client credentials auth method. + # + # Update an existing OAuth2 client credentials auth method. + # + # @param auth_method_id [String] The UUID of the auth method. + # @param body [WebhooksOAuth2ClientCredentialsUpdateRequest] OAuth2 client credentials payload. + # @param opts [Hash] the optional parameters + # @return [Array<(WebhooksOAuth2ClientCredentialsResponse, Integer, Hash)>] WebhooksOAuth2ClientCredentialsResponse data, response status code and response headers + def update_o_auth2_client_credentials_with_http_info(auth_method_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.update_o_auth2_client_credentials ...' + end + # verify the required parameter 'auth_method_id' is set + if @api_client.config.client_side_validation && auth_method_id.nil? + fail ArgumentError, "Missing the required parameter 'auth_method_id' when calling WebhooksIntegrationAPI.update_o_auth2_client_credentials" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling WebhooksIntegrationAPI.update_o_auth2_client_credentials" + end + # resource path + local_var_path = '/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id}'.sub('{auth_method_id}', CGI.escape(auth_method_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'WebhooksOAuth2ClientCredentialsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_o_auth2_client_credentials, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksIntegrationAPI#update_o_auth2_client_credentials\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_auth_method_attributes.rb b/lib/datadog_api_client/v2/models/webhooks_auth_method_attributes.rb new file mode 100644 index 000000000000..5440fd79ebfe --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_auth_method_attributes.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of a webhooks auth method. + class WebhooksAuthMethodAttributes + include BaseGenericModel + + # Authentication protocol used by the auth method. + attr_accessor :protocol + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'protocol' => :'protocol' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'protocol' => :'WebhooksAuthMethodProtocol' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksAuthMethodAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'protocol') + self.protocol = attributes[:'protocol'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + protocol == o.protocol && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [protocol, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_auth_method_protocol.rb b/lib/datadog_api_client/v2/models/webhooks_auth_method_protocol.rb new file mode 100644 index 000000000000..9e1e9c90df6c --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_auth_method_protocol.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Authentication protocol used by the auth method. + class WebhooksAuthMethodProtocol + include BaseEnumModel + + OAUTH2_CLIENT_CREDENTIALS = "oauth2-client-credentials".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_auth_method_relationships.rb b/lib/datadog_api_client/v2/models/webhooks_auth_method_relationships.rb new file mode 100644 index 000000000000..536588516823 --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_auth_method_relationships.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationships of a webhooks auth method to its protocol-specific resource. + class WebhooksAuthMethodRelationships + include BaseGenericModel + + # Relationship pointing to the OAuth2 client credentials resource for this auth method. + attr_accessor :oauth2_client_credentials + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'oauth2_client_credentials' => :'oauth2-client-credentials' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'oauth2_client_credentials' => :'WebhooksOAuth2ClientCredentialsRelationship' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksAuthMethodRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'oauth2_client_credentials') + self.oauth2_client_credentials = attributes[:'oauth2_client_credentials'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + oauth2_client_credentials == o.oauth2_client_credentials && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [oauth2_client_credentials, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_auth_method_response_data.rb b/lib/datadog_api_client/v2/models/webhooks_auth_method_response_data.rb new file mode 100644 index 000000000000..24319509480f --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_auth_method_response_data.rb @@ -0,0 +1,175 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Webhooks auth method data from a response. + class WebhooksAuthMethodResponseData + include BaseGenericModel + + # Attributes of a webhooks auth method. + attr_reader :attributes + + # The ID of the auth method. + attr_reader :id + + # Relationships of a webhooks auth method to its protocol-specific resource. + attr_accessor :relationships + + # Webhooks auth method resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'WebhooksAuthMethodAttributes', + :'id' => :'String', + :'relationships' => :'WebhooksAuthMethodRelationships', + :'type' => :'WebhooksAuthMethodType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksAuthMethodResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_auth_method_type.rb b/lib/datadog_api_client/v2/models/webhooks_auth_method_type.rb new file mode 100644 index 000000000000..3b604f326887 --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_auth_method_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Webhooks auth method resource type. + class WebhooksAuthMethodType + include BaseEnumModel + + WEBHOOKS_AUTH_METHOD = "webhooks-auth-method".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_auth_methods_response.rb b/lib/datadog_api_client/v2/models/webhooks_auth_methods_response.rb new file mode 100644 index 000000000000..759bb20957af --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_auth_methods_response.rb @@ -0,0 +1,137 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a list of webhooks auth methods. + class WebhooksAuthMethodsResponse + include BaseGenericModel + + # An array of webhooks auth methods. + attr_reader :data + + # Resources related to the auth methods, included when requested via the `include` query parameter. + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksAuthMethodsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_create_attributes.rb b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_create_attributes.rb new file mode 100644 index 000000000000..9117e789a5bf --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_create_attributes.rb @@ -0,0 +1,278 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # OAuth2 client credentials attributes for a create request. + class WebhooksOAuth2ClientCredentialsCreateAttributes + include BaseGenericModel + + # URL of the OAuth2 access token endpoint. + attr_reader :access_token_url + + # The intended audience for the OAuth2 access token. + attr_reader :audience + + # The OAuth2 client ID issued by the authorization server. + attr_reader :client_id + + # The OAuth2 client secret issued by the authorization server. + # Write-only; never returned by the API. + attr_reader :client_secret + + # Human-readable name for this auth method. Must be unique within your organization. + attr_reader :name + + # Space-separated list of OAuth2 scopes to request. + attr_reader :scope + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'access_token_url' => :'access_token_url', + :'audience' => :'audience', + :'client_id' => :'client_id', + :'client_secret' => :'client_secret', + :'name' => :'name', + :'scope' => :'scope' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'access_token_url' => :'String', + :'audience' => :'String', + :'client_id' => :'String', + :'client_secret' => :'String', + :'name' => :'String', + :'scope' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'audience', + :'scope', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsCreateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'access_token_url') + self.access_token_url = attributes[:'access_token_url'] + end + + if attributes.key?(:'audience') + self.audience = attributes[:'audience'] + end + + if attributes.key?(:'client_id') + self.client_id = attributes[:'client_id'] + end + + if attributes.key?(:'client_secret') + self.client_secret = attributes[:'client_secret'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'scope') + self.scope = attributes[:'scope'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @access_token_url.nil? + return false if @access_token_url.to_s.length > 2048 + return false if @access_token_url.to_s.length < 1 + return false if !@audience.nil? && @audience.to_s.length > 2048 + return false if !@audience.nil? && @audience.to_s.length < 1 + return false if @client_id.nil? + return false if @client_id.to_s.length > 2048 + return false if @client_id.to_s.length < 1 + return false if @client_secret.nil? + return false if @client_secret.to_s.length > 2048 + return false if @client_secret.to_s.length < 1 + return false if @name.nil? + return false if @name.to_s.length > 100 + return false if @name.to_s.length < 1 + return false if !@scope.nil? && @scope.to_s.length > 2048 + return false if !@scope.nil? && @scope.to_s.length < 1 + true + end + + # Custom attribute writer method with validation + # @param access_token_url [Object] Object to be assigned + # @!visibility private + def access_token_url=(access_token_url) + if access_token_url.nil? + fail ArgumentError, 'invalid value for "access_token_url", access_token_url cannot be nil.' + end + if access_token_url.to_s.length > 2048 + fail ArgumentError, 'invalid value for "access_token_url", the character length must be smaller than or equal to 2048.' + end + if access_token_url.to_s.length < 1 + fail ArgumentError, 'invalid value for "access_token_url", the character length must be great than or equal to 1.' + end + @access_token_url = access_token_url + end + + # Custom attribute writer method with validation + # @param audience [Object] Object to be assigned + # @!visibility private + def audience=(audience) + if !audience.nil? && audience.to_s.length > 2048 + fail ArgumentError, 'invalid value for "audience", the character length must be smaller than or equal to 2048.' + end + if !audience.nil? && audience.to_s.length < 1 + fail ArgumentError, 'invalid value for "audience", the character length must be great than or equal to 1.' + end + @audience = audience + end + + # Custom attribute writer method with validation + # @param client_id [Object] Object to be assigned + # @!visibility private + def client_id=(client_id) + if client_id.nil? + fail ArgumentError, 'invalid value for "client_id", client_id cannot be nil.' + end + if client_id.to_s.length > 2048 + fail ArgumentError, 'invalid value for "client_id", the character length must be smaller than or equal to 2048.' + end + if client_id.to_s.length < 1 + fail ArgumentError, 'invalid value for "client_id", the character length must be great than or equal to 1.' + end + @client_id = client_id + end + + # Custom attribute writer method with validation + # @param client_secret [Object] Object to be assigned + # @!visibility private + def client_secret=(client_secret) + if client_secret.nil? + fail ArgumentError, 'invalid value for "client_secret", client_secret cannot be nil.' + end + if client_secret.to_s.length > 2048 + fail ArgumentError, 'invalid value for "client_secret", the character length must be smaller than or equal to 2048.' + end + if client_secret.to_s.length < 1 + fail ArgumentError, 'invalid value for "client_secret", the character length must be great than or equal to 1.' + end + @client_secret = client_secret + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + if name.to_s.length > 100 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 100.' + end + if name.to_s.length < 1 + fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param scope [Object] Object to be assigned + # @!visibility private + def scope=(scope) + if !scope.nil? && scope.to_s.length > 2048 + fail ArgumentError, 'invalid value for "scope", the character length must be smaller than or equal to 2048.' + end + if !scope.nil? && scope.to_s.length < 1 + fail ArgumentError, 'invalid value for "scope", the character length must be great than or equal to 1.' + end + @scope = scope + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + access_token_url == o.access_token_url && + audience == o.audience && + client_id == o.client_id && + client_secret == o.client_secret && + name == o.name && + scope == o.scope && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [access_token_url, audience, client_id, client_secret, name, scope, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_create_data.rb b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_create_data.rb new file mode 100644 index 000000000000..d9b7f19a8389 --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_create_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # OAuth2 client credentials data for a create request. + class WebhooksOAuth2ClientCredentialsCreateData + include BaseGenericModel + + # OAuth2 client credentials attributes for a create request. + attr_reader :attributes + + # OAuth2 client credentials resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'WebhooksOAuth2ClientCredentialsCreateAttributes', + :'type' => :'WebhooksOAuth2ClientCredentialsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsCreateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_create_request.rb b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_create_request.rb new file mode 100644 index 000000000000..a6585a9e145a --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Create request for an OAuth2 client credentials auth method. + class WebhooksOAuth2ClientCredentialsCreateRequest + include BaseGenericModel + + # OAuth2 client credentials data for a create request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'WebhooksOAuth2ClientCredentialsCreateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_relationship.rb b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_relationship.rb new file mode 100644 index 000000000000..e182878c7ec6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_relationship.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationship pointing to the OAuth2 client credentials resource for this auth method. + class WebhooksOAuth2ClientCredentialsRelationship + include BaseGenericModel + + # Relationship data referencing an OAuth2 client credentials resource. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'WebhooksOAuth2ClientCredentialsRelationshipData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsRelationship` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_relationship_data.rb b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_relationship_data.rb new file mode 100644 index 000000000000..2497658eae39 --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_relationship_data.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationship data referencing an OAuth2 client credentials resource. + class WebhooksOAuth2ClientCredentialsRelationshipData + include BaseGenericModel + + # The ID of the OAuth2 client credentials resource. + attr_accessor :id + + # OAuth2 client credentials resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'WebhooksOAuth2ClientCredentialsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsRelationshipData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_response.rb b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_response.rb new file mode 100644 index 000000000000..107e8e8e867f --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing an OAuth2 client credentials auth method. + class WebhooksOAuth2ClientCredentialsResponse + include BaseGenericModel + + # OAuth2 client credentials data from a response. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'WebhooksOAuth2ClientCredentialsResponseData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_response_attributes.rb b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_response_attributes.rb new file mode 100644 index 000000000000..7ea2b7e7003f --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_response_attributes.rb @@ -0,0 +1,164 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # OAuth2 client credentials attributes returned by the API. The `client_secret` is never echoed. + class WebhooksOAuth2ClientCredentialsResponseAttributes + include BaseGenericModel + + # URL of the OAuth2 access token endpoint. + attr_accessor :access_token_url + + # The intended audience for the OAuth2 access token. + attr_accessor :audience + + # The OAuth2 client ID issued by the authorization server. + attr_accessor :client_id + + # Human-readable name for this auth method. + attr_accessor :name + + # Authentication protocol used by the auth method. + attr_accessor :protocol + + # Space-separated list of OAuth2 scopes to request. + attr_accessor :scope + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'access_token_url' => :'access_token_url', + :'audience' => :'audience', + :'client_id' => :'client_id', + :'name' => :'name', + :'protocol' => :'protocol', + :'scope' => :'scope' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'access_token_url' => :'String', + :'audience' => :'String', + :'client_id' => :'String', + :'name' => :'String', + :'protocol' => :'WebhooksAuthMethodProtocol', + :'scope' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'audience', + :'scope', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'access_token_url') + self.access_token_url = attributes[:'access_token_url'] + end + + if attributes.key?(:'audience') + self.audience = attributes[:'audience'] + end + + if attributes.key?(:'client_id') + self.client_id = attributes[:'client_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'protocol') + self.protocol = attributes[:'protocol'] + end + + if attributes.key?(:'scope') + self.scope = attributes[:'scope'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + access_token_url == o.access_token_url && + audience == o.audience && + client_id == o.client_id && + name == o.name && + protocol == o.protocol && + scope == o.scope && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [access_token_url, audience, client_id, name, protocol, scope, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_response_data.rb b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_response_data.rb new file mode 100644 index 000000000000..a92e8ff06cef --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_response_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # OAuth2 client credentials data from a response. + class WebhooksOAuth2ClientCredentialsResponseData + include BaseGenericModel + + # OAuth2 client credentials attributes returned by the API. The `client_secret` is never echoed. + attr_reader :attributes + + # The ID of the OAuth2 client credentials auth method. + attr_reader :id + + # OAuth2 client credentials resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'WebhooksOAuth2ClientCredentialsResponseAttributes', + :'id' => :'String', + :'type' => :'WebhooksOAuth2ClientCredentialsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_type.rb b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_type.rb new file mode 100644 index 000000000000..75ed02728ad2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # OAuth2 client credentials resource type. + class WebhooksOAuth2ClientCredentialsType + include BaseEnumModel + + WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS = "webhooks-auth-method-oauth2-client-credentials".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_update_attributes.rb b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_update_attributes.rb new file mode 100644 index 000000000000..d2611dc70024 --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_update_attributes.rb @@ -0,0 +1,262 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # OAuth2 client credentials attributes for an update request. + class WebhooksOAuth2ClientCredentialsUpdateAttributes + include BaseGenericModel + + # URL of the OAuth2 access token endpoint. + attr_reader :access_token_url + + # The intended audience for the OAuth2 access token. + attr_reader :audience + + # The OAuth2 client ID issued by the authorization server. + attr_reader :client_id + + # The OAuth2 client secret issued by the authorization server. + # Write-only; never returned by the API. + attr_reader :client_secret + + # Human-readable name for this auth method. + attr_reader :name + + # Space-separated list of OAuth2 scopes to request. + attr_reader :scope + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'access_token_url' => :'access_token_url', + :'audience' => :'audience', + :'client_id' => :'client_id', + :'client_secret' => :'client_secret', + :'name' => :'name', + :'scope' => :'scope' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'access_token_url' => :'String', + :'audience' => :'String', + :'client_id' => :'String', + :'client_secret' => :'String', + :'name' => :'String', + :'scope' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'audience', + :'scope', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsUpdateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'access_token_url') + self.access_token_url = attributes[:'access_token_url'] + end + + if attributes.key?(:'audience') + self.audience = attributes[:'audience'] + end + + if attributes.key?(:'client_id') + self.client_id = attributes[:'client_id'] + end + + if attributes.key?(:'client_secret') + self.client_secret = attributes[:'client_secret'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'scope') + self.scope = attributes[:'scope'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@access_token_url.nil? && @access_token_url.to_s.length > 2048 + return false if !@access_token_url.nil? && @access_token_url.to_s.length < 1 + return false if !@audience.nil? && @audience.to_s.length > 2048 + return false if !@audience.nil? && @audience.to_s.length < 1 + return false if !@client_id.nil? && @client_id.to_s.length > 2048 + return false if !@client_id.nil? && @client_id.to_s.length < 1 + return false if !@client_secret.nil? && @client_secret.to_s.length > 2048 + return false if !@client_secret.nil? && @client_secret.to_s.length < 1 + return false if !@name.nil? && @name.to_s.length > 100 + return false if !@name.nil? && @name.to_s.length < 1 + return false if !@scope.nil? && @scope.to_s.length > 2048 + return false if !@scope.nil? && @scope.to_s.length < 1 + true + end + + # Custom attribute writer method with validation + # @param access_token_url [Object] Object to be assigned + # @!visibility private + def access_token_url=(access_token_url) + if !access_token_url.nil? && access_token_url.to_s.length > 2048 + fail ArgumentError, 'invalid value for "access_token_url", the character length must be smaller than or equal to 2048.' + end + if !access_token_url.nil? && access_token_url.to_s.length < 1 + fail ArgumentError, 'invalid value for "access_token_url", the character length must be great than or equal to 1.' + end + @access_token_url = access_token_url + end + + # Custom attribute writer method with validation + # @param audience [Object] Object to be assigned + # @!visibility private + def audience=(audience) + if !audience.nil? && audience.to_s.length > 2048 + fail ArgumentError, 'invalid value for "audience", the character length must be smaller than or equal to 2048.' + end + if !audience.nil? && audience.to_s.length < 1 + fail ArgumentError, 'invalid value for "audience", the character length must be great than or equal to 1.' + end + @audience = audience + end + + # Custom attribute writer method with validation + # @param client_id [Object] Object to be assigned + # @!visibility private + def client_id=(client_id) + if !client_id.nil? && client_id.to_s.length > 2048 + fail ArgumentError, 'invalid value for "client_id", the character length must be smaller than or equal to 2048.' + end + if !client_id.nil? && client_id.to_s.length < 1 + fail ArgumentError, 'invalid value for "client_id", the character length must be great than or equal to 1.' + end + @client_id = client_id + end + + # Custom attribute writer method with validation + # @param client_secret [Object] Object to be assigned + # @!visibility private + def client_secret=(client_secret) + if !client_secret.nil? && client_secret.to_s.length > 2048 + fail ArgumentError, 'invalid value for "client_secret", the character length must be smaller than or equal to 2048.' + end + if !client_secret.nil? && client_secret.to_s.length < 1 + fail ArgumentError, 'invalid value for "client_secret", the character length must be great than or equal to 1.' + end + @client_secret = client_secret + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if !name.nil? && name.to_s.length > 100 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 100.' + end + if !name.nil? && name.to_s.length < 1 + fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param scope [Object] Object to be assigned + # @!visibility private + def scope=(scope) + if !scope.nil? && scope.to_s.length > 2048 + fail ArgumentError, 'invalid value for "scope", the character length must be smaller than or equal to 2048.' + end + if !scope.nil? && scope.to_s.length < 1 + fail ArgumentError, 'invalid value for "scope", the character length must be great than or equal to 1.' + end + @scope = scope + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + access_token_url == o.access_token_url && + audience == o.audience && + client_id == o.client_id && + client_secret == o.client_secret && + name == o.name && + scope == o.scope && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [access_token_url, audience, client_id, client_secret, name, scope, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_update_data.rb b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_update_data.rb new file mode 100644 index 000000000000..3231985b335b --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_update_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # OAuth2 client credentials data for an update request. + class WebhooksOAuth2ClientCredentialsUpdateData + include BaseGenericModel + + # OAuth2 client credentials attributes for an update request. + attr_reader :attributes + + # OAuth2 client credentials resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'WebhooksOAuth2ClientCredentialsUpdateAttributes', + :'type' => :'WebhooksOAuth2ClientCredentialsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsUpdateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_update_request.rb b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_update_request.rb new file mode 100644 index 000000000000..e9e26b474b5c --- /dev/null +++ b/lib/datadog_api_client/v2/models/webhooks_o_auth2_client_credentials_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Update request for an OAuth2 client credentials auth method. + class WebhooksOAuth2ClientCredentialsUpdateRequest + include BaseGenericModel + + # OAuth2 client credentials data for an update request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'WebhooksOAuth2ClientCredentialsUpdateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::WebhooksOAuth2ClientCredentialsUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end