From 158da31f30c9f42529456b8180bc4d87ca96e7bf Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 28 May 2026 21:33:56 +0000 Subject: [PATCH] Regenerate client from commit beecbd3 of spec repo --- .generator/schemas/v2/openapi.yaml | 509 ++++++++++++++++++ docs/datadog_api_client.v2.api.rst | 7 + docs/datadog_api_client.v2.model.rst | 126 +++++ .../CreateOAuth2ClientCredentials.py | 37 ++ .../DeleteOAuth2ClientCredentials.py | 13 + .../webhooks-integration/GetAllAuthMethods.py | 13 + .../GetOAuth2ClientCredentials.py | 15 + .../UpdateOAuth2ClientCredentials.py | 37 ++ .../v2/api/webhooks_integration_api.py | 244 +++++++++ src/datadog_api_client/v2/apis/__init__.py | 2 + .../model/webhooks_auth_method_attributes.py | 42 ++ .../v2/model/webhooks_auth_method_protocol.py | 35 ++ .../webhooks_auth_method_relationships.py | 50 ++ .../webhooks_auth_method_response_data.py | 72 +++ .../v2/model/webhooks_auth_method_type.py | 35 ++ .../model/webhooks_auth_methods_response.py | 60 +++ ...h2_client_credentials_create_attributes.py | 106 ++++ ..._o_auth2_client_credentials_create_data.py | 59 ++ ...auth2_client_credentials_create_request.py | 44 ++ ...o_auth2_client_credentials_relationship.py | 46 ++ ...h2_client_credentials_relationship_data.py | 56 ++ ...oks_o_auth2_client_credentials_response.py | 44 ++ ..._client_credentials_response_attributes.py | 87 +++ ..._auth2_client_credentials_response_data.py | 66 +++ ...ebhooks_o_auth2_client_credentials_type.py | 37 ++ ...h2_client_credentials_update_attributes.py | 109 ++++ ..._o_auth2_client_credentials_update_data.py | 59 ++ ...auth2_client_credentials_update_request.py | 44 ++ src/datadog_api_client/v2/models/__init__.py | 58 ++ tests/v2/features/given.json | 12 + tests/v2/features/undo.json | 37 ++ .../v2/features/webhooks_integration.feature | 97 ++++ 32 files changed, 2258 insertions(+) create mode 100644 examples/v2/webhooks-integration/CreateOAuth2ClientCredentials.py create mode 100644 examples/v2/webhooks-integration/DeleteOAuth2ClientCredentials.py create mode 100644 examples/v2/webhooks-integration/GetAllAuthMethods.py create mode 100644 examples/v2/webhooks-integration/GetOAuth2ClientCredentials.py create mode 100644 examples/v2/webhooks-integration/UpdateOAuth2ClientCredentials.py create mode 100644 src/datadog_api_client/v2/api/webhooks_integration_api.py create mode 100644 src/datadog_api_client/v2/model/webhooks_auth_method_attributes.py create mode 100644 src/datadog_api_client/v2/model/webhooks_auth_method_protocol.py create mode 100644 src/datadog_api_client/v2/model/webhooks_auth_method_relationships.py create mode 100644 src/datadog_api_client/v2/model/webhooks_auth_method_response_data.py create mode 100644 src/datadog_api_client/v2/model/webhooks_auth_method_type.py create mode 100644 src/datadog_api_client/v2/model/webhooks_auth_methods_response.py create mode 100644 src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_create_attributes.py create mode 100644 src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_create_data.py create mode 100644 src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_create_request.py create mode 100644 src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_relationship.py create mode 100644 src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_relationship_data.py create mode 100644 src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_response.py create mode 100644 src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_response_attributes.py create mode 100644 src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_response_data.py create mode 100644 src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_type.py create mode 100644 src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_update_attributes.py create mode 100644 src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_update_data.py create mode 100644 src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_update_request.py create mode 100644 tests/v2/features/webhooks_integration.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4d59bfade1..91d04c2267 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/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index 7ec5d64245..2254f31135 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -802,6 +802,13 @@ datadog\_api\_client.v2.api.web\_integrations\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.webhooks\_integration\_api module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.webhooks_integration_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.widgets\_api module ----------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 5d1f8d7e30..95aa2ee019 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -41507,6 +41507,132 @@ datadog\_api\_client.v2.model.web\_integration\_accounts\_response module :members: :show-inheritance: +datadog\_api\_client.v2.model.webhooks\_auth\_method\_attributes module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.webhooks_auth_method_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_auth\_method\_protocol module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.webhooks_auth_method_protocol + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_auth\_method\_relationships module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.webhooks_auth_method_relationships + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_auth\_method\_response\_data module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.webhooks_auth_method_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_auth\_method\_type module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.webhooks_auth_method_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_auth\_methods\_response module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.webhooks_auth_methods_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_o\_auth2\_client\_credentials\_create\_attributes module +------------------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_create_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_o\_auth2\_client\_credentials\_create\_data module +------------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_create_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_o\_auth2\_client\_credentials\_create\_request module +--------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_o\_auth2\_client\_credentials\_relationship module +------------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_relationship + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_o\_auth2\_client\_credentials\_relationship\_data module +------------------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_relationship_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_o\_auth2\_client\_credentials\_response module +-------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_o\_auth2\_client\_credentials\_response\_attributes module +-------------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_response_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_o\_auth2\_client\_credentials\_response\_data module +-------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_o\_auth2\_client\_credentials\_type module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_o\_auth2\_client\_credentials\_update\_attributes module +------------------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_update_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_o\_auth2\_client\_credentials\_update\_data module +------------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_update_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.webhooks\_o\_auth2\_client\_credentials\_update\_request module +--------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_update_request + :members: + :show-inheritance: + datadog\_api\_client.v2.model.weekday module -------------------------------------------- diff --git a/examples/v2/webhooks-integration/CreateOAuth2ClientCredentials.py b/examples/v2/webhooks-integration/CreateOAuth2ClientCredentials.py new file mode 100644 index 0000000000..cd3e6da77b --- /dev/null +++ b/examples/v2/webhooks-integration/CreateOAuth2ClientCredentials.py @@ -0,0 +1,37 @@ +""" +Create an OAuth2 client credentials auth method returns "CREATED" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.webhooks_integration_api import WebhooksIntegrationApi +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_create_attributes import ( + WebhooksOAuth2ClientCredentialsCreateAttributes, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_create_data import ( + WebhooksOAuth2ClientCredentialsCreateData, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_create_request import ( + WebhooksOAuth2ClientCredentialsCreateRequest, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_type import WebhooksOAuth2ClientCredentialsType + +body = WebhooksOAuth2ClientCredentialsCreateRequest( + data=WebhooksOAuth2ClientCredentialsCreateData( + attributes=WebhooksOAuth2ClientCredentialsCreateAttributes( + 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=WebhooksOAuth2ClientCredentialsType.WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WebhooksIntegrationApi(api_client) + response = api_instance.create_o_auth2_client_credentials(body=body) + + print(response) diff --git a/examples/v2/webhooks-integration/DeleteOAuth2ClientCredentials.py b/examples/v2/webhooks-integration/DeleteOAuth2ClientCredentials.py new file mode 100644 index 0000000000..1cdd489435 --- /dev/null +++ b/examples/v2/webhooks-integration/DeleteOAuth2ClientCredentials.py @@ -0,0 +1,13 @@ +""" +Delete an OAuth2 client credentials auth method returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.webhooks_integration_api import WebhooksIntegrationApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WebhooksIntegrationApi(api_client) + api_instance.delete_o_auth2_client_credentials( + auth_method_id="auth_method_id", + ) diff --git a/examples/v2/webhooks-integration/GetAllAuthMethods.py b/examples/v2/webhooks-integration/GetAllAuthMethods.py new file mode 100644 index 0000000000..32f3453bcc --- /dev/null +++ b/examples/v2/webhooks-integration/GetAllAuthMethods.py @@ -0,0 +1,13 @@ +""" +Get all auth methods returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.webhooks_integration_api import WebhooksIntegrationApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WebhooksIntegrationApi(api_client) + response = api_instance.get_all_auth_methods() + + print(response) diff --git a/examples/v2/webhooks-integration/GetOAuth2ClientCredentials.py b/examples/v2/webhooks-integration/GetOAuth2ClientCredentials.py new file mode 100644 index 0000000000..3fb4cbf3a7 --- /dev/null +++ b/examples/v2/webhooks-integration/GetOAuth2ClientCredentials.py @@ -0,0 +1,15 @@ +""" +Get an OAuth2 client credentials auth method returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.webhooks_integration_api import WebhooksIntegrationApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WebhooksIntegrationApi(api_client) + response = api_instance.get_o_auth2_client_credentials( + auth_method_id="auth_method_id", + ) + + print(response) diff --git a/examples/v2/webhooks-integration/UpdateOAuth2ClientCredentials.py b/examples/v2/webhooks-integration/UpdateOAuth2ClientCredentials.py new file mode 100644 index 0000000000..69c605a89b --- /dev/null +++ b/examples/v2/webhooks-integration/UpdateOAuth2ClientCredentials.py @@ -0,0 +1,37 @@ +""" +Update an OAuth2 client credentials auth method returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.webhooks_integration_api import WebhooksIntegrationApi +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_type import WebhooksOAuth2ClientCredentialsType +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_update_attributes import ( + WebhooksOAuth2ClientCredentialsUpdateAttributes, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_update_data import ( + WebhooksOAuth2ClientCredentialsUpdateData, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_update_request import ( + WebhooksOAuth2ClientCredentialsUpdateRequest, +) + +body = WebhooksOAuth2ClientCredentialsUpdateRequest( + data=WebhooksOAuth2ClientCredentialsUpdateData( + attributes=WebhooksOAuth2ClientCredentialsUpdateAttributes( + 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=WebhooksOAuth2ClientCredentialsType.WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WebhooksIntegrationApi(api_client) + response = api_instance.update_o_auth2_client_credentials(auth_method_id="auth_method_id", body=body) + + print(response) diff --git a/src/datadog_api_client/v2/api/webhooks_integration_api.py b/src/datadog_api_client/v2/api/webhooks_integration_api.py new file mode 100644 index 0000000000..5ba4599b67 --- /dev/null +++ b/src/datadog_api_client/v2/api/webhooks_integration_api.py @@ -0,0 +1,244 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict, Union + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.model_utils import ( + UnsetType, + unset, +) +from datadog_api_client.v2.model.webhooks_auth_methods_response import WebhooksAuthMethodsResponse +from datadog_api_client.v2.model.webhooks_auth_method_protocol import WebhooksAuthMethodProtocol +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_response import ( + WebhooksOAuth2ClientCredentialsResponse, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_create_request import ( + WebhooksOAuth2ClientCredentialsCreateRequest, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_update_request import ( + WebhooksOAuth2ClientCredentialsUpdateRequest, +) + + +class WebhooksIntegrationApi: + """ + Configure your `Datadog Webhooks integration `_ + directly through the Datadog API. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._create_o_auth2_client_credentials_endpoint = _Endpoint( + settings={ + "response_type": (WebhooksOAuth2ClientCredentialsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials", + "operation_id": "create_o_auth2_client_credentials", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (WebhooksOAuth2ClientCredentialsCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._delete_o_auth2_client_credentials_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id}", + "operation_id": "delete_o_auth2_client_credentials", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "auth_method_id": { + "required": True, + "openapi_types": (str,), + "attribute": "auth_method_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._get_all_auth_methods_endpoint = _Endpoint( + settings={ + "response_type": (WebhooksAuthMethodsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/integration/webhooks/configuration/auth-method", + "operation_id": "get_all_auth_methods", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "include": { + "openapi_types": (WebhooksAuthMethodProtocol,), + "attribute": "include", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._get_o_auth2_client_credentials_endpoint = _Endpoint( + settings={ + "response_type": (WebhooksOAuth2ClientCredentialsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id}", + "operation_id": "get_o_auth2_client_credentials", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "auth_method_id": { + "required": True, + "openapi_types": (str,), + "attribute": "auth_method_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._update_o_auth2_client_credentials_endpoint = _Endpoint( + settings={ + "response_type": (WebhooksOAuth2ClientCredentialsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id}", + "operation_id": "update_o_auth2_client_credentials", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "auth_method_id": { + "required": True, + "openapi_types": (str,), + "attribute": "auth_method_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (WebhooksOAuth2ClientCredentialsUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def create_o_auth2_client_credentials( + self, + body: WebhooksOAuth2ClientCredentialsCreateRequest, + ) -> WebhooksOAuth2ClientCredentialsResponse: + """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: OAuth2 client credentials payload. + :type body: WebhooksOAuth2ClientCredentialsCreateRequest + :rtype: WebhooksOAuth2ClientCredentialsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_o_auth2_client_credentials_endpoint.call_with_http_info(**kwargs) + + def delete_o_auth2_client_credentials( + self, + auth_method_id: str, + ) -> None: + """Delete an OAuth2 client credentials auth method. + + Delete an OAuth2 client credentials auth method by ID. + + :param auth_method_id: The UUID of the auth method. + :type auth_method_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["auth_method_id"] = auth_method_id + + return self._delete_o_auth2_client_credentials_endpoint.call_with_http_info(**kwargs) + + def get_all_auth_methods( + self, + *, + include: Union[WebhooksAuthMethodProtocol, UnsetType] = unset, + ) -> WebhooksAuthMethodsResponse: + """Get all auth methods. + + Get a list of all auth methods configured for the Webhooks integration in + your organization. + + :param include: Comma-separated list of relationships to include in the response. + :type include: WebhooksAuthMethodProtocol, optional + :rtype: WebhooksAuthMethodsResponse + """ + kwargs: Dict[str, Any] = {} + if include is not unset: + kwargs["include"] = include + + return self._get_all_auth_methods_endpoint.call_with_http_info(**kwargs) + + def get_o_auth2_client_credentials( + self, + auth_method_id: str, + ) -> WebhooksOAuth2ClientCredentialsResponse: + """Get an OAuth2 client credentials auth method. + + Get a single OAuth2 client credentials auth method by ID. + + :param auth_method_id: The UUID of the auth method. + :type auth_method_id: str + :rtype: WebhooksOAuth2ClientCredentialsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["auth_method_id"] = auth_method_id + + return self._get_o_auth2_client_credentials_endpoint.call_with_http_info(**kwargs) + + def update_o_auth2_client_credentials( + self, + auth_method_id: str, + body: WebhooksOAuth2ClientCredentialsUpdateRequest, + ) -> WebhooksOAuth2ClientCredentialsResponse: + """Update an OAuth2 client credentials auth method. + + Update an existing OAuth2 client credentials auth method. + + :param auth_method_id: The UUID of the auth method. + :type auth_method_id: str + :param body: OAuth2 client credentials payload. + :type body: WebhooksOAuth2ClientCredentialsUpdateRequest + :rtype: WebhooksOAuth2ClientCredentialsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["auth_method_id"] = auth_method_id + + kwargs["body"] = body + + return self._update_o_auth2_client_credentials_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index 54b4eab8ed..a8b3d54261 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -112,6 +112,7 @@ from datadog_api_client.v2.api.usage_metering_api import UsageMeteringApi from datadog_api_client.v2.api.users_api import UsersApi from datadog_api_client.v2.api.web_integrations_api import WebIntegrationsApi +from datadog_api_client.v2.api.webhooks_integration_api import WebhooksIntegrationApi from datadog_api_client.v2.api.widgets_api import WidgetsApi from datadog_api_client.v2.api.workflow_automation_api import WorkflowAutomationApi @@ -231,6 +232,7 @@ "UsageMeteringApi", "UsersApi", "WebIntegrationsApi", + "WebhooksIntegrationApi", "WidgetsApi", "WorkflowAutomationApi", ] diff --git a/src/datadog_api_client/v2/model/webhooks_auth_method_attributes.py b/src/datadog_api_client/v2/model/webhooks_auth_method_attributes.py new file mode 100644 index 0000000000..602244e8a2 --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_auth_method_attributes.py @@ -0,0 +1,42 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.webhooks_auth_method_protocol import WebhooksAuthMethodProtocol + + +class WebhooksAuthMethodAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.webhooks_auth_method_protocol import WebhooksAuthMethodProtocol + + return { + "protocol": (WebhooksAuthMethodProtocol,), + } + + attribute_map = { + "protocol": "protocol", + } + + def __init__(self_, protocol: Union[WebhooksAuthMethodProtocol, UnsetType] = unset, **kwargs): + """ + Attributes of a webhooks auth method. + + :param protocol: Authentication protocol used by the auth method. + :type protocol: WebhooksAuthMethodProtocol, optional + """ + if protocol is not unset: + kwargs["protocol"] = protocol + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/webhooks_auth_method_protocol.py b/src/datadog_api_client/v2/model/webhooks_auth_method_protocol.py new file mode 100644 index 0000000000..3dcd21695c --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_auth_method_protocol.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class WebhooksAuthMethodProtocol(ModelSimple): + """ + Authentication protocol used by the auth method. + + :param value: If omitted defaults to "oauth2-client-credentials". Must be one of ["oauth2-client-credentials"]. + :type value: str + """ + + allowed_values = { + "oauth2-client-credentials", + } + OAUTH2_CLIENT_CREDENTIALS: ClassVar["WebhooksAuthMethodProtocol"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +WebhooksAuthMethodProtocol.OAUTH2_CLIENT_CREDENTIALS = WebhooksAuthMethodProtocol("oauth2-client-credentials") diff --git a/src/datadog_api_client/v2/model/webhooks_auth_method_relationships.py b/src/datadog_api_client/v2/model/webhooks_auth_method_relationships.py new file mode 100644 index 0000000000..4192c0da92 --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_auth_method_relationships.py @@ -0,0 +1,50 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_relationship import ( + WebhooksOAuth2ClientCredentialsRelationship, + ) + + +class WebhooksAuthMethodRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_relationship import ( + WebhooksOAuth2ClientCredentialsRelationship, + ) + + return { + "oauth2_client_credentials": (WebhooksOAuth2ClientCredentialsRelationship,), + } + + attribute_map = { + "oauth2_client_credentials": "oauth2-client-credentials", + } + + def __init__( + self_, + oauth2_client_credentials: Union[WebhooksOAuth2ClientCredentialsRelationship, UnsetType] = unset, + **kwargs, + ): + """ + Relationships of a webhooks auth method to its protocol-specific resource. + + :param oauth2_client_credentials: Relationship pointing to the OAuth2 client credentials resource for this auth method. + :type oauth2_client_credentials: WebhooksOAuth2ClientCredentialsRelationship, optional + """ + if oauth2_client_credentials is not unset: + kwargs["oauth2_client_credentials"] = oauth2_client_credentials + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/webhooks_auth_method_response_data.py b/src/datadog_api_client/v2/model/webhooks_auth_method_response_data.py new file mode 100644 index 0000000000..87e1d9ccf4 --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_auth_method_response_data.py @@ -0,0 +1,72 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.webhooks_auth_method_attributes import WebhooksAuthMethodAttributes + from datadog_api_client.v2.model.webhooks_auth_method_relationships import WebhooksAuthMethodRelationships + from datadog_api_client.v2.model.webhooks_auth_method_type import WebhooksAuthMethodType + + +class WebhooksAuthMethodResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.webhooks_auth_method_attributes import WebhooksAuthMethodAttributes + from datadog_api_client.v2.model.webhooks_auth_method_relationships import WebhooksAuthMethodRelationships + from datadog_api_client.v2.model.webhooks_auth_method_type import WebhooksAuthMethodType + + return { + "attributes": (WebhooksAuthMethodAttributes,), + "id": (str,), + "relationships": (WebhooksAuthMethodRelationships,), + "type": (WebhooksAuthMethodType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: WebhooksAuthMethodAttributes, + id: str, + type: WebhooksAuthMethodType, + relationships: Union[WebhooksAuthMethodRelationships, UnsetType] = unset, + **kwargs, + ): + """ + Webhooks auth method data from a response. + + :param attributes: Attributes of a webhooks auth method. + :type attributes: WebhooksAuthMethodAttributes + + :param id: The ID of the auth method. + :type id: str + + :param relationships: Relationships of a webhooks auth method to its protocol-specific resource. + :type relationships: WebhooksAuthMethodRelationships, optional + + :param type: Webhooks auth method resource type. + :type type: WebhooksAuthMethodType + """ + if relationships is not unset: + kwargs["relationships"] = relationships + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/webhooks_auth_method_type.py b/src/datadog_api_client/v2/model/webhooks_auth_method_type.py new file mode 100644 index 0000000000..daae3d3643 --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_auth_method_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class WebhooksAuthMethodType(ModelSimple): + """ + Webhooks auth method resource type. + + :param value: If omitted defaults to "webhooks-auth-method". Must be one of ["webhooks-auth-method"]. + :type value: str + """ + + allowed_values = { + "webhooks-auth-method", + } + WEBHOOKS_AUTH_METHOD: ClassVar["WebhooksAuthMethodType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +WebhooksAuthMethodType.WEBHOOKS_AUTH_METHOD = WebhooksAuthMethodType("webhooks-auth-method") diff --git a/src/datadog_api_client/v2/model/webhooks_auth_methods_response.py b/src/datadog_api_client/v2/model/webhooks_auth_methods_response.py new file mode 100644 index 0000000000..39fa6ff51e --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_auth_methods_response.py @@ -0,0 +1,60 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.webhooks_auth_method_response_data import WebhooksAuthMethodResponseData + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_response_data import ( + WebhooksOAuth2ClientCredentialsResponseData, + ) + + +class WebhooksAuthMethodsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.webhooks_auth_method_response_data import WebhooksAuthMethodResponseData + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_response_data import ( + WebhooksOAuth2ClientCredentialsResponseData, + ) + + return { + "data": ([WebhooksAuthMethodResponseData],), + "included": ([WebhooksOAuth2ClientCredentialsResponseData],), + } + + attribute_map = { + "data": "data", + "included": "included", + } + + def __init__( + self_, + data: List[WebhooksAuthMethodResponseData], + included: Union[List[WebhooksOAuth2ClientCredentialsResponseData], UnsetType] = unset, + **kwargs, + ): + """ + Response containing a list of webhooks auth methods. + + :param data: An array of webhooks auth methods. + :type data: [WebhooksAuthMethodResponseData] + + :param included: Resources related to the auth methods, included when requested via the ``include`` query parameter. + :type included: [WebhooksOAuth2ClientCredentialsResponseData], optional + """ + if included is not unset: + kwargs["included"] = included + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_create_attributes.py b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_create_attributes.py new file mode 100644 index 0000000000..a3e30258c8 --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_create_attributes.py @@ -0,0 +1,106 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +class WebhooksOAuth2ClientCredentialsCreateAttributes(ModelNormal): + validations = { + "access_token_url": { + "max_length": 2048, + "min_length": 1, + }, + "audience": { + "max_length": 2048, + "min_length": 1, + }, + "client_id": { + "max_length": 2048, + "min_length": 1, + }, + "client_secret": { + "max_length": 2048, + "min_length": 1, + }, + "name": { + "max_length": 100, + "min_length": 1, + }, + "scope": { + "max_length": 2048, + "min_length": 1, + }, + } + + @cached_property + def openapi_types(_): + return { + "access_token_url": (str,), + "audience": (str, none_type), + "client_id": (str,), + "client_secret": (str,), + "name": (str,), + "scope": (str, none_type), + } + + attribute_map = { + "access_token_url": "access_token_url", + "audience": "audience", + "client_id": "client_id", + "client_secret": "client_secret", + "name": "name", + "scope": "scope", + } + + def __init__( + self_, + access_token_url: str, + client_id: str, + client_secret: str, + name: str, + audience: Union[str, none_type, UnsetType] = unset, + scope: Union[str, none_type, UnsetType] = unset, + **kwargs, + ): + """ + OAuth2 client credentials attributes for a create request. + + :param access_token_url: URL of the OAuth2 access token endpoint. + :type access_token_url: str + + :param audience: The intended audience for the OAuth2 access token. + :type audience: str, none_type, optional + + :param client_id: The OAuth2 client ID issued by the authorization server. + :type client_id: str + + :param client_secret: The OAuth2 client secret issued by the authorization server. + Write-only; never returned by the API. + :type client_secret: str + + :param name: Human-readable name for this auth method. Must be unique within your organization. + :type name: str + + :param scope: Space-separated list of OAuth2 scopes to request. + :type scope: str, none_type, optional + """ + if audience is not unset: + kwargs["audience"] = audience + if scope is not unset: + kwargs["scope"] = scope + super().__init__(kwargs) + + self_.access_token_url = access_token_url + self_.client_id = client_id + self_.client_secret = client_secret + self_.name = name diff --git a/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_create_data.py b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_create_data.py new file mode 100644 index 0000000000..fef9580bc0 --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_create_data.py @@ -0,0 +1,59 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_create_attributes import ( + WebhooksOAuth2ClientCredentialsCreateAttributes, + ) + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_type import WebhooksOAuth2ClientCredentialsType + + +class WebhooksOAuth2ClientCredentialsCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_create_attributes import ( + WebhooksOAuth2ClientCredentialsCreateAttributes, + ) + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_type import ( + WebhooksOAuth2ClientCredentialsType, + ) + + return { + "attributes": (WebhooksOAuth2ClientCredentialsCreateAttributes,), + "type": (WebhooksOAuth2ClientCredentialsType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + attributes: WebhooksOAuth2ClientCredentialsCreateAttributes, + type: WebhooksOAuth2ClientCredentialsType, + **kwargs, + ): + """ + OAuth2 client credentials data for a create request. + + :param attributes: OAuth2 client credentials attributes for a create request. + :type attributes: WebhooksOAuth2ClientCredentialsCreateAttributes + + :param type: OAuth2 client credentials resource type. + :type type: WebhooksOAuth2ClientCredentialsType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_create_request.py b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_create_request.py new file mode 100644 index 0000000000..cdbc6ca0a6 --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_create_request.py @@ -0,0 +1,44 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_create_data import ( + WebhooksOAuth2ClientCredentialsCreateData, + ) + + +class WebhooksOAuth2ClientCredentialsCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_create_data import ( + WebhooksOAuth2ClientCredentialsCreateData, + ) + + return { + "data": (WebhooksOAuth2ClientCredentialsCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: WebhooksOAuth2ClientCredentialsCreateData, **kwargs): + """ + Create request for an OAuth2 client credentials auth method. + + :param data: OAuth2 client credentials data for a create request. + :type data: WebhooksOAuth2ClientCredentialsCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_relationship.py b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_relationship.py new file mode 100644 index 0000000000..f348562161 --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_relationship.py @@ -0,0 +1,46 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_relationship_data import ( + WebhooksOAuth2ClientCredentialsRelationshipData, + ) + + +class WebhooksOAuth2ClientCredentialsRelationship(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_relationship_data import ( + WebhooksOAuth2ClientCredentialsRelationshipData, + ) + + return { + "data": (WebhooksOAuth2ClientCredentialsRelationshipData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[WebhooksOAuth2ClientCredentialsRelationshipData, UnsetType] = unset, **kwargs): + """ + Relationship pointing to the OAuth2 client credentials resource for this auth method. + + :param data: Relationship data referencing an OAuth2 client credentials resource. + :type data: WebhooksOAuth2ClientCredentialsRelationshipData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_relationship_data.py b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_relationship_data.py new file mode 100644 index 0000000000..78c7a9efc4 --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_relationship_data.py @@ -0,0 +1,56 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_type import WebhooksOAuth2ClientCredentialsType + + +class WebhooksOAuth2ClientCredentialsRelationshipData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_type import ( + WebhooksOAuth2ClientCredentialsType, + ) + + return { + "id": (str,), + "type": (WebhooksOAuth2ClientCredentialsType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__( + self_, + id: Union[str, UnsetType] = unset, + type: Union[WebhooksOAuth2ClientCredentialsType, UnsetType] = unset, + **kwargs, + ): + """ + Relationship data referencing an OAuth2 client credentials resource. + + :param id: The ID of the OAuth2 client credentials resource. + :type id: str, optional + + :param type: OAuth2 client credentials resource type. + :type type: WebhooksOAuth2ClientCredentialsType, optional + """ + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_response.py b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_response.py new file mode 100644 index 0000000000..877af1e9f2 --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_response.py @@ -0,0 +1,44 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_response_data import ( + WebhooksOAuth2ClientCredentialsResponseData, + ) + + +class WebhooksOAuth2ClientCredentialsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_response_data import ( + WebhooksOAuth2ClientCredentialsResponseData, + ) + + return { + "data": (WebhooksOAuth2ClientCredentialsResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: WebhooksOAuth2ClientCredentialsResponseData, **kwargs): + """ + Response containing an OAuth2 client credentials auth method. + + :param data: OAuth2 client credentials data from a response. + :type data: WebhooksOAuth2ClientCredentialsResponseData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_response_attributes.py b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_response_attributes.py new file mode 100644 index 0000000000..98669f2e1d --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_response_attributes.py @@ -0,0 +1,87 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.webhooks_auth_method_protocol import WebhooksAuthMethodProtocol + + +class WebhooksOAuth2ClientCredentialsResponseAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.webhooks_auth_method_protocol import WebhooksAuthMethodProtocol + + return { + "access_token_url": (str,), + "audience": (str, none_type), + "client_id": (str,), + "name": (str,), + "protocol": (WebhooksAuthMethodProtocol,), + "scope": (str, none_type), + } + + attribute_map = { + "access_token_url": "access_token_url", + "audience": "audience", + "client_id": "client_id", + "name": "name", + "protocol": "protocol", + "scope": "scope", + } + + def __init__( + self_, + access_token_url: Union[str, UnsetType] = unset, + audience: Union[str, none_type, UnsetType] = unset, + client_id: Union[str, UnsetType] = unset, + name: Union[str, UnsetType] = unset, + protocol: Union[WebhooksAuthMethodProtocol, UnsetType] = unset, + scope: Union[str, none_type, UnsetType] = unset, + **kwargs, + ): + """ + OAuth2 client credentials attributes returned by the API. The ``client_secret`` is never echoed. + + :param access_token_url: URL of the OAuth2 access token endpoint. + :type access_token_url: str, optional + + :param audience: The intended audience for the OAuth2 access token. + :type audience: str, none_type, optional + + :param client_id: The OAuth2 client ID issued by the authorization server. + :type client_id: str, optional + + :param name: Human-readable name for this auth method. + :type name: str, optional + + :param protocol: Authentication protocol used by the auth method. + :type protocol: WebhooksAuthMethodProtocol, optional + + :param scope: Space-separated list of OAuth2 scopes to request. + :type scope: str, none_type, optional + """ + if access_token_url is not unset: + kwargs["access_token_url"] = access_token_url + if audience is not unset: + kwargs["audience"] = audience + if client_id is not unset: + kwargs["client_id"] = client_id + if name is not unset: + kwargs["name"] = name + if protocol is not unset: + kwargs["protocol"] = protocol + if scope is not unset: + kwargs["scope"] = scope + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_response_data.py b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_response_data.py new file mode 100644 index 0000000000..9dca0a3781 --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_response_data.py @@ -0,0 +1,66 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_response_attributes import ( + WebhooksOAuth2ClientCredentialsResponseAttributes, + ) + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_type import WebhooksOAuth2ClientCredentialsType + + +class WebhooksOAuth2ClientCredentialsResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_response_attributes import ( + WebhooksOAuth2ClientCredentialsResponseAttributes, + ) + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_type import ( + WebhooksOAuth2ClientCredentialsType, + ) + + return { + "attributes": (WebhooksOAuth2ClientCredentialsResponseAttributes,), + "id": (str,), + "type": (WebhooksOAuth2ClientCredentialsType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: WebhooksOAuth2ClientCredentialsResponseAttributes, + id: str, + type: WebhooksOAuth2ClientCredentialsType, + **kwargs, + ): + """ + OAuth2 client credentials data from a response. + + :param attributes: OAuth2 client credentials attributes returned by the API. The ``client_secret`` is never echoed. + :type attributes: WebhooksOAuth2ClientCredentialsResponseAttributes + + :param id: The ID of the OAuth2 client credentials auth method. + :type id: str + + :param type: OAuth2 client credentials resource type. + :type type: WebhooksOAuth2ClientCredentialsType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_type.py b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_type.py new file mode 100644 index 0000000000..2af923bd3a --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_type.py @@ -0,0 +1,37 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class WebhooksOAuth2ClientCredentialsType(ModelSimple): + """ + OAuth2 client credentials resource type. + + :param value: If omitted defaults to "webhooks-auth-method-oauth2-client-credentials". Must be one of ["webhooks-auth-method-oauth2-client-credentials"]. + :type value: str + """ + + allowed_values = { + "webhooks-auth-method-oauth2-client-credentials", + } + WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS: ClassVar["WebhooksOAuth2ClientCredentialsType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +WebhooksOAuth2ClientCredentialsType.WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS = ( + WebhooksOAuth2ClientCredentialsType("webhooks-auth-method-oauth2-client-credentials") +) diff --git a/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_update_attributes.py b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_update_attributes.py new file mode 100644 index 0000000000..57807d6131 --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_update_attributes.py @@ -0,0 +1,109 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +class WebhooksOAuth2ClientCredentialsUpdateAttributes(ModelNormal): + validations = { + "access_token_url": { + "max_length": 2048, + "min_length": 1, + }, + "audience": { + "max_length": 2048, + "min_length": 1, + }, + "client_id": { + "max_length": 2048, + "min_length": 1, + }, + "client_secret": { + "max_length": 2048, + "min_length": 1, + }, + "name": { + "max_length": 100, + "min_length": 1, + }, + "scope": { + "max_length": 2048, + "min_length": 1, + }, + } + + @cached_property + def openapi_types(_): + return { + "access_token_url": (str,), + "audience": (str, none_type), + "client_id": (str,), + "client_secret": (str,), + "name": (str,), + "scope": (str, none_type), + } + + attribute_map = { + "access_token_url": "access_token_url", + "audience": "audience", + "client_id": "client_id", + "client_secret": "client_secret", + "name": "name", + "scope": "scope", + } + + def __init__( + self_, + access_token_url: Union[str, UnsetType] = unset, + audience: Union[str, none_type, UnsetType] = unset, + client_id: Union[str, UnsetType] = unset, + client_secret: Union[str, UnsetType] = unset, + name: Union[str, UnsetType] = unset, + scope: Union[str, none_type, UnsetType] = unset, + **kwargs, + ): + """ + OAuth2 client credentials attributes for an update request. + + :param access_token_url: URL of the OAuth2 access token endpoint. + :type access_token_url: str, optional + + :param audience: The intended audience for the OAuth2 access token. + :type audience: str, none_type, optional + + :param client_id: The OAuth2 client ID issued by the authorization server. + :type client_id: str, optional + + :param client_secret: The OAuth2 client secret issued by the authorization server. + Write-only; never returned by the API. + :type client_secret: str, optional + + :param name: Human-readable name for this auth method. + :type name: str, optional + + :param scope: Space-separated list of OAuth2 scopes to request. + :type scope: str, none_type, optional + """ + if access_token_url is not unset: + kwargs["access_token_url"] = access_token_url + if audience is not unset: + kwargs["audience"] = audience + if client_id is not unset: + kwargs["client_id"] = client_id + if client_secret is not unset: + kwargs["client_secret"] = client_secret + if name is not unset: + kwargs["name"] = name + if scope is not unset: + kwargs["scope"] = scope + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_update_data.py b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_update_data.py new file mode 100644 index 0000000000..c53ec84b52 --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_update_data.py @@ -0,0 +1,59 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_update_attributes import ( + WebhooksOAuth2ClientCredentialsUpdateAttributes, + ) + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_type import WebhooksOAuth2ClientCredentialsType + + +class WebhooksOAuth2ClientCredentialsUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_update_attributes import ( + WebhooksOAuth2ClientCredentialsUpdateAttributes, + ) + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_type import ( + WebhooksOAuth2ClientCredentialsType, + ) + + return { + "attributes": (WebhooksOAuth2ClientCredentialsUpdateAttributes,), + "type": (WebhooksOAuth2ClientCredentialsType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + attributes: WebhooksOAuth2ClientCredentialsUpdateAttributes, + type: WebhooksOAuth2ClientCredentialsType, + **kwargs, + ): + """ + OAuth2 client credentials data for an update request. + + :param attributes: OAuth2 client credentials attributes for an update request. + :type attributes: WebhooksOAuth2ClientCredentialsUpdateAttributes + + :param type: OAuth2 client credentials resource type. + :type type: WebhooksOAuth2ClientCredentialsType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_update_request.py b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_update_request.py new file mode 100644 index 0000000000..c23e3027b1 --- /dev/null +++ b/src/datadog_api_client/v2/model/webhooks_o_auth2_client_credentials_update_request.py @@ -0,0 +1,44 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_update_data import ( + WebhooksOAuth2ClientCredentialsUpdateData, + ) + + +class WebhooksOAuth2ClientCredentialsUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_update_data import ( + WebhooksOAuth2ClientCredentialsUpdateData, + ) + + return { + "data": (WebhooksOAuth2ClientCredentialsUpdateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: WebhooksOAuth2ClientCredentialsUpdateData, **kwargs): + """ + Update request for an OAuth2 client credentials auth method. + + :param data: OAuth2 client credentials data for an update request. + :type data: WebhooksOAuth2ClientCredentialsUpdateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index cea5bec21d..5538d703aa 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -8432,6 +8432,46 @@ WebIntegrationAccountUpdateRequestData, ) from datadog_api_client.v2.model.web_integration_accounts_response import WebIntegrationAccountsResponse +from datadog_api_client.v2.model.webhooks_auth_method_attributes import WebhooksAuthMethodAttributes +from datadog_api_client.v2.model.webhooks_auth_method_protocol import WebhooksAuthMethodProtocol +from datadog_api_client.v2.model.webhooks_auth_method_relationships import WebhooksAuthMethodRelationships +from datadog_api_client.v2.model.webhooks_auth_method_response_data import WebhooksAuthMethodResponseData +from datadog_api_client.v2.model.webhooks_auth_method_type import WebhooksAuthMethodType +from datadog_api_client.v2.model.webhooks_auth_methods_response import WebhooksAuthMethodsResponse +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_create_attributes import ( + WebhooksOAuth2ClientCredentialsCreateAttributes, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_create_data import ( + WebhooksOAuth2ClientCredentialsCreateData, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_create_request import ( + WebhooksOAuth2ClientCredentialsCreateRequest, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_relationship import ( + WebhooksOAuth2ClientCredentialsRelationship, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_relationship_data import ( + WebhooksOAuth2ClientCredentialsRelationshipData, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_response import ( + WebhooksOAuth2ClientCredentialsResponse, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_response_attributes import ( + WebhooksOAuth2ClientCredentialsResponseAttributes, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_response_data import ( + WebhooksOAuth2ClientCredentialsResponseData, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_type import WebhooksOAuth2ClientCredentialsType +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_update_attributes import ( + WebhooksOAuth2ClientCredentialsUpdateAttributes, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_update_data import ( + WebhooksOAuth2ClientCredentialsUpdateData, +) +from datadog_api_client.v2.model.webhooks_o_auth2_client_credentials_update_request import ( + WebhooksOAuth2ClientCredentialsUpdateRequest, +) from datadog_api_client.v2.model.weekday import Weekday from datadog_api_client.v2.model.widget_annotations_map import WidgetAnnotationsMap from datadog_api_client.v2.model.widget_attributes import WidgetAttributes @@ -14422,6 +14462,24 @@ "WebIntegrationAccountUpdateRequestAttributes", "WebIntegrationAccountUpdateRequestData", "WebIntegrationAccountsResponse", + "WebhooksAuthMethodAttributes", + "WebhooksAuthMethodProtocol", + "WebhooksAuthMethodRelationships", + "WebhooksAuthMethodResponseData", + "WebhooksAuthMethodType", + "WebhooksAuthMethodsResponse", + "WebhooksOAuth2ClientCredentialsCreateAttributes", + "WebhooksOAuth2ClientCredentialsCreateData", + "WebhooksOAuth2ClientCredentialsCreateRequest", + "WebhooksOAuth2ClientCredentialsRelationship", + "WebhooksOAuth2ClientCredentialsRelationshipData", + "WebhooksOAuth2ClientCredentialsResponse", + "WebhooksOAuth2ClientCredentialsResponseAttributes", + "WebhooksOAuth2ClientCredentialsResponseData", + "WebhooksOAuth2ClientCredentialsType", + "WebhooksOAuth2ClientCredentialsUpdateAttributes", + "WebhooksOAuth2ClientCredentialsUpdateData", + "WebhooksOAuth2ClientCredentialsUpdateRequest", "Weekday", "WidgetAnnotationsMap", "WidgetAttributes", diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 7139a86ede..f753390110 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/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/tests/v2/features/undo.json b/tests/v2/features/undo.json index b6003df868..286a2c3af8 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/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/tests/v2/features/webhooks_integration.feature b/tests/v2/features/webhooks_integration.feature new file mode 100644 index 0000000000..c97a2d4037 --- /dev/null +++ b/tests/v2/features/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