From d14a26af6ded6ca11626397b93bb912193a03f6f Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 28 May 2026 21:36:13 +0000 Subject: [PATCH] Regenerate client from commit beecbd3 of spec repo --- .generator/schemas/v2/openapi.yaml | 509 +++++++++++ .../CreateOAuth2ClientCredentials.java | 46 + .../DeleteOAuth2ClientCredentials.java | 23 + .../GetAllAuthMethods.java | 24 + .../GetOAuth2ClientCredentials.java | 26 + .../UpdateOAuth2ClientCredentials.java | 46 + .../client/v2/api/WebhooksIntegrationApi.java | 817 ++++++++++++++++++ .../model/WebhooksAuthMethodAttributes.java | 140 +++ .../v2/model/WebhooksAuthMethodProtocol.java | 57 ++ .../WebhooksAuthMethodRelationships.java | 143 +++ .../model/WebhooksAuthMethodResponseData.java | 240 +++++ .../v2/model/WebhooksAuthMethodType.java | 57 ++ .../v2/model/WebhooksAuthMethodsResponse.java | 200 +++++ ...uth2ClientCredentialsCreateAttributes.java | 313 +++++++ ...ooksOAuth2ClientCredentialsCreateData.java | 187 ++++ ...sOAuth2ClientCredentialsCreateRequest.java | 151 ++++ ...ksOAuth2ClientCredentialsRelationship.java | 141 +++ ...uth2ClientCredentialsRelationshipData.java | 175 ++++ ...bhooksOAuth2ClientCredentialsResponse.java | 150 ++++ ...h2ClientCredentialsResponseAttributes.java | 308 +++++++ ...ksOAuth2ClientCredentialsResponseData.java | 218 +++++ .../WebhooksOAuth2ClientCredentialsType.java | 60 ++ ...uth2ClientCredentialsUpdateAttributes.java | 302 +++++++ ...ooksOAuth2ClientCredentialsUpdateData.java | 187 ++++ ...sOAuth2ClientCredentialsUpdateRequest.java | 151 ++++ .../com/datadog/api/client/v2/api/given.json | 12 + .../com/datadog/api/client/v2/api/undo.json | 37 + .../v2/api/webhooks_integration.feature | 97 +++ 28 files changed, 4817 insertions(+) create mode 100644 examples/v2/webhooks-integration/CreateOAuth2ClientCredentials.java create mode 100644 examples/v2/webhooks-integration/DeleteOAuth2ClientCredentials.java create mode 100644 examples/v2/webhooks-integration/GetAllAuthMethods.java create mode 100644 examples/v2/webhooks-integration/GetOAuth2ClientCredentials.java create mode 100644 examples/v2/webhooks-integration/UpdateOAuth2ClientCredentials.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/WebhooksIntegrationApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodProtocol.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodRelationships.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodsResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsCreateAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsCreateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsCreateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsRelationship.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsRelationshipData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsResponseAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsUpdateAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsUpdateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsUpdateRequest.java create mode 100644 src/test/resources/com/datadog/api/client/v2/api/webhooks_integration.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4d59bfade19..91d04c22671 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.java b/examples/v2/webhooks-integration/CreateOAuth2ClientCredentials.java new file mode 100644 index 00000000000..5ad33408cbd --- /dev/null +++ b/examples/v2/webhooks-integration/CreateOAuth2ClientCredentials.java @@ -0,0 +1,46 @@ +// Create an OAuth2 client credentials auth method returns "CREATED" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.WebhooksIntegrationApi; +import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsCreateAttributes; +import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsCreateData; +import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsCreateRequest; +import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsResponse; +import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + WebhooksIntegrationApi apiInstance = new WebhooksIntegrationApi(defaultClient); + + WebhooksOAuth2ClientCredentialsCreateRequest body = + new WebhooksOAuth2ClientCredentialsCreateRequest() + .data( + new WebhooksOAuth2ClientCredentialsCreateData() + .attributes( + new WebhooksOAuth2ClientCredentialsCreateAttributes() + .accessTokenUrl("https://example.com/oauth/token") + .audience("https://api.example.com") + .clientId("my-client-id") + .clientSecret("my-client-secret") + .name("my-oauth2-auth") + .scope("read:webhooks write:webhooks")) + .type( + WebhooksOAuth2ClientCredentialsType + .WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS)); + + try { + WebhooksOAuth2ClientCredentialsResponse result = + apiInstance.createOAuth2ClientCredentials(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling WebhooksIntegrationApi#createOAuth2ClientCredentials"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/webhooks-integration/DeleteOAuth2ClientCredentials.java b/examples/v2/webhooks-integration/DeleteOAuth2ClientCredentials.java new file mode 100644 index 00000000000..96f804cfa60 --- /dev/null +++ b/examples/v2/webhooks-integration/DeleteOAuth2ClientCredentials.java @@ -0,0 +1,23 @@ +// Delete an OAuth2 client credentials auth method returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.WebhooksIntegrationApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + WebhooksIntegrationApi apiInstance = new WebhooksIntegrationApi(defaultClient); + + try { + apiInstance.deleteOAuth2ClientCredentials("auth_method_id"); + } catch (ApiException e) { + System.err.println( + "Exception when calling WebhooksIntegrationApi#deleteOAuth2ClientCredentials"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/webhooks-integration/GetAllAuthMethods.java b/examples/v2/webhooks-integration/GetAllAuthMethods.java new file mode 100644 index 00000000000..0857020abc4 --- /dev/null +++ b/examples/v2/webhooks-integration/GetAllAuthMethods.java @@ -0,0 +1,24 @@ +// Get all auth methods returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.WebhooksIntegrationApi; +import com.datadog.api.client.v2.model.WebhooksAuthMethodsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + WebhooksIntegrationApi apiInstance = new WebhooksIntegrationApi(defaultClient); + + try { + WebhooksAuthMethodsResponse result = apiInstance.getAllAuthMethods(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WebhooksIntegrationApi#getAllAuthMethods"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/webhooks-integration/GetOAuth2ClientCredentials.java b/examples/v2/webhooks-integration/GetOAuth2ClientCredentials.java new file mode 100644 index 00000000000..4808c99b109 --- /dev/null +++ b/examples/v2/webhooks-integration/GetOAuth2ClientCredentials.java @@ -0,0 +1,26 @@ +// Get an OAuth2 client credentials auth method returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.WebhooksIntegrationApi; +import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + WebhooksIntegrationApi apiInstance = new WebhooksIntegrationApi(defaultClient); + + try { + WebhooksOAuth2ClientCredentialsResponse result = + apiInstance.getOAuth2ClientCredentials("auth_method_id"); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling WebhooksIntegrationApi#getOAuth2ClientCredentials"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/webhooks-integration/UpdateOAuth2ClientCredentials.java b/examples/v2/webhooks-integration/UpdateOAuth2ClientCredentials.java new file mode 100644 index 00000000000..023513942fc --- /dev/null +++ b/examples/v2/webhooks-integration/UpdateOAuth2ClientCredentials.java @@ -0,0 +1,46 @@ +// Update an OAuth2 client credentials auth method returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.WebhooksIntegrationApi; +import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsResponse; +import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsType; +import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsUpdateAttributes; +import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsUpdateData; +import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsUpdateRequest; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + WebhooksIntegrationApi apiInstance = new WebhooksIntegrationApi(defaultClient); + + WebhooksOAuth2ClientCredentialsUpdateRequest body = + new WebhooksOAuth2ClientCredentialsUpdateRequest() + .data( + new WebhooksOAuth2ClientCredentialsUpdateData() + .attributes( + new WebhooksOAuth2ClientCredentialsUpdateAttributes() + .accessTokenUrl("https://example.com/oauth/token") + .audience("https://api.example.com") + .clientId("my-client-id") + .clientSecret("my-client-secret") + .name("my-oauth2-auth") + .scope("read:webhooks write:webhooks")) + .type( + WebhooksOAuth2ClientCredentialsType + .WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS)); + + try { + WebhooksOAuth2ClientCredentialsResponse result = + apiInstance.updateOAuth2ClientCredentials("auth_method_id", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling WebhooksIntegrationApi#updateOAuth2ClientCredentials"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/WebhooksIntegrationApi.java b/src/main/java/com/datadog/api/client/v2/api/WebhooksIntegrationApi.java new file mode 100644 index 00000000000..1fd29b87c19 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/WebhooksIntegrationApi.java @@ -0,0 +1,817 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.WebhooksAuthMethodProtocol; +import com.datadog.api.client.v2.model.WebhooksAuthMethodsResponse; +import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsCreateRequest; +import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsResponse; +import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsUpdateRequest; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksIntegrationApi { + private ApiClient apiClient; + + public WebhooksIntegrationApi() { + this(ApiClient.getDefaultApiClient()); + } + + public WebhooksIntegrationApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create an OAuth2 client credentials auth method. + * + *

See {@link #createOAuth2ClientCredentialsWithHttpInfo}. + * + * @param body OAuth2 client credentials payload. (required) + * @return WebhooksOAuth2ClientCredentialsResponse + * @throws ApiException if fails to make API call + */ + public WebhooksOAuth2ClientCredentialsResponse createOAuth2ClientCredentials( + WebhooksOAuth2ClientCredentialsCreateRequest body) throws ApiException { + return createOAuth2ClientCredentialsWithHttpInfo(body).getData(); + } + + /** + * Create an OAuth2 client credentials auth method. + * + *

See {@link #createOAuth2ClientCredentialsWithHttpInfoAsync}. + * + * @param body OAuth2 client credentials payload. (required) + * @return CompletableFuture<WebhooksOAuth2ClientCredentialsResponse> + */ + public CompletableFuture + createOAuth2ClientCredentialsAsync(WebhooksOAuth2ClientCredentialsCreateRequest body) { + return createOAuth2ClientCredentialsWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * 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. (required) + * @return ApiResponse<WebhooksOAuth2ClientCredentialsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 CREATED -
400 Bad Request -
403 Forbidden -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse + createOAuth2ClientCredentialsWithHttpInfo(WebhooksOAuth2ClientCredentialsCreateRequest body) + throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createOAuth2ClientCredentials"); + } + // create path and map variables + String localVarPath = + "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.WebhooksIntegrationApi.createOAuth2ClientCredentials", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create an OAuth2 client credentials auth method. + * + *

See {@link #createOAuth2ClientCredentialsWithHttpInfo}. + * + * @param body OAuth2 client credentials payload. (required) + * @return CompletableFuture<ApiResponse<WebhooksOAuth2ClientCredentialsResponse>> + */ + public CompletableFuture> + createOAuth2ClientCredentialsWithHttpInfoAsync( + WebhooksOAuth2ClientCredentialsCreateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling createOAuth2ClientCredentials")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.WebhooksIntegrationApi.createOAuth2ClientCredentials", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Delete an OAuth2 client credentials auth method. + * + *

See {@link #deleteOAuth2ClientCredentialsWithHttpInfo}. + * + * @param authMethodId The UUID of the auth method. (required) + * @throws ApiException if fails to make API call + */ + public void deleteOAuth2ClientCredentials(String authMethodId) throws ApiException { + deleteOAuth2ClientCredentialsWithHttpInfo(authMethodId); + } + + /** + * Delete an OAuth2 client credentials auth method. + * + *

See {@link #deleteOAuth2ClientCredentialsWithHttpInfoAsync}. + * + * @param authMethodId The UUID of the auth method. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteOAuth2ClientCredentialsAsync(String authMethodId) { + return deleteOAuth2ClientCredentialsWithHttpInfoAsync(authMethodId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an OAuth2 client credentials auth method by ID. + * + * @param authMethodId The UUID of the auth method. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 OK -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteOAuth2ClientCredentialsWithHttpInfo(String authMethodId) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'authMethodId' is set + if (authMethodId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'authMethodId' when calling" + + " deleteOAuth2ClientCredentials"); + } + // create path and map variables + String localVarPath = + "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id}" + .replaceAll( + "\\{" + "auth_method_id" + "\\}", apiClient.escapeString(authMethodId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.WebhooksIntegrationApi.deleteOAuth2ClientCredentials", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete an OAuth2 client credentials auth method. + * + *

See {@link #deleteOAuth2ClientCredentialsWithHttpInfo}. + * + * @param authMethodId The UUID of the auth method. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteOAuth2ClientCredentialsWithHttpInfoAsync( + String authMethodId) { + Object localVarPostBody = null; + + // verify the required parameter 'authMethodId' is set + if (authMethodId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'authMethodId' when calling" + + " deleteOAuth2ClientCredentials")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id}" + .replaceAll( + "\\{" + "auth_method_id" + "\\}", apiClient.escapeString(authMethodId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.WebhooksIntegrationApi.deleteOAuth2ClientCredentials", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** Manage optional parameters to getAllAuthMethods. */ + public static class GetAllAuthMethodsOptionalParameters { + private WebhooksAuthMethodProtocol include; + + /** + * Set include. + * + * @param include Comma-separated list of relationships to include in the response. (optional) + * @return GetAllAuthMethodsOptionalParameters + */ + public GetAllAuthMethodsOptionalParameters include(WebhooksAuthMethodProtocol include) { + this.include = include; + return this; + } + } + + /** + * Get all auth methods. + * + *

See {@link #getAllAuthMethodsWithHttpInfo}. + * + * @return WebhooksAuthMethodsResponse + * @throws ApiException if fails to make API call + */ + public WebhooksAuthMethodsResponse getAllAuthMethods() throws ApiException { + return getAllAuthMethodsWithHttpInfo(new GetAllAuthMethodsOptionalParameters()).getData(); + } + + /** + * Get all auth methods. + * + *

See {@link #getAllAuthMethodsWithHttpInfoAsync}. + * + * @return CompletableFuture<WebhooksAuthMethodsResponse> + */ + public CompletableFuture getAllAuthMethodsAsync() { + return getAllAuthMethodsWithHttpInfoAsync(new GetAllAuthMethodsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all auth methods. + * + *

See {@link #getAllAuthMethodsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return WebhooksAuthMethodsResponse + * @throws ApiException if fails to make API call + */ + public WebhooksAuthMethodsResponse getAllAuthMethods( + GetAllAuthMethodsOptionalParameters parameters) throws ApiException { + return getAllAuthMethodsWithHttpInfo(parameters).getData(); + } + + /** + * Get all auth methods. + * + *

See {@link #getAllAuthMethodsWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<WebhooksAuthMethodsResponse> + */ + public CompletableFuture getAllAuthMethodsAsync( + GetAllAuthMethodsOptionalParameters parameters) { + return getAllAuthMethodsWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a list of all auth methods configured for the Webhooks integration in your organization. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<WebhooksAuthMethodsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse getAllAuthMethodsWithHttpInfo( + GetAllAuthMethodsOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + WebhooksAuthMethodProtocol include = parameters.include; + // create path and map variables + String localVarPath = "/api/v2/integration/webhooks/configuration/auth-method"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.WebhooksIntegrationApi.getAllAuthMethods", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get all auth methods. + * + *

See {@link #getAllAuthMethodsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<WebhooksAuthMethodsResponse>> + */ + public CompletableFuture> + getAllAuthMethodsWithHttpInfoAsync(GetAllAuthMethodsOptionalParameters parameters) { + Object localVarPostBody = null; + WebhooksAuthMethodProtocol include = parameters.include; + // create path and map variables + String localVarPath = "/api/v2/integration/webhooks/configuration/auth-method"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.WebhooksIntegrationApi.getAllAuthMethods", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get an OAuth2 client credentials auth method. + * + *

See {@link #getOAuth2ClientCredentialsWithHttpInfo}. + * + * @param authMethodId The UUID of the auth method. (required) + * @return WebhooksOAuth2ClientCredentialsResponse + * @throws ApiException if fails to make API call + */ + public WebhooksOAuth2ClientCredentialsResponse getOAuth2ClientCredentials(String authMethodId) + throws ApiException { + return getOAuth2ClientCredentialsWithHttpInfo(authMethodId).getData(); + } + + /** + * Get an OAuth2 client credentials auth method. + * + *

See {@link #getOAuth2ClientCredentialsWithHttpInfoAsync}. + * + * @param authMethodId The UUID of the auth method. (required) + * @return CompletableFuture<WebhooksOAuth2ClientCredentialsResponse> + */ + public CompletableFuture getOAuth2ClientCredentialsAsync( + String authMethodId) { + return getOAuth2ClientCredentialsWithHttpInfoAsync(authMethodId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a single OAuth2 client credentials auth method by ID. + * + * @param authMethodId The UUID of the auth method. (required) + * @return ApiResponse<WebhooksOAuth2ClientCredentialsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse + getOAuth2ClientCredentialsWithHttpInfo(String authMethodId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'authMethodId' is set + if (authMethodId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'authMethodId' when calling getOAuth2ClientCredentials"); + } + // create path and map variables + String localVarPath = + "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id}" + .replaceAll( + "\\{" + "auth_method_id" + "\\}", apiClient.escapeString(authMethodId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.WebhooksIntegrationApi.getOAuth2ClientCredentials", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get an OAuth2 client credentials auth method. + * + *

See {@link #getOAuth2ClientCredentialsWithHttpInfo}. + * + * @param authMethodId The UUID of the auth method. (required) + * @return CompletableFuture<ApiResponse<WebhooksOAuth2ClientCredentialsResponse>> + */ + public CompletableFuture> + getOAuth2ClientCredentialsWithHttpInfoAsync(String authMethodId) { + Object localVarPostBody = null; + + // verify the required parameter 'authMethodId' is set + if (authMethodId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'authMethodId' when calling" + + " getOAuth2ClientCredentials")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id}" + .replaceAll( + "\\{" + "auth_method_id" + "\\}", apiClient.escapeString(authMethodId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.WebhooksIntegrationApi.getOAuth2ClientCredentials", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update an OAuth2 client credentials auth method. + * + *

See {@link #updateOAuth2ClientCredentialsWithHttpInfo}. + * + * @param authMethodId The UUID of the auth method. (required) + * @param body OAuth2 client credentials payload. (required) + * @return WebhooksOAuth2ClientCredentialsResponse + * @throws ApiException if fails to make API call + */ + public WebhooksOAuth2ClientCredentialsResponse updateOAuth2ClientCredentials( + String authMethodId, WebhooksOAuth2ClientCredentialsUpdateRequest body) throws ApiException { + return updateOAuth2ClientCredentialsWithHttpInfo(authMethodId, body).getData(); + } + + /** + * Update an OAuth2 client credentials auth method. + * + *

See {@link #updateOAuth2ClientCredentialsWithHttpInfoAsync}. + * + * @param authMethodId The UUID of the auth method. (required) + * @param body OAuth2 client credentials payload. (required) + * @return CompletableFuture<WebhooksOAuth2ClientCredentialsResponse> + */ + public CompletableFuture + updateOAuth2ClientCredentialsAsync( + String authMethodId, WebhooksOAuth2ClientCredentialsUpdateRequest body) { + return updateOAuth2ClientCredentialsWithHttpInfoAsync(authMethodId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update an existing OAuth2 client credentials auth method. + * + * @param authMethodId The UUID of the auth method. (required) + * @param body OAuth2 client credentials payload. (required) + * @return ApiResponse<WebhooksOAuth2ClientCredentialsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse + updateOAuth2ClientCredentialsWithHttpInfo( + String authMethodId, WebhooksOAuth2ClientCredentialsUpdateRequest body) + throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'authMethodId' is set + if (authMethodId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'authMethodId' when calling" + + " updateOAuth2ClientCredentials"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateOAuth2ClientCredentials"); + } + // create path and map variables + String localVarPath = + "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id}" + .replaceAll( + "\\{" + "auth_method_id" + "\\}", apiClient.escapeString(authMethodId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.WebhooksIntegrationApi.updateOAuth2ClientCredentials", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update an OAuth2 client credentials auth method. + * + *

See {@link #updateOAuth2ClientCredentialsWithHttpInfo}. + * + * @param authMethodId The UUID of the auth method. (required) + * @param body OAuth2 client credentials payload. (required) + * @return CompletableFuture<ApiResponse<WebhooksOAuth2ClientCredentialsResponse>> + */ + public CompletableFuture> + updateOAuth2ClientCredentialsWithHttpInfoAsync( + String authMethodId, WebhooksOAuth2ClientCredentialsUpdateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'authMethodId' is set + if (authMethodId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'authMethodId' when calling" + + " updateOAuth2ClientCredentials")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling updateOAuth2ClientCredentials")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id}" + .replaceAll( + "\\{" + "auth_method_id" + "\\}", apiClient.escapeString(authMethodId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.WebhooksIntegrationApi.updateOAuth2ClientCredentials", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodAttributes.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodAttributes.java new file mode 100644 index 00000000000..dc700679021 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodAttributes.java @@ -0,0 +1,140 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes of a webhooks auth method. */ +@JsonPropertyOrder({WebhooksAuthMethodAttributes.JSON_PROPERTY_PROTOCOL}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksAuthMethodAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PROTOCOL = "protocol"; + private WebhooksAuthMethodProtocol protocol; + + public WebhooksAuthMethodAttributes protocol(WebhooksAuthMethodProtocol protocol) { + this.protocol = protocol; + this.unparsed |= !protocol.isValid(); + return this; + } + + /** + * Authentication protocol used by the auth method. + * + * @return protocol + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PROTOCOL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhooksAuthMethodProtocol getProtocol() { + return protocol; + } + + public void setProtocol(WebhooksAuthMethodProtocol protocol) { + if (!protocol.isValid()) { + this.unparsed = true; + } + this.protocol = protocol; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksAuthMethodAttributes + */ + @JsonAnySetter + public WebhooksAuthMethodAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksAuthMethodAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksAuthMethodAttributes webhooksAuthMethodAttributes = (WebhooksAuthMethodAttributes) o; + return Objects.equals(this.protocol, webhooksAuthMethodAttributes.protocol) + && Objects.equals( + this.additionalProperties, webhooksAuthMethodAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(protocol, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksAuthMethodAttributes {\n"); + sb.append(" protocol: ").append(toIndentedString(protocol)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodProtocol.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodProtocol.java new file mode 100644 index 00000000000..f2cd91970eb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodProtocol.java @@ -0,0 +1,57 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Authentication protocol used by the auth method. */ +@JsonSerialize(using = WebhooksAuthMethodProtocol.WebhooksAuthMethodProtocolSerializer.class) +public class WebhooksAuthMethodProtocol extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("oauth2-client-credentials")); + + public static final WebhooksAuthMethodProtocol OAUTH2_CLIENT_CREDENTIALS = + new WebhooksAuthMethodProtocol("oauth2-client-credentials"); + + WebhooksAuthMethodProtocol(String value) { + super(value, allowedValues); + } + + public static class WebhooksAuthMethodProtocolSerializer + extends StdSerializer { + public WebhooksAuthMethodProtocolSerializer(Class t) { + super(t); + } + + public WebhooksAuthMethodProtocolSerializer() { + this(null); + } + + @Override + public void serialize( + WebhooksAuthMethodProtocol value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static WebhooksAuthMethodProtocol fromValue(String value) { + return new WebhooksAuthMethodProtocol(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodRelationships.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodRelationships.java new file mode 100644 index 00000000000..f3e81449e7e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodRelationships.java @@ -0,0 +1,143 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Relationships of a webhooks auth method to its protocol-specific resource. */ +@JsonPropertyOrder({WebhooksAuthMethodRelationships.JSON_PROPERTY_OAUTH2_CLIENT_CREDENTIALS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksAuthMethodRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_OAUTH2_CLIENT_CREDENTIALS = "oauth2-client-credentials"; + private WebhooksOAuth2ClientCredentialsRelationship oauth2ClientCredentials; + + public WebhooksAuthMethodRelationships oauth2ClientCredentials( + WebhooksOAuth2ClientCredentialsRelationship oauth2ClientCredentials) { + this.oauth2ClientCredentials = oauth2ClientCredentials; + this.unparsed |= oauth2ClientCredentials.unparsed; + return this; + } + + /** + * Relationship pointing to the OAuth2 client credentials resource for this auth method. + * + * @return oauth2ClientCredentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OAUTH2_CLIENT_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhooksOAuth2ClientCredentialsRelationship getOauth2ClientCredentials() { + return oauth2ClientCredentials; + } + + public void setOauth2ClientCredentials( + WebhooksOAuth2ClientCredentialsRelationship oauth2ClientCredentials) { + this.oauth2ClientCredentials = oauth2ClientCredentials; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksAuthMethodRelationships + */ + @JsonAnySetter + public WebhooksAuthMethodRelationships putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksAuthMethodRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksAuthMethodRelationships webhooksAuthMethodRelationships = + (WebhooksAuthMethodRelationships) o; + return Objects.equals( + this.oauth2ClientCredentials, webhooksAuthMethodRelationships.oauth2ClientCredentials) + && Objects.equals( + this.additionalProperties, webhooksAuthMethodRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(oauth2ClientCredentials, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksAuthMethodRelationships {\n"); + sb.append(" oauth2ClientCredentials: ") + .append(toIndentedString(oauth2ClientCredentials)) + .append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodResponseData.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodResponseData.java new file mode 100644 index 00000000000..772273c4040 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodResponseData.java @@ -0,0 +1,240 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Webhooks auth method data from a response. */ +@JsonPropertyOrder({ + WebhooksAuthMethodResponseData.JSON_PROPERTY_ATTRIBUTES, + WebhooksAuthMethodResponseData.JSON_PROPERTY_ID, + WebhooksAuthMethodResponseData.JSON_PROPERTY_RELATIONSHIPS, + WebhooksAuthMethodResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksAuthMethodResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private WebhooksAuthMethodAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private WebhooksAuthMethodRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private WebhooksAuthMethodType type = WebhooksAuthMethodType.WEBHOOKS_AUTH_METHOD; + + public WebhooksAuthMethodResponseData() {} + + @JsonCreator + public WebhooksAuthMethodResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + WebhooksAuthMethodAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) WebhooksAuthMethodType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public WebhooksAuthMethodResponseData attributes(WebhooksAuthMethodAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a webhooks auth method. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WebhooksAuthMethodAttributes getAttributes() { + return attributes; + } + + public void setAttributes(WebhooksAuthMethodAttributes attributes) { + this.attributes = attributes; + } + + public WebhooksAuthMethodResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the auth method. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public WebhooksAuthMethodResponseData relationships( + WebhooksAuthMethodRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * Relationships of a webhooks auth method to its protocol-specific resource. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhooksAuthMethodRelationships getRelationships() { + return relationships; + } + + public void setRelationships(WebhooksAuthMethodRelationships relationships) { + this.relationships = relationships; + } + + public WebhooksAuthMethodResponseData type(WebhooksAuthMethodType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Webhooks auth method resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WebhooksAuthMethodType getType() { + return type; + } + + public void setType(WebhooksAuthMethodType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksAuthMethodResponseData + */ + @JsonAnySetter + public WebhooksAuthMethodResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksAuthMethodResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksAuthMethodResponseData webhooksAuthMethodResponseData = + (WebhooksAuthMethodResponseData) o; + return Objects.equals(this.attributes, webhooksAuthMethodResponseData.attributes) + && Objects.equals(this.id, webhooksAuthMethodResponseData.id) + && Objects.equals(this.relationships, webhooksAuthMethodResponseData.relationships) + && Objects.equals(this.type, webhooksAuthMethodResponseData.type) + && Objects.equals( + this.additionalProperties, webhooksAuthMethodResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksAuthMethodResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodType.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodType.java new file mode 100644 index 00000000000..21eb9809255 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodType.java @@ -0,0 +1,57 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Webhooks auth method resource type. */ +@JsonSerialize(using = WebhooksAuthMethodType.WebhooksAuthMethodTypeSerializer.class) +public class WebhooksAuthMethodType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("webhooks-auth-method")); + + public static final WebhooksAuthMethodType WEBHOOKS_AUTH_METHOD = + new WebhooksAuthMethodType("webhooks-auth-method"); + + WebhooksAuthMethodType(String value) { + super(value, allowedValues); + } + + public static class WebhooksAuthMethodTypeSerializer + extends StdSerializer { + public WebhooksAuthMethodTypeSerializer(Class t) { + super(t); + } + + public WebhooksAuthMethodTypeSerializer() { + this(null); + } + + @Override + public void serialize( + WebhooksAuthMethodType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static WebhooksAuthMethodType fromValue(String value) { + return new WebhooksAuthMethodType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodsResponse.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodsResponse.java new file mode 100644 index 00000000000..9f65c7673d9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksAuthMethodsResponse.java @@ -0,0 +1,200 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing a list of webhooks auth methods. */ +@JsonPropertyOrder({ + WebhooksAuthMethodsResponse.JSON_PROPERTY_DATA, + WebhooksAuthMethodsResponse.JSON_PROPERTY_INCLUDED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksAuthMethodsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_INCLUDED = "included"; + private List included = null; + + public WebhooksAuthMethodsResponse() {} + + @JsonCreator + public WebhooksAuthMethodsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + } + + public WebhooksAuthMethodsResponse data(List data) { + this.data = data; + for (WebhooksAuthMethodResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public WebhooksAuthMethodsResponse addDataItem(WebhooksAuthMethodResponseData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * An array of webhooks auth methods. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public WebhooksAuthMethodsResponse included( + List included) { + this.included = included; + for (WebhooksOAuth2ClientCredentialsResponseData item : included) { + this.unparsed |= item.unparsed; + } + return this; + } + + public WebhooksAuthMethodsResponse addIncludedItem( + WebhooksOAuth2ClientCredentialsResponseData includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + this.unparsed |= includedItem.unparsed; + return this; + } + + /** + * Resources related to the auth methods, included when requested via the include + * query parameter. + * + * @return included + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCLUDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIncluded() { + return included; + } + + public void setIncluded(List included) { + this.included = included; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksAuthMethodsResponse + */ + @JsonAnySetter + public WebhooksAuthMethodsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksAuthMethodsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksAuthMethodsResponse webhooksAuthMethodsResponse = (WebhooksAuthMethodsResponse) o; + return Objects.equals(this.data, webhooksAuthMethodsResponse.data) + && Objects.equals(this.included, webhooksAuthMethodsResponse.included) + && Objects.equals( + this.additionalProperties, webhooksAuthMethodsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksAuthMethodsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsCreateAttributes.java new file mode 100644 index 00000000000..acd5f2c6079 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsCreateAttributes.java @@ -0,0 +1,313 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** OAuth2 client credentials attributes for a create request. */ +@JsonPropertyOrder({ + WebhooksOAuth2ClientCredentialsCreateAttributes.JSON_PROPERTY_ACCESS_TOKEN_URL, + WebhooksOAuth2ClientCredentialsCreateAttributes.JSON_PROPERTY_AUDIENCE, + WebhooksOAuth2ClientCredentialsCreateAttributes.JSON_PROPERTY_CLIENT_ID, + WebhooksOAuth2ClientCredentialsCreateAttributes.JSON_PROPERTY_CLIENT_SECRET, + WebhooksOAuth2ClientCredentialsCreateAttributes.JSON_PROPERTY_NAME, + WebhooksOAuth2ClientCredentialsCreateAttributes.JSON_PROPERTY_SCOPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksOAuth2ClientCredentialsCreateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCESS_TOKEN_URL = "access_token_url"; + private String accessTokenUrl; + + public static final String JSON_PROPERTY_AUDIENCE = "audience"; + private JsonNullable audience = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CLIENT_ID = "client_id"; + private String clientId; + + public static final String JSON_PROPERTY_CLIENT_SECRET = "client_secret"; + private String clientSecret; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SCOPE = "scope"; + private JsonNullable scope = JsonNullable.undefined(); + + public WebhooksOAuth2ClientCredentialsCreateAttributes() {} + + @JsonCreator + public WebhooksOAuth2ClientCredentialsCreateAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACCESS_TOKEN_URL) String accessTokenUrl, + @JsonProperty(required = true, value = JSON_PROPERTY_CLIENT_ID) String clientId, + @JsonProperty(required = true, value = JSON_PROPERTY_CLIENT_SECRET) String clientSecret, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.accessTokenUrl = accessTokenUrl; + this.clientId = clientId; + this.clientSecret = clientSecret; + this.name = name; + } + + public WebhooksOAuth2ClientCredentialsCreateAttributes accessTokenUrl(String accessTokenUrl) { + this.accessTokenUrl = accessTokenUrl; + return this; + } + + /** + * URL of the OAuth2 access token endpoint. + * + * @return accessTokenUrl + */ + @JsonProperty(JSON_PROPERTY_ACCESS_TOKEN_URL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAccessTokenUrl() { + return accessTokenUrl; + } + + public void setAccessTokenUrl(String accessTokenUrl) { + this.accessTokenUrl = accessTokenUrl; + } + + public WebhooksOAuth2ClientCredentialsCreateAttributes audience(String audience) { + this.audience = JsonNullable.of(audience); + return this; + } + + /** + * The intended audience for the OAuth2 access token. + * + * @return audience + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getAudience() { + return audience.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_AUDIENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getAudience_JsonNullable() { + return audience; + } + + @JsonProperty(JSON_PROPERTY_AUDIENCE) + public void setAudience_JsonNullable(JsonNullable audience) { + this.audience = audience; + } + + public void setAudience(String audience) { + this.audience = JsonNullable.of(audience); + } + + public WebhooksOAuth2ClientCredentialsCreateAttributes clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * The OAuth2 client ID issued by the authorization server. + * + * @return clientId + */ + @JsonProperty(JSON_PROPERTY_CLIENT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public WebhooksOAuth2ClientCredentialsCreateAttributes clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * The OAuth2 client secret issued by the authorization server. Write-only; never returned by the + * API. + * + * @return clientSecret + */ + @JsonProperty(JSON_PROPERTY_CLIENT_SECRET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getClientSecret() { + return clientSecret; + } + + public void setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + } + + public WebhooksOAuth2ClientCredentialsCreateAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Human-readable name for this auth method. Must be unique within your organization. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public WebhooksOAuth2ClientCredentialsCreateAttributes scope(String scope) { + this.scope = JsonNullable.of(scope); + return this; + } + + /** + * Space-separated list of OAuth2 scopes to request. + * + * @return scope + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getScope() { + return scope.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getScope_JsonNullable() { + return scope; + } + + @JsonProperty(JSON_PROPERTY_SCOPE) + public void setScope_JsonNullable(JsonNullable scope) { + this.scope = scope; + } + + public void setScope(String scope) { + this.scope = JsonNullable.of(scope); + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksOAuth2ClientCredentialsCreateAttributes + */ + @JsonAnySetter + public WebhooksOAuth2ClientCredentialsCreateAttributes putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksOAuth2ClientCredentialsCreateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksOAuth2ClientCredentialsCreateAttributes + webhooksOAuth2ClientCredentialsCreateAttributes = + (WebhooksOAuth2ClientCredentialsCreateAttributes) o; + return Objects.equals( + this.accessTokenUrl, webhooksOAuth2ClientCredentialsCreateAttributes.accessTokenUrl) + && Objects.equals(this.audience, webhooksOAuth2ClientCredentialsCreateAttributes.audience) + && Objects.equals(this.clientId, webhooksOAuth2ClientCredentialsCreateAttributes.clientId) + && Objects.equals( + this.clientSecret, webhooksOAuth2ClientCredentialsCreateAttributes.clientSecret) + && Objects.equals(this.name, webhooksOAuth2ClientCredentialsCreateAttributes.name) + && Objects.equals(this.scope, webhooksOAuth2ClientCredentialsCreateAttributes.scope) + && Objects.equals( + this.additionalProperties, + webhooksOAuth2ClientCredentialsCreateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + accessTokenUrl, audience, clientId, clientSecret, name, scope, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksOAuth2ClientCredentialsCreateAttributes {\n"); + sb.append(" accessTokenUrl: ").append(toIndentedString(accessTokenUrl)).append("\n"); + sb.append(" audience: ").append(toIndentedString(audience)).append("\n"); + sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n"); + sb.append(" clientSecret: ").append(toIndentedString(clientSecret)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsCreateData.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsCreateData.java new file mode 100644 index 00000000000..cdc710f4518 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsCreateData.java @@ -0,0 +1,187 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** OAuth2 client credentials data for a create request. */ +@JsonPropertyOrder({ + WebhooksOAuth2ClientCredentialsCreateData.JSON_PROPERTY_ATTRIBUTES, + WebhooksOAuth2ClientCredentialsCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksOAuth2ClientCredentialsCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private WebhooksOAuth2ClientCredentialsCreateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private WebhooksOAuth2ClientCredentialsType type = + WebhooksOAuth2ClientCredentialsType.WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS; + + public WebhooksOAuth2ClientCredentialsCreateData() {} + + @JsonCreator + public WebhooksOAuth2ClientCredentialsCreateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + WebhooksOAuth2ClientCredentialsCreateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + WebhooksOAuth2ClientCredentialsType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public WebhooksOAuth2ClientCredentialsCreateData attributes( + WebhooksOAuth2ClientCredentialsCreateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * OAuth2 client credentials attributes for a create request. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WebhooksOAuth2ClientCredentialsCreateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(WebhooksOAuth2ClientCredentialsCreateAttributes attributes) { + this.attributes = attributes; + } + + public WebhooksOAuth2ClientCredentialsCreateData type(WebhooksOAuth2ClientCredentialsType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * OAuth2 client credentials resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WebhooksOAuth2ClientCredentialsType getType() { + return type; + } + + public void setType(WebhooksOAuth2ClientCredentialsType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksOAuth2ClientCredentialsCreateData + */ + @JsonAnySetter + public WebhooksOAuth2ClientCredentialsCreateData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksOAuth2ClientCredentialsCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksOAuth2ClientCredentialsCreateData webhooksOAuth2ClientCredentialsCreateData = + (WebhooksOAuth2ClientCredentialsCreateData) o; + return Objects.equals(this.attributes, webhooksOAuth2ClientCredentialsCreateData.attributes) + && Objects.equals(this.type, webhooksOAuth2ClientCredentialsCreateData.type) + && Objects.equals( + this.additionalProperties, + webhooksOAuth2ClientCredentialsCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksOAuth2ClientCredentialsCreateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsCreateRequest.java new file mode 100644 index 00000000000..21466ede4e2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsCreateRequest.java @@ -0,0 +1,151 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Create request for an OAuth2 client credentials auth method. */ +@JsonPropertyOrder({WebhooksOAuth2ClientCredentialsCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksOAuth2ClientCredentialsCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private WebhooksOAuth2ClientCredentialsCreateData data; + + public WebhooksOAuth2ClientCredentialsCreateRequest() {} + + @JsonCreator + public WebhooksOAuth2ClientCredentialsCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + WebhooksOAuth2ClientCredentialsCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public WebhooksOAuth2ClientCredentialsCreateRequest data( + WebhooksOAuth2ClientCredentialsCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * OAuth2 client credentials data for a create request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WebhooksOAuth2ClientCredentialsCreateData getData() { + return data; + } + + public void setData(WebhooksOAuth2ClientCredentialsCreateData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksOAuth2ClientCredentialsCreateRequest + */ + @JsonAnySetter + public WebhooksOAuth2ClientCredentialsCreateRequest putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksOAuth2ClientCredentialsCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksOAuth2ClientCredentialsCreateRequest webhooksOAuth2ClientCredentialsCreateRequest = + (WebhooksOAuth2ClientCredentialsCreateRequest) o; + return Objects.equals(this.data, webhooksOAuth2ClientCredentialsCreateRequest.data) + && Objects.equals( + this.additionalProperties, + webhooksOAuth2ClientCredentialsCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksOAuth2ClientCredentialsCreateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsRelationship.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsRelationship.java new file mode 100644 index 00000000000..31d1c154863 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsRelationship.java @@ -0,0 +1,141 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Relationship pointing to the OAuth2 client credentials resource for this auth method. */ +@JsonPropertyOrder({WebhooksOAuth2ClientCredentialsRelationship.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksOAuth2ClientCredentialsRelationship { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private WebhooksOAuth2ClientCredentialsRelationshipData data; + + public WebhooksOAuth2ClientCredentialsRelationship data( + WebhooksOAuth2ClientCredentialsRelationshipData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Relationship data referencing an OAuth2 client credentials resource. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhooksOAuth2ClientCredentialsRelationshipData getData() { + return data; + } + + public void setData(WebhooksOAuth2ClientCredentialsRelationshipData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksOAuth2ClientCredentialsRelationship + */ + @JsonAnySetter + public WebhooksOAuth2ClientCredentialsRelationship putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksOAuth2ClientCredentialsRelationship object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksOAuth2ClientCredentialsRelationship webhooksOAuth2ClientCredentialsRelationship = + (WebhooksOAuth2ClientCredentialsRelationship) o; + return Objects.equals(this.data, webhooksOAuth2ClientCredentialsRelationship.data) + && Objects.equals( + this.additionalProperties, + webhooksOAuth2ClientCredentialsRelationship.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksOAuth2ClientCredentialsRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsRelationshipData.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsRelationshipData.java new file mode 100644 index 00000000000..8727d62a3d0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsRelationshipData.java @@ -0,0 +1,175 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Relationship data referencing an OAuth2 client credentials resource. */ +@JsonPropertyOrder({ + WebhooksOAuth2ClientCredentialsRelationshipData.JSON_PROPERTY_ID, + WebhooksOAuth2ClientCredentialsRelationshipData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksOAuth2ClientCredentialsRelationshipData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private WebhooksOAuth2ClientCredentialsType type = + WebhooksOAuth2ClientCredentialsType.WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS; + + public WebhooksOAuth2ClientCredentialsRelationshipData id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the OAuth2 client credentials resource. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public WebhooksOAuth2ClientCredentialsRelationshipData type( + WebhooksOAuth2ClientCredentialsType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * OAuth2 client credentials resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhooksOAuth2ClientCredentialsType getType() { + return type; + } + + public void setType(WebhooksOAuth2ClientCredentialsType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksOAuth2ClientCredentialsRelationshipData + */ + @JsonAnySetter + public WebhooksOAuth2ClientCredentialsRelationshipData putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksOAuth2ClientCredentialsRelationshipData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksOAuth2ClientCredentialsRelationshipData + webhooksOAuth2ClientCredentialsRelationshipData = + (WebhooksOAuth2ClientCredentialsRelationshipData) o; + return Objects.equals(this.id, webhooksOAuth2ClientCredentialsRelationshipData.id) + && Objects.equals(this.type, webhooksOAuth2ClientCredentialsRelationshipData.type) + && Objects.equals( + this.additionalProperties, + webhooksOAuth2ClientCredentialsRelationshipData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksOAuth2ClientCredentialsRelationshipData {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsResponse.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsResponse.java new file mode 100644 index 00000000000..bd924abaf81 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsResponse.java @@ -0,0 +1,150 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response containing an OAuth2 client credentials auth method. */ +@JsonPropertyOrder({WebhooksOAuth2ClientCredentialsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksOAuth2ClientCredentialsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private WebhooksOAuth2ClientCredentialsResponseData data; + + public WebhooksOAuth2ClientCredentialsResponse() {} + + @JsonCreator + public WebhooksOAuth2ClientCredentialsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + WebhooksOAuth2ClientCredentialsResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public WebhooksOAuth2ClientCredentialsResponse data( + WebhooksOAuth2ClientCredentialsResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * OAuth2 client credentials data from a response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WebhooksOAuth2ClientCredentialsResponseData getData() { + return data; + } + + public void setData(WebhooksOAuth2ClientCredentialsResponseData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksOAuth2ClientCredentialsResponse + */ + @JsonAnySetter + public WebhooksOAuth2ClientCredentialsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksOAuth2ClientCredentialsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksOAuth2ClientCredentialsResponse webhooksOAuth2ClientCredentialsResponse = + (WebhooksOAuth2ClientCredentialsResponse) o; + return Objects.equals(this.data, webhooksOAuth2ClientCredentialsResponse.data) + && Objects.equals( + this.additionalProperties, + webhooksOAuth2ClientCredentialsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksOAuth2ClientCredentialsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsResponseAttributes.java new file mode 100644 index 00000000000..01de464f464 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsResponseAttributes.java @@ -0,0 +1,308 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * OAuth2 client credentials attributes returned by the API. The client_secret is never + * echoed. + */ +@JsonPropertyOrder({ + WebhooksOAuth2ClientCredentialsResponseAttributes.JSON_PROPERTY_ACCESS_TOKEN_URL, + WebhooksOAuth2ClientCredentialsResponseAttributes.JSON_PROPERTY_AUDIENCE, + WebhooksOAuth2ClientCredentialsResponseAttributes.JSON_PROPERTY_CLIENT_ID, + WebhooksOAuth2ClientCredentialsResponseAttributes.JSON_PROPERTY_NAME, + WebhooksOAuth2ClientCredentialsResponseAttributes.JSON_PROPERTY_PROTOCOL, + WebhooksOAuth2ClientCredentialsResponseAttributes.JSON_PROPERTY_SCOPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksOAuth2ClientCredentialsResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCESS_TOKEN_URL = "access_token_url"; + private String accessTokenUrl; + + public static final String JSON_PROPERTY_AUDIENCE = "audience"; + private JsonNullable audience = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CLIENT_ID = "client_id"; + private String clientId; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PROTOCOL = "protocol"; + private WebhooksAuthMethodProtocol protocol; + + public static final String JSON_PROPERTY_SCOPE = "scope"; + private JsonNullable scope = JsonNullable.undefined(); + + public WebhooksOAuth2ClientCredentialsResponseAttributes accessTokenUrl(String accessTokenUrl) { + this.accessTokenUrl = accessTokenUrl; + return this; + } + + /** + * URL of the OAuth2 access token endpoint. + * + * @return accessTokenUrl + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACCESS_TOKEN_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAccessTokenUrl() { + return accessTokenUrl; + } + + public void setAccessTokenUrl(String accessTokenUrl) { + this.accessTokenUrl = accessTokenUrl; + } + + public WebhooksOAuth2ClientCredentialsResponseAttributes audience(String audience) { + this.audience = JsonNullable.of(audience); + return this; + } + + /** + * The intended audience for the OAuth2 access token. + * + * @return audience + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getAudience() { + return audience.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_AUDIENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getAudience_JsonNullable() { + return audience; + } + + @JsonProperty(JSON_PROPERTY_AUDIENCE) + public void setAudience_JsonNullable(JsonNullable audience) { + this.audience = audience; + } + + public void setAudience(String audience) { + this.audience = JsonNullable.of(audience); + } + + public WebhooksOAuth2ClientCredentialsResponseAttributes clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * The OAuth2 client ID issued by the authorization server. + * + * @return clientId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CLIENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public WebhooksOAuth2ClientCredentialsResponseAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Human-readable name for this auth method. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public WebhooksOAuth2ClientCredentialsResponseAttributes protocol( + WebhooksAuthMethodProtocol protocol) { + this.protocol = protocol; + this.unparsed |= !protocol.isValid(); + return this; + } + + /** + * Authentication protocol used by the auth method. + * + * @return protocol + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PROTOCOL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WebhooksAuthMethodProtocol getProtocol() { + return protocol; + } + + public void setProtocol(WebhooksAuthMethodProtocol protocol) { + if (!protocol.isValid()) { + this.unparsed = true; + } + this.protocol = protocol; + } + + public WebhooksOAuth2ClientCredentialsResponseAttributes scope(String scope) { + this.scope = JsonNullable.of(scope); + return this; + } + + /** + * Space-separated list of OAuth2 scopes to request. + * + * @return scope + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getScope() { + return scope.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getScope_JsonNullable() { + return scope; + } + + @JsonProperty(JSON_PROPERTY_SCOPE) + public void setScope_JsonNullable(JsonNullable scope) { + this.scope = scope; + } + + public void setScope(String scope) { + this.scope = JsonNullable.of(scope); + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksOAuth2ClientCredentialsResponseAttributes + */ + @JsonAnySetter + public WebhooksOAuth2ClientCredentialsResponseAttributes putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksOAuth2ClientCredentialsResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksOAuth2ClientCredentialsResponseAttributes + webhooksOAuth2ClientCredentialsResponseAttributes = + (WebhooksOAuth2ClientCredentialsResponseAttributes) o; + return Objects.equals( + this.accessTokenUrl, webhooksOAuth2ClientCredentialsResponseAttributes.accessTokenUrl) + && Objects.equals(this.audience, webhooksOAuth2ClientCredentialsResponseAttributes.audience) + && Objects.equals(this.clientId, webhooksOAuth2ClientCredentialsResponseAttributes.clientId) + && Objects.equals(this.name, webhooksOAuth2ClientCredentialsResponseAttributes.name) + && Objects.equals(this.protocol, webhooksOAuth2ClientCredentialsResponseAttributes.protocol) + && Objects.equals(this.scope, webhooksOAuth2ClientCredentialsResponseAttributes.scope) + && Objects.equals( + this.additionalProperties, + webhooksOAuth2ClientCredentialsResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + accessTokenUrl, audience, clientId, name, protocol, scope, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksOAuth2ClientCredentialsResponseAttributes {\n"); + sb.append(" accessTokenUrl: ").append(toIndentedString(accessTokenUrl)).append("\n"); + sb.append(" audience: ").append(toIndentedString(audience)).append("\n"); + sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" protocol: ").append(toIndentedString(protocol)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsResponseData.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsResponseData.java new file mode 100644 index 00000000000..0a9d478033b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsResponseData.java @@ -0,0 +1,218 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** OAuth2 client credentials data from a response. */ +@JsonPropertyOrder({ + WebhooksOAuth2ClientCredentialsResponseData.JSON_PROPERTY_ATTRIBUTES, + WebhooksOAuth2ClientCredentialsResponseData.JSON_PROPERTY_ID, + WebhooksOAuth2ClientCredentialsResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksOAuth2ClientCredentialsResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private WebhooksOAuth2ClientCredentialsResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private WebhooksOAuth2ClientCredentialsType type = + WebhooksOAuth2ClientCredentialsType.WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS; + + public WebhooksOAuth2ClientCredentialsResponseData() {} + + @JsonCreator + public WebhooksOAuth2ClientCredentialsResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + WebhooksOAuth2ClientCredentialsResponseAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + WebhooksOAuth2ClientCredentialsType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public WebhooksOAuth2ClientCredentialsResponseData attributes( + WebhooksOAuth2ClientCredentialsResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * OAuth2 client credentials attributes returned by the API. The client_secret is + * never echoed. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WebhooksOAuth2ClientCredentialsResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(WebhooksOAuth2ClientCredentialsResponseAttributes attributes) { + this.attributes = attributes; + } + + public WebhooksOAuth2ClientCredentialsResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the OAuth2 client credentials auth method. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public WebhooksOAuth2ClientCredentialsResponseData type( + WebhooksOAuth2ClientCredentialsType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * OAuth2 client credentials resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WebhooksOAuth2ClientCredentialsType getType() { + return type; + } + + public void setType(WebhooksOAuth2ClientCredentialsType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksOAuth2ClientCredentialsResponseData + */ + @JsonAnySetter + public WebhooksOAuth2ClientCredentialsResponseData putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksOAuth2ClientCredentialsResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksOAuth2ClientCredentialsResponseData webhooksOAuth2ClientCredentialsResponseData = + (WebhooksOAuth2ClientCredentialsResponseData) o; + return Objects.equals(this.attributes, webhooksOAuth2ClientCredentialsResponseData.attributes) + && Objects.equals(this.id, webhooksOAuth2ClientCredentialsResponseData.id) + && Objects.equals(this.type, webhooksOAuth2ClientCredentialsResponseData.type) + && Objects.equals( + this.additionalProperties, + webhooksOAuth2ClientCredentialsResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksOAuth2ClientCredentialsResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsType.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsType.java new file mode 100644 index 00000000000..74f52e759c7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsType.java @@ -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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** OAuth2 client credentials resource type. */ +@JsonSerialize( + using = WebhooksOAuth2ClientCredentialsType.WebhooksOAuth2ClientCredentialsTypeSerializer.class) +public class WebhooksOAuth2ClientCredentialsType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("webhooks-auth-method-oauth2-client-credentials")); + + public static final WebhooksOAuth2ClientCredentialsType + WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS = + new WebhooksOAuth2ClientCredentialsType("webhooks-auth-method-oauth2-client-credentials"); + + WebhooksOAuth2ClientCredentialsType(String value) { + super(value, allowedValues); + } + + public static class WebhooksOAuth2ClientCredentialsTypeSerializer + extends StdSerializer { + public WebhooksOAuth2ClientCredentialsTypeSerializer( + Class t) { + super(t); + } + + public WebhooksOAuth2ClientCredentialsTypeSerializer() { + this(null); + } + + @Override + public void serialize( + WebhooksOAuth2ClientCredentialsType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static WebhooksOAuth2ClientCredentialsType fromValue(String value) { + return new WebhooksOAuth2ClientCredentialsType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsUpdateAttributes.java new file mode 100644 index 00000000000..ef5fd5eeab6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsUpdateAttributes.java @@ -0,0 +1,302 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** OAuth2 client credentials attributes for an update request. */ +@JsonPropertyOrder({ + WebhooksOAuth2ClientCredentialsUpdateAttributes.JSON_PROPERTY_ACCESS_TOKEN_URL, + WebhooksOAuth2ClientCredentialsUpdateAttributes.JSON_PROPERTY_AUDIENCE, + WebhooksOAuth2ClientCredentialsUpdateAttributes.JSON_PROPERTY_CLIENT_ID, + WebhooksOAuth2ClientCredentialsUpdateAttributes.JSON_PROPERTY_CLIENT_SECRET, + WebhooksOAuth2ClientCredentialsUpdateAttributes.JSON_PROPERTY_NAME, + WebhooksOAuth2ClientCredentialsUpdateAttributes.JSON_PROPERTY_SCOPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksOAuth2ClientCredentialsUpdateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACCESS_TOKEN_URL = "access_token_url"; + private String accessTokenUrl; + + public static final String JSON_PROPERTY_AUDIENCE = "audience"; + private JsonNullable audience = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CLIENT_ID = "client_id"; + private String clientId; + + public static final String JSON_PROPERTY_CLIENT_SECRET = "client_secret"; + private String clientSecret; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SCOPE = "scope"; + private JsonNullable scope = JsonNullable.undefined(); + + public WebhooksOAuth2ClientCredentialsUpdateAttributes accessTokenUrl(String accessTokenUrl) { + this.accessTokenUrl = accessTokenUrl; + return this; + } + + /** + * URL of the OAuth2 access token endpoint. + * + * @return accessTokenUrl + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ACCESS_TOKEN_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAccessTokenUrl() { + return accessTokenUrl; + } + + public void setAccessTokenUrl(String accessTokenUrl) { + this.accessTokenUrl = accessTokenUrl; + } + + public WebhooksOAuth2ClientCredentialsUpdateAttributes audience(String audience) { + this.audience = JsonNullable.of(audience); + return this; + } + + /** + * The intended audience for the OAuth2 access token. + * + * @return audience + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getAudience() { + return audience.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_AUDIENCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getAudience_JsonNullable() { + return audience; + } + + @JsonProperty(JSON_PROPERTY_AUDIENCE) + public void setAudience_JsonNullable(JsonNullable audience) { + this.audience = audience; + } + + public void setAudience(String audience) { + this.audience = JsonNullable.of(audience); + } + + public WebhooksOAuth2ClientCredentialsUpdateAttributes clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * The OAuth2 client ID issued by the authorization server. + * + * @return clientId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CLIENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public WebhooksOAuth2ClientCredentialsUpdateAttributes clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * The OAuth2 client secret issued by the authorization server. Write-only; never returned by the + * API. + * + * @return clientSecret + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CLIENT_SECRET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getClientSecret() { + return clientSecret; + } + + public void setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + } + + public WebhooksOAuth2ClientCredentialsUpdateAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Human-readable name for this auth method. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public WebhooksOAuth2ClientCredentialsUpdateAttributes scope(String scope) { + this.scope = JsonNullable.of(scope); + return this; + } + + /** + * Space-separated list of OAuth2 scopes to request. + * + * @return scope + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getScope() { + return scope.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getScope_JsonNullable() { + return scope; + } + + @JsonProperty(JSON_PROPERTY_SCOPE) + public void setScope_JsonNullable(JsonNullable scope) { + this.scope = scope; + } + + public void setScope(String scope) { + this.scope = JsonNullable.of(scope); + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksOAuth2ClientCredentialsUpdateAttributes + */ + @JsonAnySetter + public WebhooksOAuth2ClientCredentialsUpdateAttributes putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksOAuth2ClientCredentialsUpdateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksOAuth2ClientCredentialsUpdateAttributes + webhooksOAuth2ClientCredentialsUpdateAttributes = + (WebhooksOAuth2ClientCredentialsUpdateAttributes) o; + return Objects.equals( + this.accessTokenUrl, webhooksOAuth2ClientCredentialsUpdateAttributes.accessTokenUrl) + && Objects.equals(this.audience, webhooksOAuth2ClientCredentialsUpdateAttributes.audience) + && Objects.equals(this.clientId, webhooksOAuth2ClientCredentialsUpdateAttributes.clientId) + && Objects.equals( + this.clientSecret, webhooksOAuth2ClientCredentialsUpdateAttributes.clientSecret) + && Objects.equals(this.name, webhooksOAuth2ClientCredentialsUpdateAttributes.name) + && Objects.equals(this.scope, webhooksOAuth2ClientCredentialsUpdateAttributes.scope) + && Objects.equals( + this.additionalProperties, + webhooksOAuth2ClientCredentialsUpdateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + accessTokenUrl, audience, clientId, clientSecret, name, scope, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksOAuth2ClientCredentialsUpdateAttributes {\n"); + sb.append(" accessTokenUrl: ").append(toIndentedString(accessTokenUrl)).append("\n"); + sb.append(" audience: ").append(toIndentedString(audience)).append("\n"); + sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n"); + sb.append(" clientSecret: ").append(toIndentedString(clientSecret)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsUpdateData.java new file mode 100644 index 00000000000..e1cc5cf538e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsUpdateData.java @@ -0,0 +1,187 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** OAuth2 client credentials data for an update request. */ +@JsonPropertyOrder({ + WebhooksOAuth2ClientCredentialsUpdateData.JSON_PROPERTY_ATTRIBUTES, + WebhooksOAuth2ClientCredentialsUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksOAuth2ClientCredentialsUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private WebhooksOAuth2ClientCredentialsUpdateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private WebhooksOAuth2ClientCredentialsType type = + WebhooksOAuth2ClientCredentialsType.WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS; + + public WebhooksOAuth2ClientCredentialsUpdateData() {} + + @JsonCreator + public WebhooksOAuth2ClientCredentialsUpdateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + WebhooksOAuth2ClientCredentialsUpdateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + WebhooksOAuth2ClientCredentialsType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public WebhooksOAuth2ClientCredentialsUpdateData attributes( + WebhooksOAuth2ClientCredentialsUpdateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * OAuth2 client credentials attributes for an update request. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WebhooksOAuth2ClientCredentialsUpdateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(WebhooksOAuth2ClientCredentialsUpdateAttributes attributes) { + this.attributes = attributes; + } + + public WebhooksOAuth2ClientCredentialsUpdateData type(WebhooksOAuth2ClientCredentialsType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * OAuth2 client credentials resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WebhooksOAuth2ClientCredentialsType getType() { + return type; + } + + public void setType(WebhooksOAuth2ClientCredentialsType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksOAuth2ClientCredentialsUpdateData + */ + @JsonAnySetter + public WebhooksOAuth2ClientCredentialsUpdateData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksOAuth2ClientCredentialsUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksOAuth2ClientCredentialsUpdateData webhooksOAuth2ClientCredentialsUpdateData = + (WebhooksOAuth2ClientCredentialsUpdateData) o; + return Objects.equals(this.attributes, webhooksOAuth2ClientCredentialsUpdateData.attributes) + && Objects.equals(this.type, webhooksOAuth2ClientCredentialsUpdateData.type) + && Objects.equals( + this.additionalProperties, + webhooksOAuth2ClientCredentialsUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksOAuth2ClientCredentialsUpdateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsUpdateRequest.java new file mode 100644 index 00000000000..805f1f2762f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WebhooksOAuth2ClientCredentialsUpdateRequest.java @@ -0,0 +1,151 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Update request for an OAuth2 client credentials auth method. */ +@JsonPropertyOrder({WebhooksOAuth2ClientCredentialsUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WebhooksOAuth2ClientCredentialsUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private WebhooksOAuth2ClientCredentialsUpdateData data; + + public WebhooksOAuth2ClientCredentialsUpdateRequest() {} + + @JsonCreator + public WebhooksOAuth2ClientCredentialsUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + WebhooksOAuth2ClientCredentialsUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public WebhooksOAuth2ClientCredentialsUpdateRequest data( + WebhooksOAuth2ClientCredentialsUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * OAuth2 client credentials data for an update request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WebhooksOAuth2ClientCredentialsUpdateData getData() { + return data; + } + + public void setData(WebhooksOAuth2ClientCredentialsUpdateData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WebhooksOAuth2ClientCredentialsUpdateRequest + */ + @JsonAnySetter + public WebhooksOAuth2ClientCredentialsUpdateRequest putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WebhooksOAuth2ClientCredentialsUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhooksOAuth2ClientCredentialsUpdateRequest webhooksOAuth2ClientCredentialsUpdateRequest = + (WebhooksOAuth2ClientCredentialsUpdateRequest) o; + return Objects.equals(this.data, webhooksOAuth2ClientCredentialsUpdateRequest.data) + && Objects.equals( + this.additionalProperties, + webhooksOAuth2ClientCredentialsUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhooksOAuth2ClientCredentialsUpdateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 7139a86ede5..f7533901108 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index b6003df8683..286a2c3af8a 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/webhooks_integration.feature b/src/test/resources/com/datadog/api/client/v2/api/webhooks_integration.feature new file mode 100644 index 00000000000..c97a2d40375 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/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