diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 1730835ab4e..e067fae0341 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -68497,6 +68497,256 @@ components: required: - data type: object + GitHubCostsCloudCostMetricsIntegrationDataflowResponse: + description: >- + GitHub costs, including Actions, storage, and Copilot, which you can analyze in [Cloud Cost Management](https://docs.datadoghq.com/cloud_cost_management/). Reported costs are estimates based on list prices and usage data and include discounts when available, but not negotiated rates. Requires Cloud Cost Management on your Datadog organization and a GitHub account on the enhanced billing platform. Without them, this dataflow collects no data. This dataflow is always on and cannot be turned off, so it appears in responses only. + properties: + enabled: + description: Whether Datadog collects this data. Always `true`, because this collection cannot be turned off. + example: true + readOnly: true + type: boolean + status: + $ref: "#/components/schemas/IntegrationAccountDataflowStatus" + type: object + GitHubCostsIntegrationAccountAuthenticationRequest: + description: Authentication for creating the GitHub Costs integration account. Exactly one method is set. + oneOf: + - $ref: "#/components/schemas/GitHubCostsIntegrationAccountBearerTokenAuthRequest" + GitHubCostsIntegrationAccountAuthenticationResponse: + description: Authentication configured on the GitHub Costs integration account. + oneOf: + - $ref: "#/components/schemas/GitHubCostsIntegrationAccountBearerTokenAuthResponse" + GitHubCostsIntegrationAccountAuthenticationUpdate: + description: Authentication for updating the GitHub Costs integration account. Exactly one method is set. + oneOf: + - $ref: "#/components/schemas/GitHubCostsIntegrationAccountBearerTokenAuthUpdate" + GitHubCostsIntegrationAccountBearerTokenAuthRequest: + additionalProperties: false + description: >- + Bearer token authentication. Use the token type that matches `settings.enterprise_name`: a classic personal access token for an enterprise, or a fine-grained personal access token for an organization. + properties: + auth_type: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountBearerTokenAuthType" + token: + description: >- + For an enterprise, a personal access token (classic) from an Enterprise Admin user with the `manage_billing:enterprise` and `read:org` scopes. For an organization, a fine-grained personal access token owned by that organization and created by an organization owner, with the `Administration` organization permission set to read-only. + example: your-token + type: string + writeOnly: true + required: + - auth_type + - token + type: object + GitHubCostsIntegrationAccountBearerTokenAuthResponse: + description: The bearer token authentication method configured on the account. + properties: + auth_type: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountBearerTokenAuthType" + required: + - auth_type + type: object + GitHubCostsIntegrationAccountBearerTokenAuthType: + default: bearer_token + description: The authentication method type. + enum: + - bearer_token + example: bearer_token + type: string + x-enum-varnames: + - BEARER_TOKEN + GitHubCostsIntegrationAccountBearerTokenAuthUpdate: + additionalProperties: false + description: >- + Bearer token authentication. Use the token type that matches `settings.enterprise_name`: a classic personal access token for an enterprise, or a fine-grained personal access token for an organization. Only the provided fields are changed. To keep the stored token, omit `token`. + properties: + auth_type: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountBearerTokenAuthType" + token: + description: >- + For an enterprise, a personal access token (classic) from an Enterprise Admin user with the `manage_billing:enterprise` and `read:org` scopes. For an organization, a fine-grained personal access token owned by that organization and created by an organization owner, with the `Administration` organization permission set to read-only. + example: your-token + type: string + writeOnly: true + required: + - auth_type + type: object + GitHubCostsIntegrationAccountCreateAttributes: + description: Writable attributes used to create a GitHub Costs integration account. + properties: + authentication: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountAuthenticationRequest" + name: + description: Human-readable name of the GitHub Costs integration account. + example: github-costs-acme + type: string + settings: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountSettingsRequest" + required: + - name + - authentication + - settings + type: object + GitHubCostsIntegrationAccountCreateData: + description: Data envelope for creating a GitHub Costs integration account. + properties: + attributes: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountCreateAttributes" + type: + $ref: "#/components/schemas/IntegrationAccountType" + required: + - type + - attributes + type: object + GitHubCostsIntegrationAccountCreateRequest: + description: Request payload to create a GitHub Costs integration account. + properties: + data: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountCreateData" + required: + - data + type: object + GitHubCostsIntegrationAccountResponse: + description: Response payload for a single GitHub Costs integration account. + properties: + data: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountResponseData" + required: + - data + type: object + GitHubCostsIntegrationAccountResponseAttributes: + description: Attributes of a GitHub Costs integration account returned in responses. + properties: + authentication: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountAuthenticationResponse" + dataflows: + $ref: "#/components/schemas/GitHubCostsIntegrationDataflowsResponse" + name: + description: Human-readable name of the GitHub Costs integration account. + example: github-costs-acme + type: string + settings: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountSettingsResponse" + required: + - name + - settings + type: object + GitHubCostsIntegrationAccountResponseData: + description: Data envelope of a GitHub Costs integration account, including server-assigned identity. + properties: + attributes: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountResponseAttributes" + id: + description: Server-generated unique identifier of the GitHub Costs integration account. + example: 5f1a8d3c-7e2b-4f9a-b6c4-8d0e3a7f1b52 + readOnly: true + type: string + type: + $ref: "#/components/schemas/IntegrationAccountType" + required: + - id + - attributes + - type + type: object + GitHubCostsIntegrationAccountSettingsRequest: + additionalProperties: false + description: Settings for creating the GitHub Costs integration account. + properties: + enterprise_name: + description: >- + Slug of the GitHub enterprise, as in `https://github.com/enterprises/`, or login of a GitHub organization, as in `https://github.com/`. An enterprise covers every organization it owns. Connecting both an enterprise and one of its organizations counts that organization's costs twice. The token in `authentication` must match: classic for an enterprise, fine-grained for an organization. + example: enterprise-name + type: string + tags: + description: Comma-separated list of custom tags for this GitHub Costs account. + example: "env:prod,team:example" + type: string + required: + - enterprise_name + type: object + GitHubCostsIntegrationAccountSettingsResponse: + description: Settings configured on the GitHub Costs integration account. + properties: + enterprise_name: + description: >- + Slug of the GitHub enterprise, as in `https://github.com/enterprises/`, or login of a GitHub organization, as in `https://github.com/`. + example: enterprise-name + type: string + tags: + description: Comma-separated list of custom tags for this GitHub Costs account. + example: "env:prod,team:example" + type: string + required: + - enterprise_name + type: object + GitHubCostsIntegrationAccountSettingsUpdate: + additionalProperties: false + description: Settings for updating the GitHub Costs integration account. Only the provided fields are changed. + properties: + enterprise_name: + description: >- + Slug of the GitHub enterprise, as in `https://github.com/enterprises/`, or login of a GitHub organization, as in `https://github.com/`. An enterprise covers every organization it owns. Connecting both an enterprise and one of its organizations counts that organization's costs twice. The token in `authentication` must match: classic for an enterprise, fine-grained for an organization. + example: enterprise-name + type: string + tags: + description: Comma-separated list of custom tags for this GitHub Costs account. + example: "env:prod,team:example" + type: string + type: object + GitHubCostsIntegrationAccountUpdateAttributes: + description: >- + Writable attributes used to update a GitHub Costs integration account. Every field is optional. Only the provided fields are changed. + properties: + authentication: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountAuthenticationUpdate" + name: + description: Human-readable name of the GitHub Costs integration account. + example: github-costs-acme + type: string + settings: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountSettingsUpdate" + type: object + GitHubCostsIntegrationAccountUpdateData: + description: Data envelope for updating a GitHub Costs integration account. + properties: + attributes: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountUpdateAttributes" + id: + description: Unique identifier of the GitHub Costs integration account to update. + example: 5f1a8d3c-7e2b-4f9a-b6c4-8d0e3a7f1b52 + type: string + type: + $ref: "#/components/schemas/IntegrationAccountType" + required: + - id + - type + - attributes + type: object + GitHubCostsIntegrationAccountUpdateRequest: + description: Request payload to update a GitHub Costs integration account. + properties: + data: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountUpdateData" + required: + - data + type: object + GitHubCostsIntegrationAccountsResponse: + description: Response payload for a list of GitHub Costs integration accounts. + properties: + data: + description: List of GitHub Costs integration accounts. + items: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountResponseData" + type: array + required: + - data + type: object + GitHubCostsIntegrationDataflowsResponse: + description: Data Datadog collects from GitHub Costs, keyed by dataflow ID. + properties: + github-cloud-cost-metrics: + $ref: "#/components/schemas/GitHubCostsCloudCostMetricsIntegrationDataflowResponse" + type: object GitHubOIDCClaimPatterns: additionalProperties: false description: |- @@ -209732,6 +209982,244 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/integration-interfaces/github-costs/accounts: + get: + description: List GitHub Costs integration accounts. + operationId: ListGitHubCostsIntegrationAccounts + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + authentication: + auth_type: bearer_token + dataflows: + github-cloud-cost-metrics: + enabled: true + status: + health: DATAFLOW_HEALTH_OK + updated_at: "2026-11-10T08:30:50Z" + name: github-costs-acme + settings: + enterprise_name: enterprise-name + tags: "env:prod,team:example" + id: 5f1a8d3c-7e2b-4f9a-b6c4-8d0e3a7f1b52 + type: integration-account + schema: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountsResponse" + description: OK + "400": + $ref: "#/components/responses/IntegrationAccountBadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/IntegrationAccountNotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List GitHub Costs integration accounts + tags: + - GitHub Costs Integration + "x-permission": + operator: OR + permissions: + - integrations_read + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create a GitHub Costs integration account. + operationId: CreateGitHubCostsIntegrationAccount + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + authentication: + auth_type: bearer_token + dataflows: + github-cloud-cost-metrics: + enabled: true + status: + health: DATAFLOW_HEALTH_OK + updated_at: "2026-11-10T08:30:50Z" + name: github-costs-acme + settings: + enterprise_name: enterprise-name + tags: "env:prod,team:example" + id: 5f1a8d3c-7e2b-4f9a-b6c4-8d0e3a7f1b52 + type: integration-account + schema: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountResponse" + description: Created + "400": + $ref: "#/components/responses/IntegrationAccountBadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/IntegrationAccountNotFoundResponse" + "422": + $ref: "#/components/responses/UnprocessableEntityResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create a GitHub Costs integration account + tags: + - GitHub Costs Integration + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - manage_integrations + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/integration-interfaces/github-costs/accounts/{account_id}: + delete: + description: Delete a GitHub Costs integration account. + operationId: DeleteGitHubCostsIntegrationAccount + parameters: + - $ref: "#/components/parameters/IntegrationAccountIdParameter" + responses: + "200": + description: OK + "400": + $ref: "#/components/responses/IntegrationAccountBadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/IntegrationAccountNotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete a GitHub Costs integration account + tags: + - GitHub Costs Integration + "x-permission": + operator: OR + permissions: + - manage_integrations + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get a GitHub Costs integration account. + operationId: GetGitHubCostsIntegrationAccount + parameters: + - $ref: "#/components/parameters/IntegrationAccountIdParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + authentication: + auth_type: bearer_token + dataflows: + github-cloud-cost-metrics: + enabled: true + status: + health: DATAFLOW_HEALTH_OK + updated_at: "2026-11-10T08:30:50Z" + name: github-costs-acme + settings: + enterprise_name: enterprise-name + tags: "env:prod,team:example" + id: 5f1a8d3c-7e2b-4f9a-b6c4-8d0e3a7f1b52 + type: integration-account + schema: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountResponse" + description: OK + "400": + $ref: "#/components/responses/IntegrationAccountBadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/IntegrationAccountNotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get a GitHub Costs integration account + tags: + - GitHub Costs Integration + "x-permission": + operator: OR + permissions: + - integrations_read + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: Update a GitHub Costs integration account. Only the fields provided are changed. + operationId: UpdateGitHubCostsIntegrationAccount + parameters: + - $ref: "#/components/parameters/IntegrationAccountIdParameter" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + authentication: + auth_type: bearer_token + dataflows: + github-cloud-cost-metrics: + enabled: true + status: + health: DATAFLOW_HEALTH_OK + updated_at: "2026-11-10T08:30:50Z" + name: github-costs-acme + settings: + enterprise_name: enterprise-name + tags: "env:prod,team:example" + id: 5f1a8d3c-7e2b-4f9a-b6c4-8d0e3a7f1b52 + type: integration-account + schema: + $ref: "#/components/schemas/GitHubCostsIntegrationAccountResponse" + description: OK + "400": + $ref: "#/components/responses/IntegrationAccountBadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/IntegrationAccountNotFoundResponse" + "422": + $ref: "#/components/responses/UnprocessableEntityResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Update a GitHub Costs integration account + tags: + - GitHub Costs Integration + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - manage_integrations + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/integration-interfaces/nebius-cloud/accounts: get: description: List Nebius Cloud integration accounts. @@ -286524,6 +287012,15 @@ tags: externalDocs: url: https://docs.datadoghq.com/integrations/google_cloud_platform name: GCP Integration + - description: |- + Manage your Datadog GitHub Costs integration accounts and account resources + directly through the Datadog API. See the + [GitHub Costs integration page](https://docs.datadoghq.com/integrations/github-costs/) for + more information. + externalDocs: + description: GitHub Costs integration. + url: https://docs.datadoghq.com/integrations/github-costs/ + name: GitHub Costs Integration - description: |- Configure your [Datadog Google Chat integration](https://docs.datadoghq.com/integrations/google-hangouts-chat/) directly through the Datadog API. diff --git a/examples/v2/github-costs-integration/CreateGitHubCostsIntegrationAccount.java b/examples/v2/github-costs-integration/CreateGitHubCostsIntegrationAccount.java new file mode 100644 index 00000000000..2bb181fef67 --- /dev/null +++ b/examples/v2/github-costs-integration/CreateGitHubCostsIntegrationAccount.java @@ -0,0 +1,56 @@ +// Create a GitHub Costs integration account returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GitHubCostsIntegrationApi; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountAuthenticationRequest; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountBearerTokenAuthRequest; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountBearerTokenAuthType; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountCreateAttributes; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountCreateData; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountCreateRequest; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountResponse; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountSettingsRequest; +import com.datadog.api.client.v2.model.IntegrationAccountType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.createGitHubCostsIntegrationAccount", true); + GitHubCostsIntegrationApi apiInstance = new GitHubCostsIntegrationApi(defaultClient); + + GitHubCostsIntegrationAccountCreateRequest body = + new GitHubCostsIntegrationAccountCreateRequest() + .data( + new GitHubCostsIntegrationAccountCreateData() + .attributes( + new GitHubCostsIntegrationAccountCreateAttributes() + .authentication( + new GitHubCostsIntegrationAccountAuthenticationRequest( + new GitHubCostsIntegrationAccountBearerTokenAuthRequest() + .authType( + GitHubCostsIntegrationAccountBearerTokenAuthType + .BEARER_TOKEN) + .token("your-token"))) + .name("github-costs-acme") + .settings( + new GitHubCostsIntegrationAccountSettingsRequest() + .enterpriseName("enterprise-name") + .tags("env:prod,team:example"))) + .type(IntegrationAccountType.INTEGRATION_ACCOUNT)); + + try { + GitHubCostsIntegrationAccountResponse result = + apiInstance.createGitHubCostsIntegrationAccount(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GitHubCostsIntegrationApi#createGitHubCostsIntegrationAccount"); + 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/github-costs-integration/DeleteGitHubCostsIntegrationAccount.java b/examples/v2/github-costs-integration/DeleteGitHubCostsIntegrationAccount.java new file mode 100644 index 00000000000..6191f308af3 --- /dev/null +++ b/examples/v2/github-costs-integration/DeleteGitHubCostsIntegrationAccount.java @@ -0,0 +1,25 @@ +// Delete a GitHub Costs integration account returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GitHubCostsIntegrationApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.deleteGitHubCostsIntegrationAccount", true); + GitHubCostsIntegrationApi apiInstance = new GitHubCostsIntegrationApi(defaultClient); + + try { + apiInstance.deleteGitHubCostsIntegrationAccount("account_id"); + } catch (ApiException e) { + System.err.println( + "Exception when calling GitHubCostsIntegrationApi#deleteGitHubCostsIntegrationAccount"); + 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/github-costs-integration/GetGitHubCostsIntegrationAccount.java b/examples/v2/github-costs-integration/GetGitHubCostsIntegrationAccount.java new file mode 100644 index 00000000000..5b47bfca2ad --- /dev/null +++ b/examples/v2/github-costs-integration/GetGitHubCostsIntegrationAccount.java @@ -0,0 +1,28 @@ +// Get a GitHub Costs integration account returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GitHubCostsIntegrationApi; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getGitHubCostsIntegrationAccount", true); + GitHubCostsIntegrationApi apiInstance = new GitHubCostsIntegrationApi(defaultClient); + + try { + GitHubCostsIntegrationAccountResponse result = + apiInstance.getGitHubCostsIntegrationAccount("account_id"); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GitHubCostsIntegrationApi#getGitHubCostsIntegrationAccount"); + 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/github-costs-integration/ListGitHubCostsIntegrationAccounts.java b/examples/v2/github-costs-integration/ListGitHubCostsIntegrationAccounts.java new file mode 100644 index 00000000000..60da4c22c17 --- /dev/null +++ b/examples/v2/github-costs-integration/ListGitHubCostsIntegrationAccounts.java @@ -0,0 +1,28 @@ +// List GitHub Costs integration accounts returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GitHubCostsIntegrationApi; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.listGitHubCostsIntegrationAccounts", true); + GitHubCostsIntegrationApi apiInstance = new GitHubCostsIntegrationApi(defaultClient); + + try { + GitHubCostsIntegrationAccountsResponse result = + apiInstance.listGitHubCostsIntegrationAccounts(); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GitHubCostsIntegrationApi#listGitHubCostsIntegrationAccounts"); + 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/github-costs-integration/UpdateGitHubCostsIntegrationAccount.java b/examples/v2/github-costs-integration/UpdateGitHubCostsIntegrationAccount.java new file mode 100644 index 00000000000..a4136dd2daf --- /dev/null +++ b/examples/v2/github-costs-integration/UpdateGitHubCostsIntegrationAccount.java @@ -0,0 +1,57 @@ +// Update a GitHub Costs integration account returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.GitHubCostsIntegrationApi; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountAuthenticationUpdate; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountBearerTokenAuthType; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountBearerTokenAuthUpdate; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountResponse; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountSettingsUpdate; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountUpdateAttributes; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountUpdateData; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountUpdateRequest; +import com.datadog.api.client.v2.model.IntegrationAccountType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.updateGitHubCostsIntegrationAccount", true); + GitHubCostsIntegrationApi apiInstance = new GitHubCostsIntegrationApi(defaultClient); + + GitHubCostsIntegrationAccountUpdateRequest body = + new GitHubCostsIntegrationAccountUpdateRequest() + .data( + new GitHubCostsIntegrationAccountUpdateData() + .attributes( + new GitHubCostsIntegrationAccountUpdateAttributes() + .authentication( + new GitHubCostsIntegrationAccountAuthenticationUpdate( + new GitHubCostsIntegrationAccountBearerTokenAuthUpdate() + .authType( + GitHubCostsIntegrationAccountBearerTokenAuthType + .BEARER_TOKEN) + .token("your-token"))) + .name("github-costs-acme") + .settings( + new GitHubCostsIntegrationAccountSettingsUpdate() + .enterpriseName("enterprise-name") + .tags("env:prod,team:example"))) + .id("5f1a8d3c-7e2b-4f9a-b6c4-8d0e3a7f1b52") + .type(IntegrationAccountType.INTEGRATION_ACCOUNT)); + + try { + GitHubCostsIntegrationAccountResponse result = + apiInstance.updateGitHubCostsIntegrationAccount("account_id", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling GitHubCostsIntegrationApi#updateGitHubCostsIntegrationAccount"); + 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/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 35b6595954d..759d8092db7 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1581,6 +1581,11 @@ public class ApiClient { put("v2.getElasticCloudIntegrationAccount", false); put("v2.listElasticCloudIntegrationAccounts", false); put("v2.updateElasticCloudIntegrationAccount", false); + put("v2.createGitHubCostsIntegrationAccount", false); + put("v2.deleteGitHubCostsIntegrationAccount", false); + put("v2.getGitHubCostsIntegrationAccount", false); + put("v2.listGitHubCostsIntegrationAccounts", false); + put("v2.updateGitHubCostsIntegrationAccount", false); put("v2.createNebiusCloudIntegrationAccount", false); put("v2.deleteNebiusCloudIntegrationAccount", false); put("v2.getNebiusCloudIntegrationAccount", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/GitHubCostsIntegrationApi.java b/src/main/java/com/datadog/api/client/v2/api/GitHubCostsIntegrationApi.java new file mode 100644 index 00000000000..e3ebf5cb473 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/GitHubCostsIntegrationApi.java @@ -0,0 +1,849 @@ +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.GitHubCostsIntegrationAccountCreateRequest; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountResponse; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountUpdateRequest; +import com.datadog.api.client.v2.model.GitHubCostsIntegrationAccountsResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +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 GitHubCostsIntegrationApi { + private ApiClient apiClient; + + public GitHubCostsIntegrationApi() { + this(ApiClient.getDefaultApiClient()); + } + + public GitHubCostsIntegrationApi(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 a GitHub Costs integration account. + * + *

See {@link #createGitHubCostsIntegrationAccountWithHttpInfo}. + * + * @param body (required) + * @return GitHubCostsIntegrationAccountResponse + * @throws ApiException if fails to make API call + */ + public GitHubCostsIntegrationAccountResponse createGitHubCostsIntegrationAccount( + GitHubCostsIntegrationAccountCreateRequest body) throws ApiException { + return createGitHubCostsIntegrationAccountWithHttpInfo(body).getData(); + } + + /** + * Create a GitHub Costs integration account. + * + *

See {@link #createGitHubCostsIntegrationAccountWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<GitHubCostsIntegrationAccountResponse> + */ + public CompletableFuture + createGitHubCostsIntegrationAccountAsync(GitHubCostsIntegrationAccountCreateRequest body) { + return createGitHubCostsIntegrationAccountWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a GitHub Costs integration account. + * + * @param body (required) + * @return ApiResponse<GitHubCostsIntegrationAccountResponse> + * @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 -
404 Not Found -
422 The server cannot process the request because it contains invalid data. -
429 Too many requests -
+ */ + public ApiResponse + createGitHubCostsIntegrationAccountWithHttpInfo( + GitHubCostsIntegrationAccountCreateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createGitHubCostsIntegrationAccount"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling createGitHubCostsIntegrationAccount"); + } + // create path and map variables + String localVarPath = "/api/v2/integration-interfaces/github-costs/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GitHubCostsIntegrationApi.createGitHubCostsIntegrationAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a GitHub Costs integration account. + * + *

See {@link #createGitHubCostsIntegrationAccountWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<GitHubCostsIntegrationAccountResponse>> + */ + public CompletableFuture> + createGitHubCostsIntegrationAccountWithHttpInfoAsync( + GitHubCostsIntegrationAccountCreateRequest body) { + // Check if unstable operation is enabled + String operationId = "createGitHubCostsIntegrationAccount"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + 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" + + " createGitHubCostsIntegrationAccount")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/integration-interfaces/github-costs/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GitHubCostsIntegrationApi.createGitHubCostsIntegrationAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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 a GitHub Costs integration account. + * + *

See {@link #deleteGitHubCostsIntegrationAccountWithHttpInfo}. + * + * @param accountId Unique identifier of the integration account. (required) + * @throws ApiException if fails to make API call + */ + public void deleteGitHubCostsIntegrationAccount(String accountId) throws ApiException { + deleteGitHubCostsIntegrationAccountWithHttpInfo(accountId); + } + + /** + * Delete a GitHub Costs integration account. + * + *

See {@link #deleteGitHubCostsIntegrationAccountWithHttpInfoAsync}. + * + * @param accountId Unique identifier of the integration account. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteGitHubCostsIntegrationAccountAsync(String accountId) { + return deleteGitHubCostsIntegrationAccountWithHttpInfoAsync(accountId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete a GitHub Costs integration account. + * + * @param accountId Unique identifier of the integration account. (required) + * @return ApiResponse<Void> + * @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 -
429 Too many requests -
+ */ + public ApiResponse deleteGitHubCostsIntegrationAccountWithHttpInfo(String accountId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteGitHubCostsIntegrationAccount"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'accountId' when calling" + + " deleteGitHubCostsIntegrationAccount"); + } + // create path and map variables + String localVarPath = + "/api/v2/integration-interfaces/github-costs/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GitHubCostsIntegrationApi.deleteGitHubCostsIntegrationAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete a GitHub Costs integration account. + * + *

See {@link #deleteGitHubCostsIntegrationAccountWithHttpInfo}. + * + * @param accountId Unique identifier of the integration account. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteGitHubCostsIntegrationAccountWithHttpInfoAsync( + String accountId) { + // Check if unstable operation is enabled + String operationId = "deleteGitHubCostsIntegrationAccount"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'accountId' is set + if (accountId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'accountId' when calling" + + " deleteGitHubCostsIntegrationAccount")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/integration-interfaces/github-costs/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GitHubCostsIntegrationApi.deleteGitHubCostsIntegrationAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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); + } + + /** + * Get a GitHub Costs integration account. + * + *

See {@link #getGitHubCostsIntegrationAccountWithHttpInfo}. + * + * @param accountId Unique identifier of the integration account. (required) + * @return GitHubCostsIntegrationAccountResponse + * @throws ApiException if fails to make API call + */ + public GitHubCostsIntegrationAccountResponse getGitHubCostsIntegrationAccount(String accountId) + throws ApiException { + return getGitHubCostsIntegrationAccountWithHttpInfo(accountId).getData(); + } + + /** + * Get a GitHub Costs integration account. + * + *

See {@link #getGitHubCostsIntegrationAccountWithHttpInfoAsync}. + * + * @param accountId Unique identifier of the integration account. (required) + * @return CompletableFuture<GitHubCostsIntegrationAccountResponse> + */ + public CompletableFuture + getGitHubCostsIntegrationAccountAsync(String accountId) { + return getGitHubCostsIntegrationAccountWithHttpInfoAsync(accountId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a GitHub Costs integration account. + * + * @param accountId Unique identifier of the integration account. (required) + * @return ApiResponse<GitHubCostsIntegrationAccountResponse> + * @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 -
429 Too many requests -
+ */ + public ApiResponse + getGitHubCostsIntegrationAccountWithHttpInfo(String accountId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getGitHubCostsIntegrationAccount"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'accountId' when calling" + + " getGitHubCostsIntegrationAccount"); + } + // create path and map variables + String localVarPath = + "/api/v2/integration-interfaces/github-costs/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GitHubCostsIntegrationApi.getGitHubCostsIntegrationAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a GitHub Costs integration account. + * + *

See {@link #getGitHubCostsIntegrationAccountWithHttpInfo}. + * + * @param accountId Unique identifier of the integration account. (required) + * @return CompletableFuture<ApiResponse<GitHubCostsIntegrationAccountResponse>> + */ + public CompletableFuture> + getGitHubCostsIntegrationAccountWithHttpInfoAsync(String accountId) { + // Check if unstable operation is enabled + String operationId = "getGitHubCostsIntegrationAccount"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'accountId' is set + if (accountId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'accountId' when calling" + + " getGitHubCostsIntegrationAccount")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/integration-interfaces/github-costs/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GitHubCostsIntegrationApi.getGitHubCostsIntegrationAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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() {}); + } + + /** + * List GitHub Costs integration accounts. + * + *

See {@link #listGitHubCostsIntegrationAccountsWithHttpInfo}. + * + * @return GitHubCostsIntegrationAccountsResponse + * @throws ApiException if fails to make API call + */ + public GitHubCostsIntegrationAccountsResponse listGitHubCostsIntegrationAccounts() + throws ApiException { + return listGitHubCostsIntegrationAccountsWithHttpInfo().getData(); + } + + /** + * List GitHub Costs integration accounts. + * + *

See {@link #listGitHubCostsIntegrationAccountsWithHttpInfoAsync}. + * + * @return CompletableFuture<GitHubCostsIntegrationAccountsResponse> + */ + public CompletableFuture + listGitHubCostsIntegrationAccountsAsync() { + return listGitHubCostsIntegrationAccountsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List GitHub Costs integration accounts. + * + * @return ApiResponse<GitHubCostsIntegrationAccountsResponse> + * @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 -
429 Too many requests -
+ */ + public ApiResponse + listGitHubCostsIntegrationAccountsWithHttpInfo() throws ApiException { + // Check if unstable operation is enabled + String operationId = "listGitHubCostsIntegrationAccounts"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/integration-interfaces/github-costs/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GitHubCostsIntegrationApi.listGitHubCostsIntegrationAccounts", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List GitHub Costs integration accounts. + * + *

See {@link #listGitHubCostsIntegrationAccountsWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<GitHubCostsIntegrationAccountsResponse>> + */ + public CompletableFuture> + listGitHubCostsIntegrationAccountsWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "listGitHubCostsIntegrationAccounts"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/integration-interfaces/github-costs/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GitHubCostsIntegrationApi.listGitHubCostsIntegrationAccounts", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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 a GitHub Costs integration account. + * + *

See {@link #updateGitHubCostsIntegrationAccountWithHttpInfo}. + * + * @param accountId Unique identifier of the integration account. (required) + * @param body (required) + * @return GitHubCostsIntegrationAccountResponse + * @throws ApiException if fails to make API call + */ + public GitHubCostsIntegrationAccountResponse updateGitHubCostsIntegrationAccount( + String accountId, GitHubCostsIntegrationAccountUpdateRequest body) throws ApiException { + return updateGitHubCostsIntegrationAccountWithHttpInfo(accountId, body).getData(); + } + + /** + * Update a GitHub Costs integration account. + * + *

See {@link #updateGitHubCostsIntegrationAccountWithHttpInfoAsync}. + * + * @param accountId Unique identifier of the integration account. (required) + * @param body (required) + * @return CompletableFuture<GitHubCostsIntegrationAccountResponse> + */ + public CompletableFuture + updateGitHubCostsIntegrationAccountAsync( + String accountId, GitHubCostsIntegrationAccountUpdateRequest body) { + return updateGitHubCostsIntegrationAccountWithHttpInfoAsync(accountId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update a GitHub Costs integration account. Only the fields provided are changed. + * + * @param accountId Unique identifier of the integration account. (required) + * @param body (required) + * @return ApiResponse<GitHubCostsIntegrationAccountResponse> + * @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 -
422 The server cannot process the request because it contains invalid data. -
429 Too many requests -
+ */ + public ApiResponse + updateGitHubCostsIntegrationAccountWithHttpInfo( + String accountId, GitHubCostsIntegrationAccountUpdateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateGitHubCostsIntegrationAccount"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'accountId' when calling" + + " updateGitHubCostsIntegrationAccount"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling updateGitHubCostsIntegrationAccount"); + } + // create path and map variables + String localVarPath = + "/api/v2/integration-interfaces/github-costs/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.GitHubCostsIntegrationApi.updateGitHubCostsIntegrationAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a GitHub Costs integration account. + * + *

See {@link #updateGitHubCostsIntegrationAccountWithHttpInfo}. + * + * @param accountId Unique identifier of the integration account. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<GitHubCostsIntegrationAccountResponse>> + */ + public CompletableFuture> + updateGitHubCostsIntegrationAccountWithHttpInfoAsync( + String accountId, GitHubCostsIntegrationAccountUpdateRequest body) { + // Check if unstable operation is enabled + String operationId = "updateGitHubCostsIntegrationAccount"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'accountId' is set + if (accountId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'accountId' when calling" + + " updateGitHubCostsIntegrationAccount")); + 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" + + " updateGitHubCostsIntegrationAccount")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/integration-interfaces/github-costs/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.GitHubCostsIntegrationApi.updateGitHubCostsIntegrationAccount", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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/GitHubCostsCloudCostMetricsIntegrationDataflowResponse.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsCloudCostMetricsIntegrationDataflowResponse.java new file mode 100644 index 00000000000..400fda8bfe6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsCloudCostMetricsIntegrationDataflowResponse.java @@ -0,0 +1,164 @@ +/* + * 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; + +/** + * GitHub costs, including Actions, storage, and Copilot, which you can analyze in Cloud Cost Management. Reported + * costs are estimates based on list prices and usage data and include discounts when available, but + * not negotiated rates. Requires Cloud Cost Management on your Datadog organization and a GitHub + * account on the enhanced billing platform. Without them, this dataflow collects no data. This + * dataflow is always on and cannot be turned off, so it appears in responses only. + */ +@JsonPropertyOrder({ + GitHubCostsCloudCostMetricsIntegrationDataflowResponse.JSON_PROPERTY_ENABLED, + GitHubCostsCloudCostMetricsIntegrationDataflowResponse.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsCloudCostMetricsIntegrationDataflowResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_STATUS = "status"; + private IntegrationAccountDataflowStatus status; + + /** + * Whether Datadog collects this data. Always true, because this collection cannot be + * turned off. + * + * @return enabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getEnabled() { + return enabled; + } + + /** + * Read-only collection status of a dataflow. + * + * @return status + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IntegrationAccountDataflowStatus getStatus() { + return status; + } + + /** + * 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 GitHubCostsCloudCostMetricsIntegrationDataflowResponse + */ + @JsonAnySetter + public GitHubCostsCloudCostMetricsIntegrationDataflowResponse 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 GitHubCostsCloudCostMetricsIntegrationDataflowResponse object is equal to + * o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsCloudCostMetricsIntegrationDataflowResponse + gitHubCostsCloudCostMetricsIntegrationDataflowResponse = + (GitHubCostsCloudCostMetricsIntegrationDataflowResponse) o; + return Objects.equals( + this.enabled, gitHubCostsCloudCostMetricsIntegrationDataflowResponse.enabled) + && Objects.equals( + this.status, gitHubCostsCloudCostMetricsIntegrationDataflowResponse.status) + && Objects.equals( + this.additionalProperties, + gitHubCostsCloudCostMetricsIntegrationDataflowResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsCloudCostMetricsIntegrationDataflowResponse {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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/GitHubCostsIntegrationAccountAuthenticationRequest.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountAuthenticationRequest.java new file mode 100644 index 00000000000..e09b60df501 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountAuthenticationRequest.java @@ -0,0 +1,248 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = + GitHubCostsIntegrationAccountAuthenticationRequest + .GitHubCostsIntegrationAccountAuthenticationRequestDeserializer.class) +@JsonSerialize( + using = + GitHubCostsIntegrationAccountAuthenticationRequest + .GitHubCostsIntegrationAccountAuthenticationRequestSerializer.class) +public class GitHubCostsIntegrationAccountAuthenticationRequest extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(GitHubCostsIntegrationAccountAuthenticationRequest.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GitHubCostsIntegrationAccountAuthenticationRequestSerializer + extends StdSerializer { + public GitHubCostsIntegrationAccountAuthenticationRequestSerializer( + Class t) { + super(t); + } + + public GitHubCostsIntegrationAccountAuthenticationRequestSerializer() { + this(null); + } + + @Override + public void serialize( + GitHubCostsIntegrationAccountAuthenticationRequest value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GitHubCostsIntegrationAccountAuthenticationRequestDeserializer + extends StdDeserializer { + public GitHubCostsIntegrationAccountAuthenticationRequestDeserializer() { + this(GitHubCostsIntegrationAccountAuthenticationRequest.class); + } + + public GitHubCostsIntegrationAccountAuthenticationRequestDeserializer(Class vc) { + super(vc); + } + + @Override + public GitHubCostsIntegrationAccountAuthenticationRequest deserialize( + JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GitHubCostsIntegrationAccountBearerTokenAuthRequest + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GitHubCostsIntegrationAccountBearerTokenAuthRequest.class.equals(Integer.class) + || GitHubCostsIntegrationAccountBearerTokenAuthRequest.class.equals(Long.class) + || GitHubCostsIntegrationAccountBearerTokenAuthRequest.class.equals(Float.class) + || GitHubCostsIntegrationAccountBearerTokenAuthRequest.class.equals(Double.class) + || GitHubCostsIntegrationAccountBearerTokenAuthRequest.class.equals(Boolean.class) + || GitHubCostsIntegrationAccountBearerTokenAuthRequest.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GitHubCostsIntegrationAccountBearerTokenAuthRequest.class.equals(Integer.class) + || GitHubCostsIntegrationAccountBearerTokenAuthRequest.class.equals( + Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GitHubCostsIntegrationAccountBearerTokenAuthRequest.class.equals(Float.class) + || GitHubCostsIntegrationAccountBearerTokenAuthRequest.class.equals( + Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GitHubCostsIntegrationAccountBearerTokenAuthRequest.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GitHubCostsIntegrationAccountBearerTokenAuthRequest.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(GitHubCostsIntegrationAccountBearerTokenAuthRequest.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GitHubCostsIntegrationAccountBearerTokenAuthRequest) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema 'GitHubCostsIntegrationAccountBearerTokenAuthRequest'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema" + + " 'GitHubCostsIntegrationAccountBearerTokenAuthRequest'", + e); + } + + GitHubCostsIntegrationAccountAuthenticationRequest ret = + new GitHubCostsIntegrationAccountAuthenticationRequest(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GitHubCostsIntegrationAccountAuthenticationRequest getNullValue( + DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "GitHubCostsIntegrationAccountAuthenticationRequest cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GitHubCostsIntegrationAccountAuthenticationRequest() { + super("oneOf", Boolean.FALSE); + } + + public GitHubCostsIntegrationAccountAuthenticationRequest( + GitHubCostsIntegrationAccountBearerTokenAuthRequest o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "GitHubCostsIntegrationAccountBearerTokenAuthRequest", + new GenericType() {}); + JSON.registerDescendants( + GitHubCostsIntegrationAccountAuthenticationRequest.class, + Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GitHubCostsIntegrationAccountAuthenticationRequest.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GitHubCostsIntegrationAccountBearerTokenAuthRequest + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf( + GitHubCostsIntegrationAccountBearerTokenAuthRequest.class, + instance, + new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be GitHubCostsIntegrationAccountBearerTokenAuthRequest"); + } + + /** + * Get the actual instance, which can be the following: + * GitHubCostsIntegrationAccountBearerTokenAuthRequest + * + * @return The actual instance (GitHubCostsIntegrationAccountBearerTokenAuthRequest) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GitHubCostsIntegrationAccountBearerTokenAuthRequest`. If the actual + * instance is not `GitHubCostsIntegrationAccountBearerTokenAuthRequest`, the ClassCastException + * will be thrown. + * + * @return The actual instance of `GitHubCostsIntegrationAccountBearerTokenAuthRequest` + * @throws ClassCastException if the instance is not + * `GitHubCostsIntegrationAccountBearerTokenAuthRequest` + */ + public GitHubCostsIntegrationAccountBearerTokenAuthRequest + getGitHubCostsIntegrationAccountBearerTokenAuthRequest() throws ClassCastException { + return (GitHubCostsIntegrationAccountBearerTokenAuthRequest) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountAuthenticationResponse.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountAuthenticationResponse.java new file mode 100644 index 00000000000..65a1af3e4a8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountAuthenticationResponse.java @@ -0,0 +1,248 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = + GitHubCostsIntegrationAccountAuthenticationResponse + .GitHubCostsIntegrationAccountAuthenticationResponseDeserializer.class) +@JsonSerialize( + using = + GitHubCostsIntegrationAccountAuthenticationResponse + .GitHubCostsIntegrationAccountAuthenticationResponseSerializer.class) +public class GitHubCostsIntegrationAccountAuthenticationResponse extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(GitHubCostsIntegrationAccountAuthenticationResponse.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GitHubCostsIntegrationAccountAuthenticationResponseSerializer + extends StdSerializer { + public GitHubCostsIntegrationAccountAuthenticationResponseSerializer( + Class t) { + super(t); + } + + public GitHubCostsIntegrationAccountAuthenticationResponseSerializer() { + this(null); + } + + @Override + public void serialize( + GitHubCostsIntegrationAccountAuthenticationResponse value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GitHubCostsIntegrationAccountAuthenticationResponseDeserializer + extends StdDeserializer { + public GitHubCostsIntegrationAccountAuthenticationResponseDeserializer() { + this(GitHubCostsIntegrationAccountAuthenticationResponse.class); + } + + public GitHubCostsIntegrationAccountAuthenticationResponseDeserializer(Class vc) { + super(vc); + } + + @Override + public GitHubCostsIntegrationAccountAuthenticationResponse deserialize( + JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GitHubCostsIntegrationAccountBearerTokenAuthResponse + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GitHubCostsIntegrationAccountBearerTokenAuthResponse.class.equals(Integer.class) + || GitHubCostsIntegrationAccountBearerTokenAuthResponse.class.equals(Long.class) + || GitHubCostsIntegrationAccountBearerTokenAuthResponse.class.equals(Float.class) + || GitHubCostsIntegrationAccountBearerTokenAuthResponse.class.equals(Double.class) + || GitHubCostsIntegrationAccountBearerTokenAuthResponse.class.equals(Boolean.class) + || GitHubCostsIntegrationAccountBearerTokenAuthResponse.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GitHubCostsIntegrationAccountBearerTokenAuthResponse.class.equals(Integer.class) + || GitHubCostsIntegrationAccountBearerTokenAuthResponse.class.equals( + Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GitHubCostsIntegrationAccountBearerTokenAuthResponse.class.equals(Float.class) + || GitHubCostsIntegrationAccountBearerTokenAuthResponse.class.equals( + Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GitHubCostsIntegrationAccountBearerTokenAuthResponse.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GitHubCostsIntegrationAccountBearerTokenAuthResponse.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(GitHubCostsIntegrationAccountBearerTokenAuthResponse.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GitHubCostsIntegrationAccountBearerTokenAuthResponse) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema 'GitHubCostsIntegrationAccountBearerTokenAuthResponse'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema" + + " 'GitHubCostsIntegrationAccountBearerTokenAuthResponse'", + e); + } + + GitHubCostsIntegrationAccountAuthenticationResponse ret = + new GitHubCostsIntegrationAccountAuthenticationResponse(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GitHubCostsIntegrationAccountAuthenticationResponse getNullValue( + DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "GitHubCostsIntegrationAccountAuthenticationResponse cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GitHubCostsIntegrationAccountAuthenticationResponse() { + super("oneOf", Boolean.FALSE); + } + + public GitHubCostsIntegrationAccountAuthenticationResponse( + GitHubCostsIntegrationAccountBearerTokenAuthResponse o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "GitHubCostsIntegrationAccountBearerTokenAuthResponse", + new GenericType() {}); + JSON.registerDescendants( + GitHubCostsIntegrationAccountAuthenticationResponse.class, + Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GitHubCostsIntegrationAccountAuthenticationResponse.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GitHubCostsIntegrationAccountBearerTokenAuthResponse + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf( + GitHubCostsIntegrationAccountBearerTokenAuthResponse.class, + instance, + new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be GitHubCostsIntegrationAccountBearerTokenAuthResponse"); + } + + /** + * Get the actual instance, which can be the following: + * GitHubCostsIntegrationAccountBearerTokenAuthResponse + * + * @return The actual instance (GitHubCostsIntegrationAccountBearerTokenAuthResponse) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GitHubCostsIntegrationAccountBearerTokenAuthResponse`. If the + * actual instance is not `GitHubCostsIntegrationAccountBearerTokenAuthResponse`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `GitHubCostsIntegrationAccountBearerTokenAuthResponse` + * @throws ClassCastException if the instance is not + * `GitHubCostsIntegrationAccountBearerTokenAuthResponse` + */ + public GitHubCostsIntegrationAccountBearerTokenAuthResponse + getGitHubCostsIntegrationAccountBearerTokenAuthResponse() throws ClassCastException { + return (GitHubCostsIntegrationAccountBearerTokenAuthResponse) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountAuthenticationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountAuthenticationUpdate.java new file mode 100644 index 00000000000..a430734cdb3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountAuthenticationUpdate.java @@ -0,0 +1,247 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = + GitHubCostsIntegrationAccountAuthenticationUpdate + .GitHubCostsIntegrationAccountAuthenticationUpdateDeserializer.class) +@JsonSerialize( + using = + GitHubCostsIntegrationAccountAuthenticationUpdate + .GitHubCostsIntegrationAccountAuthenticationUpdateSerializer.class) +public class GitHubCostsIntegrationAccountAuthenticationUpdate extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(GitHubCostsIntegrationAccountAuthenticationUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class GitHubCostsIntegrationAccountAuthenticationUpdateSerializer + extends StdSerializer { + public GitHubCostsIntegrationAccountAuthenticationUpdateSerializer( + Class t) { + super(t); + } + + public GitHubCostsIntegrationAccountAuthenticationUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + GitHubCostsIntegrationAccountAuthenticationUpdate value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GitHubCostsIntegrationAccountAuthenticationUpdateDeserializer + extends StdDeserializer { + public GitHubCostsIntegrationAccountAuthenticationUpdateDeserializer() { + this(GitHubCostsIntegrationAccountAuthenticationUpdate.class); + } + + public GitHubCostsIntegrationAccountAuthenticationUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public GitHubCostsIntegrationAccountAuthenticationUpdate deserialize( + JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize GitHubCostsIntegrationAccountBearerTokenAuthUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GitHubCostsIntegrationAccountBearerTokenAuthUpdate.class.equals(Integer.class) + || GitHubCostsIntegrationAccountBearerTokenAuthUpdate.class.equals(Long.class) + || GitHubCostsIntegrationAccountBearerTokenAuthUpdate.class.equals(Float.class) + || GitHubCostsIntegrationAccountBearerTokenAuthUpdate.class.equals(Double.class) + || GitHubCostsIntegrationAccountBearerTokenAuthUpdate.class.equals(Boolean.class) + || GitHubCostsIntegrationAccountBearerTokenAuthUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((GitHubCostsIntegrationAccountBearerTokenAuthUpdate.class.equals(Integer.class) + || GitHubCostsIntegrationAccountBearerTokenAuthUpdate.class.equals( + Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((GitHubCostsIntegrationAccountBearerTokenAuthUpdate.class.equals(Float.class) + || GitHubCostsIntegrationAccountBearerTokenAuthUpdate.class.equals( + Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (GitHubCostsIntegrationAccountBearerTokenAuthUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (GitHubCostsIntegrationAccountBearerTokenAuthUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(GitHubCostsIntegrationAccountBearerTokenAuthUpdate.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((GitHubCostsIntegrationAccountBearerTokenAuthUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema 'GitHubCostsIntegrationAccountBearerTokenAuthUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'GitHubCostsIntegrationAccountBearerTokenAuthUpdate'", + e); + } + + GitHubCostsIntegrationAccountAuthenticationUpdate ret = + new GitHubCostsIntegrationAccountAuthenticationUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public GitHubCostsIntegrationAccountAuthenticationUpdate getNullValue( + DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "GitHubCostsIntegrationAccountAuthenticationUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public GitHubCostsIntegrationAccountAuthenticationUpdate() { + super("oneOf", Boolean.FALSE); + } + + public GitHubCostsIntegrationAccountAuthenticationUpdate( + GitHubCostsIntegrationAccountBearerTokenAuthUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "GitHubCostsIntegrationAccountBearerTokenAuthUpdate", + new GenericType() {}); + JSON.registerDescendants( + GitHubCostsIntegrationAccountAuthenticationUpdate.class, + Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return GitHubCostsIntegrationAccountAuthenticationUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: GitHubCostsIntegrationAccountBearerTokenAuthUpdate + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf( + GitHubCostsIntegrationAccountBearerTokenAuthUpdate.class, + instance, + new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be GitHubCostsIntegrationAccountBearerTokenAuthUpdate"); + } + + /** + * Get the actual instance, which can be the following: + * GitHubCostsIntegrationAccountBearerTokenAuthUpdate + * + * @return The actual instance (GitHubCostsIntegrationAccountBearerTokenAuthUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `GitHubCostsIntegrationAccountBearerTokenAuthUpdate`. If the actual + * instance is not `GitHubCostsIntegrationAccountBearerTokenAuthUpdate`, the ClassCastException + * will be thrown. + * + * @return The actual instance of `GitHubCostsIntegrationAccountBearerTokenAuthUpdate` + * @throws ClassCastException if the instance is not + * `GitHubCostsIntegrationAccountBearerTokenAuthUpdate` + */ + public GitHubCostsIntegrationAccountBearerTokenAuthUpdate + getGitHubCostsIntegrationAccountBearerTokenAuthUpdate() throws ClassCastException { + return (GitHubCostsIntegrationAccountBearerTokenAuthUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountBearerTokenAuthRequest.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountBearerTokenAuthRequest.java new file mode 100644 index 00000000000..4d981a9b709 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountBearerTokenAuthRequest.java @@ -0,0 +1,139 @@ +/* + * 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.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.Objects; + +/** + * Bearer token authentication. Use the token type that matches settings.enterprise_name + * : a classic personal access token for an enterprise, or a fine-grained personal access + * token for an organization. + */ +@JsonPropertyOrder({ + GitHubCostsIntegrationAccountBearerTokenAuthRequest.JSON_PROPERTY_AUTH_TYPE, + GitHubCostsIntegrationAccountBearerTokenAuthRequest.JSON_PROPERTY_TOKEN +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountBearerTokenAuthRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTH_TYPE = "auth_type"; + private GitHubCostsIntegrationAccountBearerTokenAuthType authType = + GitHubCostsIntegrationAccountBearerTokenAuthType.BEARER_TOKEN; + + public static final String JSON_PROPERTY_TOKEN = "token"; + private String token; + + public GitHubCostsIntegrationAccountBearerTokenAuthRequest() {} + + @JsonCreator + public GitHubCostsIntegrationAccountBearerTokenAuthRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_AUTH_TYPE) + GitHubCostsIntegrationAccountBearerTokenAuthType authType, + @JsonProperty(required = true, value = JSON_PROPERTY_TOKEN) String token) { + this.authType = authType; + this.unparsed |= !authType.isValid(); + this.token = token; + } + + public GitHubCostsIntegrationAccountBearerTokenAuthRequest authType( + GitHubCostsIntegrationAccountBearerTokenAuthType authType) { + this.authType = authType; + this.unparsed |= !authType.isValid(); + return this; + } + + /** + * The authentication method type. + * + * @return authType + */ + @JsonProperty(JSON_PROPERTY_AUTH_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitHubCostsIntegrationAccountBearerTokenAuthType getAuthType() { + return authType; + } + + public void setAuthType(GitHubCostsIntegrationAccountBearerTokenAuthType authType) { + if (!authType.isValid()) { + this.unparsed = true; + } + this.authType = authType; + } + + public GitHubCostsIntegrationAccountBearerTokenAuthRequest token(String token) { + this.token = token; + return this; + } + + /** + * For an enterprise, a personal access token (classic) from an Enterprise Admin user with the + * manage_billing:enterprise and read:org scopes. For an organization, a + * fine-grained personal access token owned by that organization and created by an organization + * owner, with the Administration organization permission set to read-only. + * + * @return token + */ + @JsonProperty(JSON_PROPERTY_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + /** + * Return true if this GitHubCostsIntegrationAccountBearerTokenAuthRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountBearerTokenAuthRequest + gitHubCostsIntegrationAccountBearerTokenAuthRequest = + (GitHubCostsIntegrationAccountBearerTokenAuthRequest) o; + return Objects.equals( + this.authType, gitHubCostsIntegrationAccountBearerTokenAuthRequest.authType) + && Objects.equals(this.token, gitHubCostsIntegrationAccountBearerTokenAuthRequest.token); + } + + @Override + public int hashCode() { + return Objects.hash(authType, token); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountBearerTokenAuthRequest {\n"); + sb.append(" authType: ").append(toIndentedString(authType)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).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/GitHubCostsIntegrationAccountBearerTokenAuthResponse.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountBearerTokenAuthResponse.java new file mode 100644 index 00000000000..271f0f91de9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountBearerTokenAuthResponse.java @@ -0,0 +1,159 @@ +/* + * 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; + +/** The bearer token authentication method configured on the account. */ +@JsonPropertyOrder({GitHubCostsIntegrationAccountBearerTokenAuthResponse.JSON_PROPERTY_AUTH_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountBearerTokenAuthResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTH_TYPE = "auth_type"; + private GitHubCostsIntegrationAccountBearerTokenAuthType authType = + GitHubCostsIntegrationAccountBearerTokenAuthType.BEARER_TOKEN; + + public GitHubCostsIntegrationAccountBearerTokenAuthResponse() {} + + @JsonCreator + public GitHubCostsIntegrationAccountBearerTokenAuthResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_AUTH_TYPE) + GitHubCostsIntegrationAccountBearerTokenAuthType authType) { + this.authType = authType; + this.unparsed |= !authType.isValid(); + } + + public GitHubCostsIntegrationAccountBearerTokenAuthResponse authType( + GitHubCostsIntegrationAccountBearerTokenAuthType authType) { + this.authType = authType; + this.unparsed |= !authType.isValid(); + return this; + } + + /** + * The authentication method type. + * + * @return authType + */ + @JsonProperty(JSON_PROPERTY_AUTH_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitHubCostsIntegrationAccountBearerTokenAuthType getAuthType() { + return authType; + } + + public void setAuthType(GitHubCostsIntegrationAccountBearerTokenAuthType authType) { + if (!authType.isValid()) { + this.unparsed = true; + } + this.authType = authType; + } + + /** + * 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 GitHubCostsIntegrationAccountBearerTokenAuthResponse + */ + @JsonAnySetter + public GitHubCostsIntegrationAccountBearerTokenAuthResponse 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 GitHubCostsIntegrationAccountBearerTokenAuthResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountBearerTokenAuthResponse + gitHubCostsIntegrationAccountBearerTokenAuthResponse = + (GitHubCostsIntegrationAccountBearerTokenAuthResponse) o; + return Objects.equals( + this.authType, gitHubCostsIntegrationAccountBearerTokenAuthResponse.authType) + && Objects.equals( + this.additionalProperties, + gitHubCostsIntegrationAccountBearerTokenAuthResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(authType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountBearerTokenAuthResponse {\n"); + sb.append(" authType: ").append(toIndentedString(authType)).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/GitHubCostsIntegrationAccountBearerTokenAuthType.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountBearerTokenAuthType.java new file mode 100644 index 00000000000..ba081716b71 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountBearerTokenAuthType.java @@ -0,0 +1,63 @@ +/* + * 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; + +/** The authentication method type. */ +@JsonSerialize( + using = + GitHubCostsIntegrationAccountBearerTokenAuthType + .GitHubCostsIntegrationAccountBearerTokenAuthTypeSerializer.class) +public class GitHubCostsIntegrationAccountBearerTokenAuthType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("bearer_token")); + + public static final GitHubCostsIntegrationAccountBearerTokenAuthType BEARER_TOKEN = + new GitHubCostsIntegrationAccountBearerTokenAuthType("bearer_token"); + + GitHubCostsIntegrationAccountBearerTokenAuthType(String value) { + super(value, allowedValues); + } + + public static class GitHubCostsIntegrationAccountBearerTokenAuthTypeSerializer + extends StdSerializer { + public GitHubCostsIntegrationAccountBearerTokenAuthTypeSerializer( + Class t) { + super(t); + } + + public GitHubCostsIntegrationAccountBearerTokenAuthTypeSerializer() { + this(null); + } + + @Override + public void serialize( + GitHubCostsIntegrationAccountBearerTokenAuthType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GitHubCostsIntegrationAccountBearerTokenAuthType fromValue(String value) { + return new GitHubCostsIntegrationAccountBearerTokenAuthType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountBearerTokenAuthUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountBearerTokenAuthUpdate.java new file mode 100644 index 00000000000..8452d7ba050 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountBearerTokenAuthUpdate.java @@ -0,0 +1,139 @@ +/* + * 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.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.Objects; + +/** + * Bearer token authentication. Use the token type that matches settings.enterprise_name + * : a classic personal access token for an enterprise, or a fine-grained personal access + * token for an organization. Only the provided fields are changed. To keep the stored token, omit + * token. + */ +@JsonPropertyOrder({ + GitHubCostsIntegrationAccountBearerTokenAuthUpdate.JSON_PROPERTY_AUTH_TYPE, + GitHubCostsIntegrationAccountBearerTokenAuthUpdate.JSON_PROPERTY_TOKEN +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountBearerTokenAuthUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTH_TYPE = "auth_type"; + private GitHubCostsIntegrationAccountBearerTokenAuthType authType = + GitHubCostsIntegrationAccountBearerTokenAuthType.BEARER_TOKEN; + + public static final String JSON_PROPERTY_TOKEN = "token"; + private String token; + + public GitHubCostsIntegrationAccountBearerTokenAuthUpdate() {} + + @JsonCreator + public GitHubCostsIntegrationAccountBearerTokenAuthUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_AUTH_TYPE) + GitHubCostsIntegrationAccountBearerTokenAuthType authType) { + this.authType = authType; + this.unparsed |= !authType.isValid(); + } + + public GitHubCostsIntegrationAccountBearerTokenAuthUpdate authType( + GitHubCostsIntegrationAccountBearerTokenAuthType authType) { + this.authType = authType; + this.unparsed |= !authType.isValid(); + return this; + } + + /** + * The authentication method type. + * + * @return authType + */ + @JsonProperty(JSON_PROPERTY_AUTH_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitHubCostsIntegrationAccountBearerTokenAuthType getAuthType() { + return authType; + } + + public void setAuthType(GitHubCostsIntegrationAccountBearerTokenAuthType authType) { + if (!authType.isValid()) { + this.unparsed = true; + } + this.authType = authType; + } + + public GitHubCostsIntegrationAccountBearerTokenAuthUpdate token(String token) { + this.token = token; + return this; + } + + /** + * For an enterprise, a personal access token (classic) from an Enterprise Admin user with the + * manage_billing:enterprise and read:org scopes. For an organization, a + * fine-grained personal access token owned by that organization and created by an organization + * owner, with the Administration organization permission set to read-only. + * + * @return token + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + /** + * Return true if this GitHubCostsIntegrationAccountBearerTokenAuthUpdate object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountBearerTokenAuthUpdate + gitHubCostsIntegrationAccountBearerTokenAuthUpdate = + (GitHubCostsIntegrationAccountBearerTokenAuthUpdate) o; + return Objects.equals( + this.authType, gitHubCostsIntegrationAccountBearerTokenAuthUpdate.authType) + && Objects.equals(this.token, gitHubCostsIntegrationAccountBearerTokenAuthUpdate.token); + } + + @Override + public int hashCode() { + return Objects.hash(authType, token); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountBearerTokenAuthUpdate {\n"); + sb.append(" authType: ").append(toIndentedString(authType)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).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/GitHubCostsIntegrationAccountCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountCreateAttributes.java new file mode 100644 index 00000000000..b2beb01a457 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountCreateAttributes.java @@ -0,0 +1,220 @@ +/* + * 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; + +/** Writable attributes used to create a GitHub Costs integration account. */ +@JsonPropertyOrder({ + GitHubCostsIntegrationAccountCreateAttributes.JSON_PROPERTY_AUTHENTICATION, + GitHubCostsIntegrationAccountCreateAttributes.JSON_PROPERTY_NAME, + GitHubCostsIntegrationAccountCreateAttributes.JSON_PROPERTY_SETTINGS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountCreateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTHENTICATION = "authentication"; + private GitHubCostsIntegrationAccountAuthenticationRequest authentication; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SETTINGS = "settings"; + private GitHubCostsIntegrationAccountSettingsRequest settings; + + public GitHubCostsIntegrationAccountCreateAttributes() {} + + @JsonCreator + public GitHubCostsIntegrationAccountCreateAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_AUTHENTICATION) + GitHubCostsIntegrationAccountAuthenticationRequest authentication, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_SETTINGS) + GitHubCostsIntegrationAccountSettingsRequest settings) { + this.authentication = authentication; + this.unparsed |= authentication.unparsed; + this.name = name; + this.settings = settings; + this.unparsed |= settings.unparsed; + } + + public GitHubCostsIntegrationAccountCreateAttributes authentication( + GitHubCostsIntegrationAccountAuthenticationRequest authentication) { + this.authentication = authentication; + this.unparsed |= authentication.unparsed; + return this; + } + + /** + * Authentication for creating the GitHub Costs integration account. Exactly one method is set. + * + * @return authentication + */ + @JsonProperty(JSON_PROPERTY_AUTHENTICATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitHubCostsIntegrationAccountAuthenticationRequest getAuthentication() { + return authentication; + } + + public void setAuthentication(GitHubCostsIntegrationAccountAuthenticationRequest authentication) { + this.authentication = authentication; + if (authentication != null) { + this.unparsed |= authentication.unparsed; + } + } + + public GitHubCostsIntegrationAccountCreateAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Human-readable name of the GitHub Costs integration account. + * + * @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 GitHubCostsIntegrationAccountCreateAttributes settings( + GitHubCostsIntegrationAccountSettingsRequest settings) { + this.settings = settings; + this.unparsed |= settings.unparsed; + return this; + } + + /** + * Settings for creating the GitHub Costs integration account. + * + * @return settings + */ + @JsonProperty(JSON_PROPERTY_SETTINGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitHubCostsIntegrationAccountSettingsRequest getSettings() { + return settings; + } + + public void setSettings(GitHubCostsIntegrationAccountSettingsRequest settings) { + this.settings = settings; + if (settings != null) { + this.unparsed |= settings.unparsed; + } + } + + /** + * 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 GitHubCostsIntegrationAccountCreateAttributes + */ + @JsonAnySetter + public GitHubCostsIntegrationAccountCreateAttributes 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 GitHubCostsIntegrationAccountCreateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountCreateAttributes gitHubCostsIntegrationAccountCreateAttributes = + (GitHubCostsIntegrationAccountCreateAttributes) o; + return Objects.equals( + this.authentication, gitHubCostsIntegrationAccountCreateAttributes.authentication) + && Objects.equals(this.name, gitHubCostsIntegrationAccountCreateAttributes.name) + && Objects.equals(this.settings, gitHubCostsIntegrationAccountCreateAttributes.settings) + && Objects.equals( + this.additionalProperties, + gitHubCostsIntegrationAccountCreateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(authentication, name, settings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountCreateAttributes {\n"); + sb.append(" authentication: ").append(toIndentedString(authentication)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).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/GitHubCostsIntegrationAccountCreateData.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountCreateData.java new file mode 100644 index 00000000000..28a4c95db2b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountCreateData.java @@ -0,0 +1,188 @@ +/* + * 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; + +/** Data envelope for creating a GitHub Costs integration account. */ +@JsonPropertyOrder({ + GitHubCostsIntegrationAccountCreateData.JSON_PROPERTY_ATTRIBUTES, + GitHubCostsIntegrationAccountCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GitHubCostsIntegrationAccountCreateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IntegrationAccountType type = IntegrationAccountType.INTEGRATION_ACCOUNT; + + public GitHubCostsIntegrationAccountCreateData() {} + + @JsonCreator + public GitHubCostsIntegrationAccountCreateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + GitHubCostsIntegrationAccountCreateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IntegrationAccountType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GitHubCostsIntegrationAccountCreateData attributes( + GitHubCostsIntegrationAccountCreateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Writable attributes used to create a GitHub Costs integration account. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitHubCostsIntegrationAccountCreateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GitHubCostsIntegrationAccountCreateAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public GitHubCostsIntegrationAccountCreateData type(IntegrationAccountType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the integration account resource. Always integration-account. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IntegrationAccountType getType() { + return type; + } + + public void setType(IntegrationAccountType 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 GitHubCostsIntegrationAccountCreateData + */ + @JsonAnySetter + public GitHubCostsIntegrationAccountCreateData 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 GitHubCostsIntegrationAccountCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountCreateData gitHubCostsIntegrationAccountCreateData = + (GitHubCostsIntegrationAccountCreateData) o; + return Objects.equals(this.attributes, gitHubCostsIntegrationAccountCreateData.attributes) + && Objects.equals(this.type, gitHubCostsIntegrationAccountCreateData.type) + && Objects.equals( + this.additionalProperties, + gitHubCostsIntegrationAccountCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountCreateData {\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/GitHubCostsIntegrationAccountCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountCreateRequest.java new file mode 100644 index 00000000000..e335a782f77 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountCreateRequest.java @@ -0,0 +1,154 @@ +/* + * 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; + +/** Request payload to create a GitHub Costs integration account. */ +@JsonPropertyOrder({GitHubCostsIntegrationAccountCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GitHubCostsIntegrationAccountCreateData data; + + public GitHubCostsIntegrationAccountCreateRequest() {} + + @JsonCreator + public GitHubCostsIntegrationAccountCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + GitHubCostsIntegrationAccountCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public GitHubCostsIntegrationAccountCreateRequest data( + GitHubCostsIntegrationAccountCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data envelope for creating a GitHub Costs integration account. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitHubCostsIntegrationAccountCreateData getData() { + return data; + } + + public void setData(GitHubCostsIntegrationAccountCreateData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 GitHubCostsIntegrationAccountCreateRequest + */ + @JsonAnySetter + public GitHubCostsIntegrationAccountCreateRequest 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 GitHubCostsIntegrationAccountCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountCreateRequest gitHubCostsIntegrationAccountCreateRequest = + (GitHubCostsIntegrationAccountCreateRequest) o; + return Objects.equals(this.data, gitHubCostsIntegrationAccountCreateRequest.data) + && Objects.equals( + this.additionalProperties, + gitHubCostsIntegrationAccountCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountCreateRequest {\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/GitHubCostsIntegrationAccountResponse.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountResponse.java new file mode 100644 index 00000000000..0025d5f05ab --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountResponse.java @@ -0,0 +1,152 @@ +/* + * 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 payload for a single GitHub Costs integration account. */ +@JsonPropertyOrder({GitHubCostsIntegrationAccountResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GitHubCostsIntegrationAccountResponseData data; + + public GitHubCostsIntegrationAccountResponse() {} + + @JsonCreator + public GitHubCostsIntegrationAccountResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + GitHubCostsIntegrationAccountResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public GitHubCostsIntegrationAccountResponse data( + GitHubCostsIntegrationAccountResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data envelope of a GitHub Costs integration account, including server-assigned identity. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitHubCostsIntegrationAccountResponseData getData() { + return data; + } + + public void setData(GitHubCostsIntegrationAccountResponseData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 GitHubCostsIntegrationAccountResponse + */ + @JsonAnySetter + public GitHubCostsIntegrationAccountResponse 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 GitHubCostsIntegrationAccountResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountResponse gitHubCostsIntegrationAccountResponse = + (GitHubCostsIntegrationAccountResponse) o; + return Objects.equals(this.data, gitHubCostsIntegrationAccountResponse.data) + && Objects.equals( + this.additionalProperties, gitHubCostsIntegrationAccountResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountResponse {\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/GitHubCostsIntegrationAccountResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountResponseAttributes.java new file mode 100644 index 00000000000..0c5d3aaeb84 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountResponseAttributes.java @@ -0,0 +1,251 @@ +/* + * 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; + +/** Attributes of a GitHub Costs integration account returned in responses. */ +@JsonPropertyOrder({ + GitHubCostsIntegrationAccountResponseAttributes.JSON_PROPERTY_AUTHENTICATION, + GitHubCostsIntegrationAccountResponseAttributes.JSON_PROPERTY_DATAFLOWS, + GitHubCostsIntegrationAccountResponseAttributes.JSON_PROPERTY_NAME, + GitHubCostsIntegrationAccountResponseAttributes.JSON_PROPERTY_SETTINGS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTHENTICATION = "authentication"; + private GitHubCostsIntegrationAccountAuthenticationResponse authentication; + + public static final String JSON_PROPERTY_DATAFLOWS = "dataflows"; + private GitHubCostsIntegrationDataflowsResponse dataflows; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SETTINGS = "settings"; + private GitHubCostsIntegrationAccountSettingsResponse settings; + + public GitHubCostsIntegrationAccountResponseAttributes() {} + + @JsonCreator + public GitHubCostsIntegrationAccountResponseAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_SETTINGS) + GitHubCostsIntegrationAccountSettingsResponse settings) { + this.name = name; + this.settings = settings; + this.unparsed |= settings.unparsed; + } + + public GitHubCostsIntegrationAccountResponseAttributes authentication( + GitHubCostsIntegrationAccountAuthenticationResponse authentication) { + this.authentication = authentication; + this.unparsed |= authentication.unparsed; + return this; + } + + /** + * Authentication configured on the GitHub Costs integration account. + * + * @return authentication + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHENTICATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GitHubCostsIntegrationAccountAuthenticationResponse getAuthentication() { + return authentication; + } + + public void setAuthentication( + GitHubCostsIntegrationAccountAuthenticationResponse authentication) { + this.authentication = authentication; + if (authentication != null) { + this.unparsed |= authentication.unparsed; + } + } + + public GitHubCostsIntegrationAccountResponseAttributes dataflows( + GitHubCostsIntegrationDataflowsResponse dataflows) { + this.dataflows = dataflows; + this.unparsed |= dataflows.unparsed; + return this; + } + + /** + * Data Datadog collects from GitHub Costs, keyed by dataflow ID. + * + * @return dataflows + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATAFLOWS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GitHubCostsIntegrationDataflowsResponse getDataflows() { + return dataflows; + } + + public void setDataflows(GitHubCostsIntegrationDataflowsResponse dataflows) { + this.dataflows = dataflows; + if (dataflows != null) { + this.unparsed |= dataflows.unparsed; + } + } + + public GitHubCostsIntegrationAccountResponseAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Human-readable name of the GitHub Costs integration account. + * + * @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 GitHubCostsIntegrationAccountResponseAttributes settings( + GitHubCostsIntegrationAccountSettingsResponse settings) { + this.settings = settings; + this.unparsed |= settings.unparsed; + return this; + } + + /** + * Settings configured on the GitHub Costs integration account. + * + * @return settings + */ + @JsonProperty(JSON_PROPERTY_SETTINGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitHubCostsIntegrationAccountSettingsResponse getSettings() { + return settings; + } + + public void setSettings(GitHubCostsIntegrationAccountSettingsResponse settings) { + this.settings = settings; + if (settings != null) { + this.unparsed |= settings.unparsed; + } + } + + /** + * 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 GitHubCostsIntegrationAccountResponseAttributes + */ + @JsonAnySetter + public GitHubCostsIntegrationAccountResponseAttributes 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 GitHubCostsIntegrationAccountResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountResponseAttributes + gitHubCostsIntegrationAccountResponseAttributes = + (GitHubCostsIntegrationAccountResponseAttributes) o; + return Objects.equals( + this.authentication, gitHubCostsIntegrationAccountResponseAttributes.authentication) + && Objects.equals(this.dataflows, gitHubCostsIntegrationAccountResponseAttributes.dataflows) + && Objects.equals(this.name, gitHubCostsIntegrationAccountResponseAttributes.name) + && Objects.equals(this.settings, gitHubCostsIntegrationAccountResponseAttributes.settings) + && Objects.equals( + this.additionalProperties, + gitHubCostsIntegrationAccountResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(authentication, dataflows, name, settings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountResponseAttributes {\n"); + sb.append(" authentication: ").append(toIndentedString(authentication)).append("\n"); + sb.append(" dataflows: ").append(toIndentedString(dataflows)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).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/GitHubCostsIntegrationAccountResponseData.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountResponseData.java new file mode 100644 index 00000000000..813ec8bcaec --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountResponseData.java @@ -0,0 +1,207 @@ +/* + * 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; + +/** Data envelope of a GitHub Costs integration account, including server-assigned identity. */ +@JsonPropertyOrder({ + GitHubCostsIntegrationAccountResponseData.JSON_PROPERTY_ATTRIBUTES, + GitHubCostsIntegrationAccountResponseData.JSON_PROPERTY_ID, + GitHubCostsIntegrationAccountResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GitHubCostsIntegrationAccountResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IntegrationAccountType type = IntegrationAccountType.INTEGRATION_ACCOUNT; + + public GitHubCostsIntegrationAccountResponseData() {} + + @JsonCreator + public GitHubCostsIntegrationAccountResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + GitHubCostsIntegrationAccountResponseAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IntegrationAccountType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GitHubCostsIntegrationAccountResponseData attributes( + GitHubCostsIntegrationAccountResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a GitHub Costs integration account returned in responses. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitHubCostsIntegrationAccountResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GitHubCostsIntegrationAccountResponseAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + /** + * Server-generated unique identifier of the GitHub Costs integration account. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public GitHubCostsIntegrationAccountResponseData type(IntegrationAccountType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the integration account resource. Always integration-account. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IntegrationAccountType getType() { + return type; + } + + public void setType(IntegrationAccountType 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 GitHubCostsIntegrationAccountResponseData + */ + @JsonAnySetter + public GitHubCostsIntegrationAccountResponseData 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 GitHubCostsIntegrationAccountResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountResponseData gitHubCostsIntegrationAccountResponseData = + (GitHubCostsIntegrationAccountResponseData) o; + return Objects.equals(this.attributes, gitHubCostsIntegrationAccountResponseData.attributes) + && Objects.equals(this.id, gitHubCostsIntegrationAccountResponseData.id) + && Objects.equals(this.type, gitHubCostsIntegrationAccountResponseData.type) + && Objects.equals( + this.additionalProperties, + gitHubCostsIntegrationAccountResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountResponseData {\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/GitHubCostsIntegrationAccountSettingsRequest.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountSettingsRequest.java new file mode 100644 index 00000000000..ad6ae416daa --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountSettingsRequest.java @@ -0,0 +1,125 @@ +/* + * 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.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.Objects; + +/** Settings for creating the GitHub Costs integration account. */ +@JsonPropertyOrder({ + GitHubCostsIntegrationAccountSettingsRequest.JSON_PROPERTY_ENTERPRISE_NAME, + GitHubCostsIntegrationAccountSettingsRequest.JSON_PROPERTY_TAGS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountSettingsRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENTERPRISE_NAME = "enterprise_name"; + private String enterpriseName; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private String tags; + + public GitHubCostsIntegrationAccountSettingsRequest() {} + + @JsonCreator + public GitHubCostsIntegrationAccountSettingsRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_ENTERPRISE_NAME) String enterpriseName) { + this.enterpriseName = enterpriseName; + } + + public GitHubCostsIntegrationAccountSettingsRequest enterpriseName(String enterpriseName) { + this.enterpriseName = enterpriseName; + return this; + } + + /** + * Slug of the GitHub enterprise, as in + * https://github.com/enterprises/<enterprise-name>, or login of a GitHub + * organization, as in https://github.com/<organization-name>. An enterprise + * covers every organization it owns. Connecting both an enterprise and one of its organizations + * counts that organization's costs twice. The token in authentication must match: + * classic for an enterprise, fine-grained for an organization. + * + * @return enterpriseName + */ + @JsonProperty(JSON_PROPERTY_ENTERPRISE_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getEnterpriseName() { + return enterpriseName; + } + + public void setEnterpriseName(String enterpriseName) { + this.enterpriseName = enterpriseName; + } + + public GitHubCostsIntegrationAccountSettingsRequest tags(String tags) { + this.tags = tags; + return this; + } + + /** + * Comma-separated list of custom tags for this GitHub Costs account. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTags() { + return tags; + } + + public void setTags(String tags) { + this.tags = tags; + } + + /** Return true if this GitHubCostsIntegrationAccountSettingsRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountSettingsRequest gitHubCostsIntegrationAccountSettingsRequest = + (GitHubCostsIntegrationAccountSettingsRequest) o; + return Objects.equals( + this.enterpriseName, gitHubCostsIntegrationAccountSettingsRequest.enterpriseName) + && Objects.equals(this.tags, gitHubCostsIntegrationAccountSettingsRequest.tags); + } + + @Override + public int hashCode() { + return Objects.hash(enterpriseName, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountSettingsRequest {\n"); + sb.append(" enterpriseName: ").append(toIndentedString(enterpriseName)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).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/GitHubCostsIntegrationAccountSettingsResponse.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountSettingsResponse.java new file mode 100644 index 00000000000..eec1e4450b1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountSettingsResponse.java @@ -0,0 +1,179 @@ +/* + * 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; + +/** Settings configured on the GitHub Costs integration account. */ +@JsonPropertyOrder({ + GitHubCostsIntegrationAccountSettingsResponse.JSON_PROPERTY_ENTERPRISE_NAME, + GitHubCostsIntegrationAccountSettingsResponse.JSON_PROPERTY_TAGS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountSettingsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENTERPRISE_NAME = "enterprise_name"; + private String enterpriseName; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private String tags; + + public GitHubCostsIntegrationAccountSettingsResponse() {} + + @JsonCreator + public GitHubCostsIntegrationAccountSettingsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_ENTERPRISE_NAME) String enterpriseName) { + this.enterpriseName = enterpriseName; + } + + public GitHubCostsIntegrationAccountSettingsResponse enterpriseName(String enterpriseName) { + this.enterpriseName = enterpriseName; + return this; + } + + /** + * Slug of the GitHub enterprise, as in + * https://github.com/enterprises/<enterprise-name>, or login of a GitHub + * organization, as in https://github.com/<organization-name>. + * + * @return enterpriseName + */ + @JsonProperty(JSON_PROPERTY_ENTERPRISE_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getEnterpriseName() { + return enterpriseName; + } + + public void setEnterpriseName(String enterpriseName) { + this.enterpriseName = enterpriseName; + } + + public GitHubCostsIntegrationAccountSettingsResponse tags(String tags) { + this.tags = tags; + return this; + } + + /** + * Comma-separated list of custom tags for this GitHub Costs account. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTags() { + return tags; + } + + public void setTags(String tags) { + this.tags = tags; + } + + /** + * 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 GitHubCostsIntegrationAccountSettingsResponse + */ + @JsonAnySetter + public GitHubCostsIntegrationAccountSettingsResponse 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 GitHubCostsIntegrationAccountSettingsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountSettingsResponse gitHubCostsIntegrationAccountSettingsResponse = + (GitHubCostsIntegrationAccountSettingsResponse) o; + return Objects.equals( + this.enterpriseName, gitHubCostsIntegrationAccountSettingsResponse.enterpriseName) + && Objects.equals(this.tags, gitHubCostsIntegrationAccountSettingsResponse.tags) + && Objects.equals( + this.additionalProperties, + gitHubCostsIntegrationAccountSettingsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enterpriseName, tags, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountSettingsResponse {\n"); + sb.append(" enterpriseName: ").append(toIndentedString(enterpriseName)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).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/GitHubCostsIntegrationAccountSettingsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountSettingsUpdate.java new file mode 100644 index 00000000000..10625ab4768 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountSettingsUpdate.java @@ -0,0 +1,119 @@ +/* + * 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** + * Settings for updating the GitHub Costs integration account. Only the provided fields are changed. + */ +@JsonPropertyOrder({ + GitHubCostsIntegrationAccountSettingsUpdate.JSON_PROPERTY_ENTERPRISE_NAME, + GitHubCostsIntegrationAccountSettingsUpdate.JSON_PROPERTY_TAGS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountSettingsUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENTERPRISE_NAME = "enterprise_name"; + private String enterpriseName; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private String tags; + + public GitHubCostsIntegrationAccountSettingsUpdate enterpriseName(String enterpriseName) { + this.enterpriseName = enterpriseName; + return this; + } + + /** + * Slug of the GitHub enterprise, as in + * https://github.com/enterprises/<enterprise-name>, or login of a GitHub + * organization, as in https://github.com/<organization-name>. An enterprise + * covers every organization it owns. Connecting both an enterprise and one of its organizations + * counts that organization's costs twice. The token in authentication must match: + * classic for an enterprise, fine-grained for an organization. + * + * @return enterpriseName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENTERPRISE_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEnterpriseName() { + return enterpriseName; + } + + public void setEnterpriseName(String enterpriseName) { + this.enterpriseName = enterpriseName; + } + + public GitHubCostsIntegrationAccountSettingsUpdate tags(String tags) { + this.tags = tags; + return this; + } + + /** + * Comma-separated list of custom tags for this GitHub Costs account. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTags() { + return tags; + } + + public void setTags(String tags) { + this.tags = tags; + } + + /** Return true if this GitHubCostsIntegrationAccountSettingsUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountSettingsUpdate gitHubCostsIntegrationAccountSettingsUpdate = + (GitHubCostsIntegrationAccountSettingsUpdate) o; + return Objects.equals( + this.enterpriseName, gitHubCostsIntegrationAccountSettingsUpdate.enterpriseName) + && Objects.equals(this.tags, gitHubCostsIntegrationAccountSettingsUpdate.tags); + } + + @Override + public int hashCode() { + return Objects.hash(enterpriseName, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountSettingsUpdate {\n"); + sb.append(" enterpriseName: ").append(toIndentedString(enterpriseName)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).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/GitHubCostsIntegrationAccountUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountUpdateAttributes.java new file mode 100644 index 00000000000..3ee16b4a62c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountUpdateAttributes.java @@ -0,0 +1,210 @@ +/* + * 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; + +/** + * Writable attributes used to update a GitHub Costs integration account. Every field is optional. + * Only the provided fields are changed. + */ +@JsonPropertyOrder({ + GitHubCostsIntegrationAccountUpdateAttributes.JSON_PROPERTY_AUTHENTICATION, + GitHubCostsIntegrationAccountUpdateAttributes.JSON_PROPERTY_NAME, + GitHubCostsIntegrationAccountUpdateAttributes.JSON_PROPERTY_SETTINGS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountUpdateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTHENTICATION = "authentication"; + private GitHubCostsIntegrationAccountAuthenticationUpdate authentication; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SETTINGS = "settings"; + private GitHubCostsIntegrationAccountSettingsUpdate settings; + + public GitHubCostsIntegrationAccountUpdateAttributes authentication( + GitHubCostsIntegrationAccountAuthenticationUpdate authentication) { + this.authentication = authentication; + this.unparsed |= authentication.unparsed; + return this; + } + + /** + * Authentication for updating the GitHub Costs integration account. Exactly one method is set. + * + * @return authentication + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHENTICATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GitHubCostsIntegrationAccountAuthenticationUpdate getAuthentication() { + return authentication; + } + + public void setAuthentication(GitHubCostsIntegrationAccountAuthenticationUpdate authentication) { + this.authentication = authentication; + if (authentication != null) { + this.unparsed |= authentication.unparsed; + } + } + + public GitHubCostsIntegrationAccountUpdateAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Human-readable name of the GitHub Costs integration account. + * + * @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 GitHubCostsIntegrationAccountUpdateAttributes settings( + GitHubCostsIntegrationAccountSettingsUpdate settings) { + this.settings = settings; + this.unparsed |= settings.unparsed; + return this; + } + + /** + * Settings for updating the GitHub Costs integration account. Only the provided fields are + * changed. + * + * @return settings + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SETTINGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GitHubCostsIntegrationAccountSettingsUpdate getSettings() { + return settings; + } + + public void setSettings(GitHubCostsIntegrationAccountSettingsUpdate settings) { + this.settings = settings; + if (settings != null) { + this.unparsed |= settings.unparsed; + } + } + + /** + * 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 GitHubCostsIntegrationAccountUpdateAttributes + */ + @JsonAnySetter + public GitHubCostsIntegrationAccountUpdateAttributes 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 GitHubCostsIntegrationAccountUpdateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountUpdateAttributes gitHubCostsIntegrationAccountUpdateAttributes = + (GitHubCostsIntegrationAccountUpdateAttributes) o; + return Objects.equals( + this.authentication, gitHubCostsIntegrationAccountUpdateAttributes.authentication) + && Objects.equals(this.name, gitHubCostsIntegrationAccountUpdateAttributes.name) + && Objects.equals(this.settings, gitHubCostsIntegrationAccountUpdateAttributes.settings) + && Objects.equals( + this.additionalProperties, + gitHubCostsIntegrationAccountUpdateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(authentication, name, settings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountUpdateAttributes {\n"); + sb.append(" authentication: ").append(toIndentedString(authentication)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).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/GitHubCostsIntegrationAccountUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountUpdateData.java new file mode 100644 index 00000000000..474be209273 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountUpdateData.java @@ -0,0 +1,217 @@ +/* + * 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; + +/** Data envelope for updating a GitHub Costs integration account. */ +@JsonPropertyOrder({ + GitHubCostsIntegrationAccountUpdateData.JSON_PROPERTY_ATTRIBUTES, + GitHubCostsIntegrationAccountUpdateData.JSON_PROPERTY_ID, + GitHubCostsIntegrationAccountUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private GitHubCostsIntegrationAccountUpdateAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IntegrationAccountType type = IntegrationAccountType.INTEGRATION_ACCOUNT; + + public GitHubCostsIntegrationAccountUpdateData() {} + + @JsonCreator + public GitHubCostsIntegrationAccountUpdateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + GitHubCostsIntegrationAccountUpdateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IntegrationAccountType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public GitHubCostsIntegrationAccountUpdateData attributes( + GitHubCostsIntegrationAccountUpdateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Writable attributes used to update a GitHub Costs integration account. Every field is optional. + * Only the provided fields are changed. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitHubCostsIntegrationAccountUpdateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(GitHubCostsIntegrationAccountUpdateAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public GitHubCostsIntegrationAccountUpdateData id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier of the GitHub Costs integration account to update. + * + * @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 GitHubCostsIntegrationAccountUpdateData type(IntegrationAccountType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the integration account resource. Always integration-account. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IntegrationAccountType getType() { + return type; + } + + public void setType(IntegrationAccountType 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 GitHubCostsIntegrationAccountUpdateData + */ + @JsonAnySetter + public GitHubCostsIntegrationAccountUpdateData 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 GitHubCostsIntegrationAccountUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountUpdateData gitHubCostsIntegrationAccountUpdateData = + (GitHubCostsIntegrationAccountUpdateData) o; + return Objects.equals(this.attributes, gitHubCostsIntegrationAccountUpdateData.attributes) + && Objects.equals(this.id, gitHubCostsIntegrationAccountUpdateData.id) + && Objects.equals(this.type, gitHubCostsIntegrationAccountUpdateData.type) + && Objects.equals( + this.additionalProperties, + gitHubCostsIntegrationAccountUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountUpdateData {\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/GitHubCostsIntegrationAccountUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountUpdateRequest.java new file mode 100644 index 00000000000..9ea88fcefac --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountUpdateRequest.java @@ -0,0 +1,154 @@ +/* + * 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; + +/** Request payload to update a GitHub Costs integration account. */ +@JsonPropertyOrder({GitHubCostsIntegrationAccountUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private GitHubCostsIntegrationAccountUpdateData data; + + public GitHubCostsIntegrationAccountUpdateRequest() {} + + @JsonCreator + public GitHubCostsIntegrationAccountUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + GitHubCostsIntegrationAccountUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public GitHubCostsIntegrationAccountUpdateRequest data( + GitHubCostsIntegrationAccountUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data envelope for updating a GitHub Costs integration account. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GitHubCostsIntegrationAccountUpdateData getData() { + return data; + } + + public void setData(GitHubCostsIntegrationAccountUpdateData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 GitHubCostsIntegrationAccountUpdateRequest + */ + @JsonAnySetter + public GitHubCostsIntegrationAccountUpdateRequest 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 GitHubCostsIntegrationAccountUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountUpdateRequest gitHubCostsIntegrationAccountUpdateRequest = + (GitHubCostsIntegrationAccountUpdateRequest) o; + return Objects.equals(this.data, gitHubCostsIntegrationAccountUpdateRequest.data) + && Objects.equals( + this.additionalProperties, + gitHubCostsIntegrationAccountUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountUpdateRequest {\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/GitHubCostsIntegrationAccountsResponse.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountsResponse.java new file mode 100644 index 00000000000..67fffd434eb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationAccountsResponse.java @@ -0,0 +1,167 @@ +/* + * 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 payload for a list of GitHub Costs integration accounts. */ +@JsonPropertyOrder({GitHubCostsIntegrationAccountsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationAccountsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public GitHubCostsIntegrationAccountsResponse() {} + + @JsonCreator + public GitHubCostsIntegrationAccountsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + for (GitHubCostsIntegrationAccountResponseData item : data) { + this.unparsed |= item.unparsed; + } + } + + public GitHubCostsIntegrationAccountsResponse data( + List data) { + this.data = data; + for (GitHubCostsIntegrationAccountResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public GitHubCostsIntegrationAccountsResponse addDataItem( + GitHubCostsIntegrationAccountResponseData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * List of GitHub Costs integration accounts. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + if (data != null) { + for (GitHubCostsIntegrationAccountResponseData item : data) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * 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 GitHubCostsIntegrationAccountsResponse + */ + @JsonAnySetter + public GitHubCostsIntegrationAccountsResponse 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 GitHubCostsIntegrationAccountsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationAccountsResponse gitHubCostsIntegrationAccountsResponse = + (GitHubCostsIntegrationAccountsResponse) o; + return Objects.equals(this.data, gitHubCostsIntegrationAccountsResponse.data) + && Objects.equals( + this.additionalProperties, gitHubCostsIntegrationAccountsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationAccountsResponse {\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/GitHubCostsIntegrationDataflowsResponse.java b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationDataflowsResponse.java new file mode 100644 index 00000000000..a47af82effc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GitHubCostsIntegrationDataflowsResponse.java @@ -0,0 +1,155 @@ +/* + * 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; + +/** Data Datadog collects from GitHub Costs, keyed by dataflow ID. */ +@JsonPropertyOrder({ + GitHubCostsIntegrationDataflowsResponse.JSON_PROPERTY_GITHUB_CLOUD_COST_METRICS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GitHubCostsIntegrationDataflowsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_GITHUB_CLOUD_COST_METRICS = "github-cloud-cost-metrics"; + private GitHubCostsCloudCostMetricsIntegrationDataflowResponse githubCloudCostMetrics; + + public GitHubCostsIntegrationDataflowsResponse githubCloudCostMetrics( + GitHubCostsCloudCostMetricsIntegrationDataflowResponse githubCloudCostMetrics) { + this.githubCloudCostMetrics = githubCloudCostMetrics; + this.unparsed |= githubCloudCostMetrics.unparsed; + return this; + } + + /** + * GitHub costs, including Actions, storage, and Copilot, which you can analyze in Cloud Cost Management. Reported + * costs are estimates based on list prices and usage data and include discounts when available, + * but not negotiated rates. Requires Cloud Cost Management on your Datadog organization and a + * GitHub account on the enhanced billing platform. Without them, this dataflow collects no data. + * This dataflow is always on and cannot be turned off, so it appears in responses only. + * + * @return githubCloudCostMetrics + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GITHUB_CLOUD_COST_METRICS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GitHubCostsCloudCostMetricsIntegrationDataflowResponse getGithubCloudCostMetrics() { + return githubCloudCostMetrics; + } + + public void setGithubCloudCostMetrics( + GitHubCostsCloudCostMetricsIntegrationDataflowResponse githubCloudCostMetrics) { + this.githubCloudCostMetrics = githubCloudCostMetrics; + if (githubCloudCostMetrics != null) { + this.unparsed |= githubCloudCostMetrics.unparsed; + } + } + + /** + * 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 GitHubCostsIntegrationDataflowsResponse + */ + @JsonAnySetter + public GitHubCostsIntegrationDataflowsResponse 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 GitHubCostsIntegrationDataflowsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitHubCostsIntegrationDataflowsResponse gitHubCostsIntegrationDataflowsResponse = + (GitHubCostsIntegrationDataflowsResponse) o; + return Objects.equals( + this.githubCloudCostMetrics, + gitHubCostsIntegrationDataflowsResponse.githubCloudCostMetrics) + && Objects.equals( + this.additionalProperties, + gitHubCostsIntegrationDataflowsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(githubCloudCostMetrics, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitHubCostsIntegrationDataflowsResponse {\n"); + sb.append(" githubCloudCostMetrics: ") + .append(toIndentedString(githubCloudCostMetrics)) + .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/github_costs_integration.feature b/src/test/resources/com/datadog/api/client/v2/api/github_costs_integration.feature new file mode 100644 index 00000000000..422a7f2b59e --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/github_costs_integration.feature @@ -0,0 +1,148 @@ +@endpoint(github-costs-integration) @endpoint(github-costs-integration-v2) +Feature: GitHub Costs Integration + Manage your Datadog GitHub Costs integration accounts and account + resources directly through the Datadog API. See the [GitHub Costs + integration page](https://docs.datadoghq.com/integrations/github-costs/) + for more information. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "GitHubCostsIntegration" API + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Create a GitHub Costs integration account returns "Bad Request" response + Given operation "CreateGitHubCostsIntegrationAccount" enabled + And new "CreateGitHubCostsIntegrationAccount" request + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "name": "github-costs-acme", "settings": {"enterprise_name": "enterprise-name", "tags": "env:prod,team:example"}}, "type": "integration-account"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Create a GitHub Costs integration account returns "Created" response + Given operation "CreateGitHubCostsIntegrationAccount" enabled + And new "CreateGitHubCostsIntegrationAccount" request + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "name": "github-costs-acme", "settings": {"enterprise_name": "enterprise-name", "tags": "env:prod,team:example"}}, "type": "integration-account"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Create a GitHub Costs integration account returns "Not Found" response + Given operation "CreateGitHubCostsIntegrationAccount" enabled + And new "CreateGitHubCostsIntegrationAccount" request + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "name": "github-costs-acme", "settings": {"enterprise_name": "enterprise-name", "tags": "env:prod,team:example"}}, "type": "integration-account"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Create a GitHub Costs integration account returns "The server cannot process the request because it contains invalid data." response + Given operation "CreateGitHubCostsIntegrationAccount" enabled + And new "CreateGitHubCostsIntegrationAccount" request + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "name": "github-costs-acme", "settings": {"enterprise_name": "enterprise-name", "tags": "env:prod,team:example"}}, "type": "integration-account"}} + When the request is sent + Then the response status is 422 The server cannot process the request because it contains invalid data. + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Delete a GitHub Costs integration account returns "Bad Request" response + Given operation "DeleteGitHubCostsIntegrationAccount" enabled + And new "DeleteGitHubCostsIntegrationAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Delete a GitHub Costs integration account returns "Not Found" response + Given operation "DeleteGitHubCostsIntegrationAccount" enabled + And new "DeleteGitHubCostsIntegrationAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Delete a GitHub Costs integration account returns "OK" response + Given operation "DeleteGitHubCostsIntegrationAccount" enabled + And new "DeleteGitHubCostsIntegrationAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Get a GitHub Costs integration account returns "Bad Request" response + Given operation "GetGitHubCostsIntegrationAccount" enabled + And new "GetGitHubCostsIntegrationAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Get a GitHub Costs integration account returns "Not Found" response + Given operation "GetGitHubCostsIntegrationAccount" enabled + And new "GetGitHubCostsIntegrationAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Get a GitHub Costs integration account returns "OK" response + Given operation "GetGitHubCostsIntegrationAccount" enabled + And new "GetGitHubCostsIntegrationAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/saas-integrations + Scenario: List GitHub Costs integration accounts returns "Bad Request" response + Given operation "ListGitHubCostsIntegrationAccounts" enabled + And new "ListGitHubCostsIntegrationAccounts" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/saas-integrations + Scenario: List GitHub Costs integration accounts returns "Not Found" response + Given operation "ListGitHubCostsIntegrationAccounts" enabled + And new "ListGitHubCostsIntegrationAccounts" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/saas-integrations + Scenario: List GitHub Costs integration accounts returns "OK" response + Given operation "ListGitHubCostsIntegrationAccounts" enabled + And new "ListGitHubCostsIntegrationAccounts" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Update a GitHub Costs integration account returns "Bad Request" response + Given operation "UpdateGitHubCostsIntegrationAccount" enabled + And new "UpdateGitHubCostsIntegrationAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "name": "github-costs-acme", "settings": {"enterprise_name": "enterprise-name", "tags": "env:prod,team:example"}}, "id": "5f1a8d3c-7e2b-4f9a-b6c4-8d0e3a7f1b52", "type": "integration-account"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Update a GitHub Costs integration account returns "Not Found" response + Given operation "UpdateGitHubCostsIntegrationAccount" enabled + And new "UpdateGitHubCostsIntegrationAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "name": "github-costs-acme", "settings": {"enterprise_name": "enterprise-name", "tags": "env:prod,team:example"}}, "id": "5f1a8d3c-7e2b-4f9a-b6c4-8d0e3a7f1b52", "type": "integration-account"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Update a GitHub Costs integration account returns "OK" response + Given operation "UpdateGitHubCostsIntegrationAccount" enabled + And new "UpdateGitHubCostsIntegrationAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "name": "github-costs-acme", "settings": {"enterprise_name": "enterprise-name", "tags": "env:prod,team:example"}}, "id": "5f1a8d3c-7e2b-4f9a-b6c4-8d0e3a7f1b52", "type": "integration-account"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Update a GitHub Costs integration account returns "The server cannot process the request because it contains invalid data." response + Given operation "UpdateGitHubCostsIntegrationAccount" enabled + And new "UpdateGitHubCostsIntegrationAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "name": "github-costs-acme", "settings": {"enterprise_name": "enterprise-name", "tags": "env:prod,team:example"}}, "id": "5f1a8d3c-7e2b-4f9a-b6c4-8d0e3a7f1b52", "type": "integration-account"}} + When the request is sent + Then the response status is 422 The server cannot process the request because it contains invalid data. 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 77e77d9cca4..a648b120b83 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 @@ -1633,6 +1633,19 @@ "type": "unsafe" } }, + "CreateGitHubCostsIntegrationAccount": { + "tag": "GitHub Costs Integration", + "undo": { + "operationId": "DeleteGitHubCostsIntegrationAccount", + "parameters": [ + { + "name": "account_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, "CreateGlobalIncidentHandle": { "tag": "Incidents", "undo": { @@ -4119,6 +4132,12 @@ "type": "idempotent" } }, + "DeleteGitHubCostsIntegrationAccount": { + "tag": "GitHub Costs Integration", + "undo": { + "type": "idempotent" + } + }, "DeleteGlobalIncidentHandle": { "tag": "Incidents", "undo": { @@ -6186,6 +6205,12 @@ "type": "safe" } }, + "GetGitHubCostsIntegrationAccount": { + "tag": "GitHub Costs Integration", + "undo": { + "type": "safe" + } + }, "GetGlobalIncidentSettings": { "tag": "Incidents", "undo": { @@ -8529,6 +8554,12 @@ "type": "safe" } }, + "ListGitHubCostsIntegrationAccounts": { + "tag": "GitHub Costs Integration", + "undo": { + "type": "safe" + } + }, "ListGlobalIncidentHandles": { "tag": "Incidents", "undo": { @@ -11419,6 +11450,12 @@ "type": "idempotent" } }, + "UpdateGitHubCostsIntegrationAccount": { + "tag": "GitHub Costs Integration", + "undo": { + "type": "idempotent" + } + }, "UpdateGlobalIncidentHandle": { "tag": "Incidents", "undo": {