diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 23d3b7fb9b8..ae50edda97e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -107467,6 +107467,275 @@ components: required: - type type: object + OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest: + additionalProperties: false + description: >- + OpenAI organization costs, which you can analyze in [Cloud Cost Management](https://docs.datadoghq.com/cloud_cost_management/). See [collected data](https://docs.datadoghq.com/cloud_cost_management/saas_costs/?tab=openai#data-collected) for what is included. Cost data appears in Cloud Cost Management within 24 hours after you enable this dataflow. + properties: + enabled: + description: >- + Whether Datadog collects this data. Defaults to `false`. Set to `true` to start collection. + example: true + type: boolean + type: object + OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse: + description: >- + OpenAI organization costs, which you can analyze in [Cloud Cost Management](https://docs.datadoghq.com/cloud_cost_management/). See [collected data](https://docs.datadoghq.com/cloud_cost_management/saas_costs/?tab=openai#data-collected) for what is included. + properties: + enabled: + description: Whether Datadog collects this data. + example: true + type: boolean + status: + $ref: "#/components/schemas/IntegrationAccountDataflowStatus" + type: object + OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest: + description: Authentication for creating the OpenAI Usage and Costs integration account. Set exactly one method. + oneOf: + - $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest" + OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse: + description: Authentication configured on the OpenAI Usage and Costs integration account. + oneOf: + - $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse" + OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate: + description: Authentication for updating the OpenAI Usage and Costs integration account. Set exactly one method. + oneOf: + - $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate" + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest: + additionalProperties: false + description: >- + Bearer token authentication. Use an admin-scoped OpenAI API key. Project-scoped and standard keys cannot read organization usage or costs. Requests with an invalid key, or with a key that is not an admin key, return a `422` response. + properties: + auth_type: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType" + token: + description: Secret token used to authenticate with OpenAI. + example: your-token + type: string + writeOnly: true + required: + - auth_type + - token + type: object + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse: + description: The bearer token authentication method configured on the account. + properties: + auth_type: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType" + required: + - auth_type + type: object + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType: + default: bearer_token + description: The authentication method type. + enum: + - bearer_token + example: bearer_token + type: string + x-enum-varnames: + - BEARER_TOKEN + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate: + additionalProperties: false + description: >- + Bearer token authentication. Use an admin-scoped OpenAI API key. Project-scoped and standard keys cannot read organization usage or costs. Requests with an invalid key, or with a key that is not an admin key, return a `422` response. Only the provided fields are changed. To keep the stored token, omit `token`. + properties: + auth_type: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType" + token: + description: Secret token used to authenticate with OpenAI. + example: your-token + type: string + writeOnly: true + required: + - auth_type + type: object + OpenAIUsageAndCostsIntegrationAccountCreateAttributes: + description: Writable attributes used to create an OpenAI Usage and Costs integration account. + properties: + authentication: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest" + dataflows: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationDataflowsRequest" + name: + description: Human-readable name of the OpenAI Usage and Costs integration account. + example: openai-usage-and-costs-acme + type: string + settings: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountSettingsRequest" + required: + - name + - authentication + - settings + type: object + OpenAIUsageAndCostsIntegrationAccountCreateData: + description: Data envelope for creating an OpenAI Usage and Costs integration account. + properties: + attributes: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountCreateAttributes" + type: + $ref: "#/components/schemas/IntegrationAccountType" + required: + - type + - attributes + type: object + OpenAIUsageAndCostsIntegrationAccountCreateRequest: + description: Request payload to create an OpenAI Usage and Costs integration account. + properties: + data: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountCreateData" + required: + - data + type: object + OpenAIUsageAndCostsIntegrationAccountResponse: + description: Response payload for a single OpenAI Usage and Costs integration account. + properties: + data: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountResponseData" + required: + - data + type: object + OpenAIUsageAndCostsIntegrationAccountResponseAttributes: + description: Attributes of an OpenAI Usage and Costs integration account returned in responses. + properties: + authentication: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse" + dataflows: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationDataflowsResponse" + name: + description: Human-readable name of the OpenAI Usage and Costs integration account. + example: openai-usage-and-costs-acme + type: string + settings: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountSettingsResponse" + required: + - name + - settings + type: object + OpenAIUsageAndCostsIntegrationAccountResponseData: + description: Data envelope of an OpenAI Usage and Costs integration account, including server-assigned identity. + properties: + attributes: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountResponseAttributes" + id: + description: Server-generated unique identifier of the OpenAI Usage and Costs integration account. + example: 9c4e7a2b-1d5f-4e8a-b3c6-0f2d8a6e4b17 + readOnly: true + type: string + type: + $ref: "#/components/schemas/IntegrationAccountType" + required: + - id + - attributes + - type + type: object + OpenAIUsageAndCostsIntegrationAccountSettingsRequest: + additionalProperties: false + description: Settings for creating the OpenAI Usage and Costs integration account. + properties: + custom_tags: + description: >- + Comma-separated list of custom tags applied to the data collected for this account, for example `team:ai,env:prod`. + example: team:ai,env:prod + type: string + type: object + OpenAIUsageAndCostsIntegrationAccountSettingsResponse: + description: Settings configured on the OpenAI Usage and Costs integration account. + properties: + custom_tags: + description: >- + Comma-separated list of custom tags applied to the data collected for this account, for example `team:ai,env:prod`. + example: team:ai,env:prod + type: string + type: object + OpenAIUsageAndCostsIntegrationAccountSettingsUpdate: + additionalProperties: false + description: >- + Settings for updating the OpenAI Usage and Costs integration account. Only the fields provided are changed. + properties: + custom_tags: + description: >- + Comma-separated list of custom tags applied to the data collected for this account, for example `team:ai,env:prod`. + example: team:ai,env:prod + type: string + type: object + OpenAIUsageAndCostsIntegrationAccountUpdateAttributes: + description: >- + Writable attributes used to update an OpenAI Usage and Costs integration account. Every field is optional. Only the provided fields are changed. When `dataflows` is provided, only the dataflow IDs in the request are modified. Dataflows omitted from the map keep their current configuration. + properties: + authentication: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate" + dataflows: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationDataflowsRequest" + name: + description: Human-readable name of the OpenAI Usage and Costs integration account. + example: openai-usage-and-costs-acme + type: string + settings: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountSettingsUpdate" + type: object + OpenAIUsageAndCostsIntegrationAccountUpdateData: + description: Data envelope for updating an OpenAI Usage and Costs integration account. + properties: + attributes: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountUpdateAttributes" + id: + description: Unique identifier of the OpenAI Usage and Costs integration account to update. + example: 9c4e7a2b-1d5f-4e8a-b3c6-0f2d8a6e4b17 + type: string + type: + $ref: "#/components/schemas/IntegrationAccountType" + required: + - id + - type + - attributes + type: object + OpenAIUsageAndCostsIntegrationAccountUpdateRequest: + description: Request payload to update an OpenAI Usage and Costs integration account. + properties: + data: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountUpdateData" + required: + - data + type: object + OpenAIUsageAndCostsIntegrationAccountsResponse: + description: Response payload for a list of OpenAI Usage and Costs integration accounts. + properties: + data: + description: List of OpenAI Usage and Costs integration accounts. + items: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountResponseData" + type: array + required: + - data + type: object + OpenAIUsageAndCostsIntegrationDataflowsRequest: + additionalProperties: false + description: >- + Data Datadog collects from OpenAI Usage and Costs, keyed by dataflow ID. Datadog always collects organization usage metrics. Each dataflow in this object adds another type of collection. Set `enabled` to start or stop a dataflow. The default for each dataflow applies when the account is created. On update, omitted fields keep their current values. + properties: + openai-cloud-cost-data: + $ref: "#/components/schemas/OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest" + type: object + OpenAIUsageAndCostsIntegrationDataflowsResponse: + description: Data Datadog collects from OpenAI Usage and Costs, keyed by dataflow ID. + properties: + openai-cloud-cost-data: + $ref: "#/components/schemas/OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse" + openai-usage-metrics: + $ref: "#/components/schemas/OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse" + type: object + OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse: + description: >- + Organization usage metrics under the `openai.*` namespace, such as `openai.completions.*`, `openai.embeddings.*`, `openai.images.*`, `openai.moderations.*`, `openai.audio_speeches.*`, `openai.audio_transcriptions.*`, `openai.code_interpreter_sessions.*`, and `openai.vector_stores.*`. This dataflow is always on and cannot be turned off, so it appears only in responses. + 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 OpenAPIEndpoint: description: Endpoint info extracted from an `OpenAPI` specification. properties: @@ -211412,6 +211681,260 @@ 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/openai-usage-and-costs/accounts: + get: + description: List OpenAI Usage and Costs integration accounts. + operationId: ListOpenAIUsageAndCostsIntegrationAccounts + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + authentication: + auth_type: bearer_token + dataflows: + openai-cloud-cost-data: + enabled: true + status: + health: DATAFLOW_HEALTH_OK + updated_at: "2026-11-10T08:30:50Z" + openai-usage-metrics: + enabled: true + status: + health: DATAFLOW_HEALTH_OK + updated_at: "2026-11-10T08:30:50Z" + name: openai-usage-and-costs-acme + settings: + custom_tags: team:ai,env:prod + id: 9c4e7a2b-1d5f-4e8a-b3c6-0f2d8a6e4b17 + type: integration-account + schema: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountsResponse" + description: OK + "400": + $ref: "#/components/responses/IntegrationAccountBadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/IntegrationAccountNotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List OpenAI Usage and Costs accounts + tags: + - OpenAI Usage and 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 an OpenAI Usage and Costs integration account. + operationId: CreateOpenAIUsageAndCostsIntegrationAccount + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + authentication: + auth_type: bearer_token + dataflows: + openai-cloud-cost-data: + enabled: true + status: + health: DATAFLOW_HEALTH_OK + updated_at: "2026-11-10T08:30:50Z" + openai-usage-metrics: + enabled: true + status: + health: DATAFLOW_HEALTH_OK + updated_at: "2026-11-10T08:30:50Z" + name: openai-usage-and-costs-acme + settings: + custom_tags: team:ai,env:prod + id: 9c4e7a2b-1d5f-4e8a-b3c6-0f2d8a6e4b17 + type: integration-account + schema: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountResponse" + 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 an OpenAI Usage and Costs account + tags: + - OpenAI Usage and 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/openai-usage-and-costs/accounts/{account_id}: + delete: + description: Delete an OpenAI Usage and Costs integration account. + operationId: DeleteOpenAIUsageAndCostsIntegrationAccount + 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 an OpenAI Usage and Costs account + tags: + - OpenAI Usage and 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 an OpenAI Usage and Costs integration account. + operationId: GetOpenAIUsageAndCostsIntegrationAccount + parameters: + - $ref: "#/components/parameters/IntegrationAccountIdParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + authentication: + auth_type: bearer_token + dataflows: + openai-cloud-cost-data: + enabled: true + status: + health: DATAFLOW_HEALTH_OK + updated_at: "2026-11-10T08:30:50Z" + openai-usage-metrics: + enabled: true + status: + health: DATAFLOW_HEALTH_OK + updated_at: "2026-11-10T08:30:50Z" + name: openai-usage-and-costs-acme + settings: + custom_tags: team:ai,env:prod + id: 9c4e7a2b-1d5f-4e8a-b3c6-0f2d8a6e4b17 + type: integration-account + schema: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountResponse" + description: OK + "400": + $ref: "#/components/responses/IntegrationAccountBadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/IntegrationAccountNotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get an OpenAI Usage and Costs account + tags: + - OpenAI Usage and 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 an OpenAI Usage and Costs integration account. Only the fields provided are changed. + operationId: UpdateOpenAIUsageAndCostsIntegrationAccount + parameters: + - $ref: "#/components/parameters/IntegrationAccountIdParameter" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + authentication: + auth_type: bearer_token + dataflows: + openai-cloud-cost-data: + enabled: true + status: + health: DATAFLOW_HEALTH_OK + updated_at: "2026-11-10T08:30:50Z" + openai-usage-metrics: + enabled: true + status: + health: DATAFLOW_HEALTH_OK + updated_at: "2026-11-10T08:30:50Z" + name: openai-usage-and-costs-acme + settings: + custom_tags: team:ai,env:prod + id: 9c4e7a2b-1d5f-4e8a-b3c6-0f2d8a6e4b17 + type: integration-account + schema: + $ref: "#/components/schemas/OpenAIUsageAndCostsIntegrationAccountResponse" + 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 an OpenAI Usage and Costs account + tags: + - OpenAI Usage and 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/snowflake/accounts: get: description: List Snowflake integration accounts. @@ -288844,6 +289367,15 @@ tags: description: OpenAI Codex integration. url: https://docs.datadoghq.com/integrations/openai-codex/ name: OpenAI Codex Integration + - description: |- + Manage your Datadog OpenAI Usage and Costs integration accounts and account resources + directly through the Datadog API. See the + [OpenAI integration page](https://docs.datadoghq.com/integrations/openai/) for + more information. + externalDocs: + description: OpenAI integration. + url: https://docs.datadoghq.com/integrations/openai/ + name: OpenAI Usage and Costs Integration - description: |- Configure your [Datadog Opsgenie integration](https://docs.datadoghq.com/integrations/opsgenie/) directly through the Datadog API. diff --git a/examples/v2/openai-usage-and-costs-integration/CreateOpenAIUsageAndCostsIntegrationAccount.java b/examples/v2/openai-usage-and-costs-integration/CreateOpenAIUsageAndCostsIntegrationAccount.java new file mode 100644 index 00000000000..b678cb6c99e --- /dev/null +++ b/examples/v2/openai-usage-and-costs-integration/CreateOpenAIUsageAndCostsIntegrationAccount.java @@ -0,0 +1,65 @@ +// Create an OpenAI Usage and Costs account returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OpenAiUsageandCostsIntegrationApi; +import com.datadog.api.client.v2.model.IntegrationAccountType; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountCreateAttributes; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountCreateData; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountCreateRequest; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountResponse; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountSettingsRequest; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationDataflowsRequest; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled( + "v2.createOpenAIUsageAndCostsIntegrationAccount", true); + OpenAiUsageandCostsIntegrationApi apiInstance = + new OpenAiUsageandCostsIntegrationApi(defaultClient); + + OpenAIUsageAndCostsIntegrationAccountCreateRequest body = + new OpenAIUsageAndCostsIntegrationAccountCreateRequest() + .data( + new OpenAIUsageAndCostsIntegrationAccountCreateData() + .attributes( + new OpenAIUsageAndCostsIntegrationAccountCreateAttributes() + .authentication( + new OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest( + new OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest() + .authType( + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType + .BEARER_TOKEN) + .token("your-token"))) + .dataflows( + new OpenAIUsageAndCostsIntegrationDataflowsRequest() + .openaiCloudCostData( + new OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest() + .enabled(true))) + .name("openai-usage-and-costs-acme") + .settings( + new OpenAIUsageAndCostsIntegrationAccountSettingsRequest() + .customTags("team:ai,env:prod"))) + .type(IntegrationAccountType.INTEGRATION_ACCOUNT)); + + try { + OpenAIUsageAndCostsIntegrationAccountResponse result = + apiInstance.createOpenAIUsageAndCostsIntegrationAccount(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling" + + " OpenAiUsageandCostsIntegrationApi#createOpenAIUsageAndCostsIntegrationAccount"); + 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/openai-usage-and-costs-integration/DeleteOpenAIUsageAndCostsIntegrationAccount.java b/examples/v2/openai-usage-and-costs-integration/DeleteOpenAIUsageAndCostsIntegrationAccount.java new file mode 100644 index 00000000000..5192f0ce3e9 --- /dev/null +++ b/examples/v2/openai-usage-and-costs-integration/DeleteOpenAIUsageAndCostsIntegrationAccount.java @@ -0,0 +1,28 @@ +// Delete an OpenAI Usage and Costs account returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OpenAiUsageandCostsIntegrationApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled( + "v2.deleteOpenAIUsageAndCostsIntegrationAccount", true); + OpenAiUsageandCostsIntegrationApi apiInstance = + new OpenAiUsageandCostsIntegrationApi(defaultClient); + + try { + apiInstance.deleteOpenAIUsageAndCostsIntegrationAccount("account_id"); + } catch (ApiException e) { + System.err.println( + "Exception when calling" + + " OpenAiUsageandCostsIntegrationApi#deleteOpenAIUsageAndCostsIntegrationAccount"); + 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/openai-usage-and-costs-integration/GetOpenAIUsageAndCostsIntegrationAccount.java b/examples/v2/openai-usage-and-costs-integration/GetOpenAIUsageAndCostsIntegrationAccount.java new file mode 100644 index 00000000000..ea4b1500afd --- /dev/null +++ b/examples/v2/openai-usage-and-costs-integration/GetOpenAIUsageAndCostsIntegrationAccount.java @@ -0,0 +1,30 @@ +// Get an OpenAI Usage and Costs account returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OpenAiUsageandCostsIntegrationApi; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getOpenAIUsageAndCostsIntegrationAccount", true); + OpenAiUsageandCostsIntegrationApi apiInstance = + new OpenAiUsageandCostsIntegrationApi(defaultClient); + + try { + OpenAIUsageAndCostsIntegrationAccountResponse result = + apiInstance.getOpenAIUsageAndCostsIntegrationAccount("account_id"); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling" + + " OpenAiUsageandCostsIntegrationApi#getOpenAIUsageAndCostsIntegrationAccount"); + 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/openai-usage-and-costs-integration/ListOpenAIUsageAndCostsIntegrationAccounts.java b/examples/v2/openai-usage-and-costs-integration/ListOpenAIUsageAndCostsIntegrationAccounts.java new file mode 100644 index 00000000000..1846a7a019f --- /dev/null +++ b/examples/v2/openai-usage-and-costs-integration/ListOpenAIUsageAndCostsIntegrationAccounts.java @@ -0,0 +1,31 @@ +// List OpenAI Usage and Costs accounts returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OpenAiUsageandCostsIntegrationApi; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled( + "v2.listOpenAIUsageAndCostsIntegrationAccounts", true); + OpenAiUsageandCostsIntegrationApi apiInstance = + new OpenAiUsageandCostsIntegrationApi(defaultClient); + + try { + OpenAIUsageAndCostsIntegrationAccountsResponse result = + apiInstance.listOpenAIUsageAndCostsIntegrationAccounts(); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling" + + " OpenAiUsageandCostsIntegrationApi#listOpenAIUsageAndCostsIntegrationAccounts"); + 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/openai-usage-and-costs-integration/UpdateOpenAIUsageAndCostsIntegrationAccount.java b/examples/v2/openai-usage-and-costs-integration/UpdateOpenAIUsageAndCostsIntegrationAccount.java new file mode 100644 index 00000000000..8059767e890 --- /dev/null +++ b/examples/v2/openai-usage-and-costs-integration/UpdateOpenAIUsageAndCostsIntegrationAccount.java @@ -0,0 +1,66 @@ +// Update an OpenAI Usage and Costs account returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OpenAiUsageandCostsIntegrationApi; +import com.datadog.api.client.v2.model.IntegrationAccountType; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountResponse; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountSettingsUpdate; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountUpdateAttributes; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountUpdateData; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountUpdateRequest; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationDataflowsRequest; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled( + "v2.updateOpenAIUsageAndCostsIntegrationAccount", true); + OpenAiUsageandCostsIntegrationApi apiInstance = + new OpenAiUsageandCostsIntegrationApi(defaultClient); + + OpenAIUsageAndCostsIntegrationAccountUpdateRequest body = + new OpenAIUsageAndCostsIntegrationAccountUpdateRequest() + .data( + new OpenAIUsageAndCostsIntegrationAccountUpdateData() + .attributes( + new OpenAIUsageAndCostsIntegrationAccountUpdateAttributes() + .authentication( + new OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate( + new OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate() + .authType( + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType + .BEARER_TOKEN) + .token("your-token"))) + .dataflows( + new OpenAIUsageAndCostsIntegrationDataflowsRequest() + .openaiCloudCostData( + new OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest() + .enabled(true))) + .name("openai-usage-and-costs-acme") + .settings( + new OpenAIUsageAndCostsIntegrationAccountSettingsUpdate() + .customTags("team:ai,env:prod"))) + .id("9c4e7a2b-1d5f-4e8a-b3c6-0f2d8a6e4b17") + .type(IntegrationAccountType.INTEGRATION_ACCOUNT)); + + try { + OpenAIUsageAndCostsIntegrationAccountResponse result = + apiInstance.updateOpenAIUsageAndCostsIntegrationAccount("account_id", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling" + + " OpenAiUsageandCostsIntegrationApi#updateOpenAIUsageAndCostsIntegrationAccount"); + 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 5044cdd7ee4..9411b1608fa 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1586,6 +1586,11 @@ public class ApiClient { put("v2.getOpenAICodexIntegrationAccount", false); put("v2.listOpenAICodexIntegrationAccounts", false); put("v2.updateOpenAICodexIntegrationAccount", false); + put("v2.createOpenAIUsageAndCostsIntegrationAccount", false); + put("v2.deleteOpenAIUsageAndCostsIntegrationAccount", false); + put("v2.getOpenAIUsageAndCostsIntegrationAccount", false); + put("v2.listOpenAIUsageAndCostsIntegrationAccounts", false); + put("v2.updateOpenAIUsageAndCostsIntegrationAccount", false); put("v2.createSnowflakeIntegrationAccount", false); put("v2.deleteSnowflakeIntegrationAccount", false); put("v2.getSnowflakeIntegrationAccount", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/OpenAiUsageAndCostsIntegrationApi.java b/src/main/java/com/datadog/api/client/v2/api/OpenAiUsageAndCostsIntegrationApi.java new file mode 100644 index 00000000000..313cda4bbf1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/OpenAiUsageAndCostsIntegrationApi.java @@ -0,0 +1,859 @@ +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.OpenAIUsageAndCostsIntegrationAccountCreateRequest; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountResponse; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountUpdateRequest; +import com.datadog.api.client.v2.model.OpenAIUsageAndCostsIntegrationAccountsResponse; +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 OpenAiUsageAndCostsIntegrationApi { + private ApiClient apiClient; + + public OpenAiUsageAndCostsIntegrationApi() { + this(ApiClient.getDefaultApiClient()); + } + + public OpenAiUsageAndCostsIntegrationApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create an OpenAI Usage and Costs account. + * + *

See {@link #createOpenAIUsageAndCostsIntegrationAccountWithHttpInfo}. + * + * @param body (required) + * @return OpenAIUsageAndCostsIntegrationAccountResponse + * @throws ApiException if fails to make API call + */ + public OpenAIUsageAndCostsIntegrationAccountResponse createOpenAIUsageAndCostsIntegrationAccount( + OpenAIUsageAndCostsIntegrationAccountCreateRequest body) throws ApiException { + return createOpenAIUsageAndCostsIntegrationAccountWithHttpInfo(body).getData(); + } + + /** + * Create an OpenAI Usage and Costs account. + * + *

See {@link #createOpenAIUsageAndCostsIntegrationAccountWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<OpenAIUsageAndCostsIntegrationAccountResponse> + */ + public CompletableFuture + createOpenAIUsageAndCostsIntegrationAccountAsync( + OpenAIUsageAndCostsIntegrationAccountCreateRequest body) { + return createOpenAIUsageAndCostsIntegrationAccountWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create an OpenAI Usage and Costs integration account. + * + * @param body (required) + * @return ApiResponse<OpenAIUsageAndCostsIntegrationAccountResponse> + * @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 + createOpenAIUsageAndCostsIntegrationAccountWithHttpInfo( + OpenAIUsageAndCostsIntegrationAccountCreateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createOpenAIUsageAndCostsIntegrationAccount"; + 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" + + " createOpenAIUsageAndCostsIntegrationAccount"); + } + // create path and map variables + String localVarPath = "/api/v2/integration-interfaces/openai-usage-and-costs/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OpenAiUsageAndCostsIntegrationApi.createOpenAIUsageAndCostsIntegrationAccount", + 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 an OpenAI Usage and Costs account. + * + *

See {@link #createOpenAIUsageAndCostsIntegrationAccountWithHttpInfo}. + * + * @param body (required) + * @return + * CompletableFuture<ApiResponse<OpenAIUsageAndCostsIntegrationAccountResponse>> + */ + public CompletableFuture> + createOpenAIUsageAndCostsIntegrationAccountWithHttpInfoAsync( + OpenAIUsageAndCostsIntegrationAccountCreateRequest body) { + // Check if unstable operation is enabled + String operationId = "createOpenAIUsageAndCostsIntegrationAccount"; + 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" + + " createOpenAIUsageAndCostsIntegrationAccount")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/integration-interfaces/openai-usage-and-costs/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OpenAiUsageAndCostsIntegrationApi.createOpenAIUsageAndCostsIntegrationAccount", + 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 an OpenAI Usage and Costs account. + * + *

See {@link #deleteOpenAIUsageAndCostsIntegrationAccountWithHttpInfo}. + * + * @param accountId Unique identifier of the integration account. (required) + * @throws ApiException if fails to make API call + */ + public void deleteOpenAIUsageAndCostsIntegrationAccount(String accountId) throws ApiException { + deleteOpenAIUsageAndCostsIntegrationAccountWithHttpInfo(accountId); + } + + /** + * Delete an OpenAI Usage and Costs account. + * + *

See {@link #deleteOpenAIUsageAndCostsIntegrationAccountWithHttpInfoAsync}. + * + * @param accountId Unique identifier of the integration account. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteOpenAIUsageAndCostsIntegrationAccountAsync( + String accountId) { + return deleteOpenAIUsageAndCostsIntegrationAccountWithHttpInfoAsync(accountId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an OpenAI Usage and 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 deleteOpenAIUsageAndCostsIntegrationAccountWithHttpInfo(String accountId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteOpenAIUsageAndCostsIntegrationAccount"; + 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" + + " deleteOpenAIUsageAndCostsIntegrationAccount"); + } + // create path and map variables + String localVarPath = + "/api/v2/integration-interfaces/openai-usage-and-costs/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OpenAiUsageAndCostsIntegrationApi.deleteOpenAIUsageAndCostsIntegrationAccount", + 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 an OpenAI Usage and Costs account. + * + *

See {@link #deleteOpenAIUsageAndCostsIntegrationAccountWithHttpInfo}. + * + * @param accountId Unique identifier of the integration account. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> + deleteOpenAIUsageAndCostsIntegrationAccountWithHttpInfoAsync(String accountId) { + // Check if unstable operation is enabled + String operationId = "deleteOpenAIUsageAndCostsIntegrationAccount"; + 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" + + " deleteOpenAIUsageAndCostsIntegrationAccount")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/integration-interfaces/openai-usage-and-costs/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OpenAiUsageAndCostsIntegrationApi.deleteOpenAIUsageAndCostsIntegrationAccount", + 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 an OpenAI Usage and Costs account. + * + *

See {@link #getOpenAIUsageAndCostsIntegrationAccountWithHttpInfo}. + * + * @param accountId Unique identifier of the integration account. (required) + * @return OpenAIUsageAndCostsIntegrationAccountResponse + * @throws ApiException if fails to make API call + */ + public OpenAIUsageAndCostsIntegrationAccountResponse getOpenAIUsageAndCostsIntegrationAccount( + String accountId) throws ApiException { + return getOpenAIUsageAndCostsIntegrationAccountWithHttpInfo(accountId).getData(); + } + + /** + * Get an OpenAI Usage and Costs account. + * + *

See {@link #getOpenAIUsageAndCostsIntegrationAccountWithHttpInfoAsync}. + * + * @param accountId Unique identifier of the integration account. (required) + * @return CompletableFuture<OpenAIUsageAndCostsIntegrationAccountResponse> + */ + public CompletableFuture + getOpenAIUsageAndCostsIntegrationAccountAsync(String accountId) { + return getOpenAIUsageAndCostsIntegrationAccountWithHttpInfoAsync(accountId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get an OpenAI Usage and Costs integration account. + * + * @param accountId Unique identifier of the integration account. (required) + * @return ApiResponse<OpenAIUsageAndCostsIntegrationAccountResponse> + * @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 + getOpenAIUsageAndCostsIntegrationAccountWithHttpInfo(String accountId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getOpenAIUsageAndCostsIntegrationAccount"; + 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" + + " getOpenAIUsageAndCostsIntegrationAccount"); + } + // create path and map variables + String localVarPath = + "/api/v2/integration-interfaces/openai-usage-and-costs/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OpenAiUsageAndCostsIntegrationApi.getOpenAIUsageAndCostsIntegrationAccount", + 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 an OpenAI Usage and Costs account. + * + *

See {@link #getOpenAIUsageAndCostsIntegrationAccountWithHttpInfo}. + * + * @param accountId Unique identifier of the integration account. (required) + * @return + * CompletableFuture<ApiResponse<OpenAIUsageAndCostsIntegrationAccountResponse>> + */ + public CompletableFuture> + getOpenAIUsageAndCostsIntegrationAccountWithHttpInfoAsync(String accountId) { + // Check if unstable operation is enabled + String operationId = "getOpenAIUsageAndCostsIntegrationAccount"; + 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" + + " getOpenAIUsageAndCostsIntegrationAccount")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/integration-interfaces/openai-usage-and-costs/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OpenAiUsageAndCostsIntegrationApi.getOpenAIUsageAndCostsIntegrationAccount", + 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 OpenAI Usage and Costs accounts. + * + *

See {@link #listOpenAIUsageAndCostsIntegrationAccountsWithHttpInfo}. + * + * @return OpenAIUsageAndCostsIntegrationAccountsResponse + * @throws ApiException if fails to make API call + */ + public OpenAIUsageAndCostsIntegrationAccountsResponse listOpenAIUsageAndCostsIntegrationAccounts() + throws ApiException { + return listOpenAIUsageAndCostsIntegrationAccountsWithHttpInfo().getData(); + } + + /** + * List OpenAI Usage and Costs accounts. + * + *

See {@link #listOpenAIUsageAndCostsIntegrationAccountsWithHttpInfoAsync}. + * + * @return CompletableFuture<OpenAIUsageAndCostsIntegrationAccountsResponse> + */ + public CompletableFuture + listOpenAIUsageAndCostsIntegrationAccountsAsync() { + return listOpenAIUsageAndCostsIntegrationAccountsWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List OpenAI Usage and Costs integration accounts. + * + * @return ApiResponse<OpenAIUsageAndCostsIntegrationAccountsResponse> + * @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 + listOpenAIUsageAndCostsIntegrationAccountsWithHttpInfo() throws ApiException { + // Check if unstable operation is enabled + String operationId = "listOpenAIUsageAndCostsIntegrationAccounts"; + 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/openai-usage-and-costs/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OpenAiUsageAndCostsIntegrationApi.listOpenAIUsageAndCostsIntegrationAccounts", + 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 OpenAI Usage and Costs accounts. + * + *

See {@link #listOpenAIUsageAndCostsIntegrationAccountsWithHttpInfo}. + * + * @return + * CompletableFuture<ApiResponse<OpenAIUsageAndCostsIntegrationAccountsResponse>> + */ + public CompletableFuture> + listOpenAIUsageAndCostsIntegrationAccountsWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "listOpenAIUsageAndCostsIntegrationAccounts"; + 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/openai-usage-and-costs/accounts"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OpenAiUsageAndCostsIntegrationApi.listOpenAIUsageAndCostsIntegrationAccounts", + 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 an OpenAI Usage and Costs account. + * + *

See {@link #updateOpenAIUsageAndCostsIntegrationAccountWithHttpInfo}. + * + * @param accountId Unique identifier of the integration account. (required) + * @param body (required) + * @return OpenAIUsageAndCostsIntegrationAccountResponse + * @throws ApiException if fails to make API call + */ + public OpenAIUsageAndCostsIntegrationAccountResponse updateOpenAIUsageAndCostsIntegrationAccount( + String accountId, OpenAIUsageAndCostsIntegrationAccountUpdateRequest body) + throws ApiException { + return updateOpenAIUsageAndCostsIntegrationAccountWithHttpInfo(accountId, body).getData(); + } + + /** + * Update an OpenAI Usage and Costs account. + * + *

See {@link #updateOpenAIUsageAndCostsIntegrationAccountWithHttpInfoAsync}. + * + * @param accountId Unique identifier of the integration account. (required) + * @param body (required) + * @return CompletableFuture<OpenAIUsageAndCostsIntegrationAccountResponse> + */ + public CompletableFuture + updateOpenAIUsageAndCostsIntegrationAccountAsync( + String accountId, OpenAIUsageAndCostsIntegrationAccountUpdateRequest body) { + return updateOpenAIUsageAndCostsIntegrationAccountWithHttpInfoAsync(accountId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update an OpenAI Usage and Costs integration account. Only the fields provided are changed. + * + * @param accountId Unique identifier of the integration account. (required) + * @param body (required) + * @return ApiResponse<OpenAIUsageAndCostsIntegrationAccountResponse> + * @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 + updateOpenAIUsageAndCostsIntegrationAccountWithHttpInfo( + String accountId, OpenAIUsageAndCostsIntegrationAccountUpdateRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateOpenAIUsageAndCostsIntegrationAccount"; + 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" + + " updateOpenAIUsageAndCostsIntegrationAccount"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " updateOpenAIUsageAndCostsIntegrationAccount"); + } + // create path and map variables + String localVarPath = + "/api/v2/integration-interfaces/openai-usage-and-costs/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OpenAiUsageAndCostsIntegrationApi.updateOpenAIUsageAndCostsIntegrationAccount", + 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 an OpenAI Usage and Costs account. + * + *

See {@link #updateOpenAIUsageAndCostsIntegrationAccountWithHttpInfo}. + * + * @param accountId Unique identifier of the integration account. (required) + * @param body (required) + * @return + * CompletableFuture<ApiResponse<OpenAIUsageAndCostsIntegrationAccountResponse>> + */ + public CompletableFuture> + updateOpenAIUsageAndCostsIntegrationAccountWithHttpInfoAsync( + String accountId, OpenAIUsageAndCostsIntegrationAccountUpdateRequest body) { + // Check if unstable operation is enabled + String operationId = "updateOpenAIUsageAndCostsIntegrationAccount"; + 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" + + " updateOpenAIUsageAndCostsIntegrationAccount")); + 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" + + " updateOpenAIUsageAndCostsIntegrationAccount")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/integration-interfaces/openai-usage-and-costs/accounts/{account_id}" + .replaceAll("\\{" + "account_id" + "\\}", apiClient.escapeString(accountId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OpenAiUsageAndCostsIntegrationApi.updateOpenAIUsageAndCostsIntegrationAccount", + 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/OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest.java new file mode 100644 index 00000000000..71e8a4731ad --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest.java @@ -0,0 +1,96 @@ +/* + * 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; + +/** + * OpenAI organization costs, which you can analyze in Cloud Cost Management. See collected + * data for what is included. Cost data appears in Cloud Cost Management within 24 hours after + * you enable this dataflow. + */ +@JsonPropertyOrder({ + OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest.JSON_PROPERTY_ENABLED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether Datadog collects this data. Defaults to false. Set to true to + * start collection. + * + * @return enabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + /** + * Return true if this OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest object is equal + * to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest + openAiUsageAndCostsCloudCostDataIntegrationDataflowRequest = + (OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest) o; + return Objects.equals( + this.enabled, openAiUsageAndCostsCloudCostDataIntegrationDataflowRequest.enabled); + } + + @Override + public int hashCode() { + return Objects.hash(enabled); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).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/OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse.java new file mode 100644 index 00000000000..1fbf704fb0b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse.java @@ -0,0 +1,170 @@ +/* + * 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; + +/** + * OpenAI organization costs, which you can analyze in Cloud Cost Management. See collected + * data for what is included. + */ +@JsonPropertyOrder({ + OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse.JSON_PROPERTY_ENABLED, + OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse { + @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; + + public OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether Datadog collects this data. + * + * @return enabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = 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 OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse + */ + @JsonAnySetter + public OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse 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 OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse object is equal + * to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse + openAiUsageAndCostsCloudCostDataIntegrationDataflowResponse = + (OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse) o; + return Objects.equals( + this.enabled, openAiUsageAndCostsCloudCostDataIntegrationDataflowResponse.enabled) + && Objects.equals( + this.status, openAiUsageAndCostsCloudCostDataIntegrationDataflowResponse.status) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsCloudCostDataIntegrationDataflowResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse {\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/OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest.java new file mode 100644 index 00000000000..5bd85941e6e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest.java @@ -0,0 +1,259 @@ +/* + * 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 = + OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest + .OpenAIUsageAndCostsIntegrationAccountAuthenticationRequestDeserializer.class) +@JsonSerialize( + using = + OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest + .OpenAIUsageAndCostsIntegrationAccountAuthenticationRequestSerializer.class) +public class OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest + extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class OpenAIUsageAndCostsIntegrationAccountAuthenticationRequestSerializer + extends StdSerializer { + public OpenAIUsageAndCostsIntegrationAccountAuthenticationRequestSerializer( + Class t) { + super(t); + } + + public OpenAIUsageAndCostsIntegrationAccountAuthenticationRequestSerializer() { + this(null); + } + + @Override + public void serialize( + OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class OpenAIUsageAndCostsIntegrationAccountAuthenticationRequestDeserializer + extends StdDeserializer { + public OpenAIUsageAndCostsIntegrationAccountAuthenticationRequestDeserializer() { + this(OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest.class); + } + + public OpenAIUsageAndCostsIntegrationAccountAuthenticationRequestDeserializer(Class vc) { + super(vc); + } + + @Override + public OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest 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 OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.class.equals(Integer.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.class.equals(Long.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.class.equals(Float.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.class.equals( + Double.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.class.equals( + Boolean.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.class.equals( + String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.class.equals( + Integer.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.class.equals( + Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.class.equals( + Float.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.class.equals( + Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.class.equals( + Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.class.equals( + String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.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 (!((OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema" + + " 'OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema" + + " 'OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest'", + e); + } + + OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest ret = + new OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest(); + 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 OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest getNullValue( + DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), + "OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest() { + super("oneOf", Boolean.FALSE); + } + + public OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest( + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest", + new GenericType() {}); + JSON.registerDescendants( + OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest.class, + Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest + * + *

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( + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.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" + + " OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest"); + } + + /** + * Get the actual instance, which can be the following: + * OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest + * + * @return The actual instance (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest`. If + * the actual instance is not `OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest` + * @throws ClassCastException if the instance is not + * `OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest` + */ + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest + getOpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest() throws ClassCastException { + return (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse.java new file mode 100644 index 00000000000..1b44c793a64 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse.java @@ -0,0 +1,260 @@ +/* + * 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 = + OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse + .OpenAIUsageAndCostsIntegrationAccountAuthenticationResponseDeserializer.class) +@JsonSerialize( + using = + OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse + .OpenAIUsageAndCostsIntegrationAccountAuthenticationResponseSerializer.class) +public class OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse + extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class OpenAIUsageAndCostsIntegrationAccountAuthenticationResponseSerializer + extends StdSerializer { + public OpenAIUsageAndCostsIntegrationAccountAuthenticationResponseSerializer( + Class t) { + super(t); + } + + public OpenAIUsageAndCostsIntegrationAccountAuthenticationResponseSerializer() { + this(null); + } + + @Override + public void serialize( + OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class OpenAIUsageAndCostsIntegrationAccountAuthenticationResponseDeserializer + extends StdDeserializer { + public OpenAIUsageAndCostsIntegrationAccountAuthenticationResponseDeserializer() { + this(OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse.class); + } + + public OpenAIUsageAndCostsIntegrationAccountAuthenticationResponseDeserializer(Class vc) { + super(vc); + } + + @Override + public OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse 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 OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.class.equals(Integer.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.class.equals(Long.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.class.equals( + Float.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.class.equals( + Double.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.class.equals( + Boolean.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.class.equals( + String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.class.equals( + Integer.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.class + .equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.class.equals( + Float.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.class + .equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.class.equals( + Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.class.equals( + String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.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 (!((OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema" + + " 'OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema" + + " 'OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse'", + e); + } + + OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse ret = + new OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse(); + 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 OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse getNullValue( + DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), + "OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse() { + super("oneOf", Boolean.FALSE); + } + + public OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse( + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse", + new GenericType() {}); + JSON.registerDescendants( + OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse.class, + Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse + * + *

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( + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.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" + + " OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse"); + } + + /** + * Get the actual instance, which can be the following: + * OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse + * + * @return The actual instance (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse`. If + * the actual instance is not `OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse` + * @throws ClassCastException if the instance is not + * `OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse` + */ + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse + getOpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse() throws ClassCastException { + return (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate.java new file mode 100644 index 00000000000..d6bee8b1a22 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate.java @@ -0,0 +1,258 @@ +/* + * 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 = + OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate + .OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdateDeserializer.class) +@JsonSerialize( + using = + OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate + .OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdateSerializer.class) +public class OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate + extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdateSerializer + extends StdSerializer { + public OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdateSerializer( + Class t) { + super(t); + } + + public OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdateDeserializer + extends StdDeserializer { + public OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdateDeserializer() { + this(OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate.class); + } + + public OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate 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 OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.class.equals(Integer.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.class.equals(Long.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.class.equals(Float.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.class.equals(Double.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.class.equals( + Boolean.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.class.equals( + String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.class.equals( + Integer.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.class.equals( + Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.class.equals( + Float.class) + || OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.class.equals( + Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.class.equals( + Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.class.equals( + String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.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 (!((OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema" + + " 'OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema" + + " 'OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate'", + e); + } + + OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate ret = + new OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate(); + 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 OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate getNullValue( + DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), + "OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate() { + super("oneOf", Boolean.FALSE); + } + + public OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate( + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate", + new GenericType() {}); + JSON.registerDescendants( + OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate.class, + Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate + * + *

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( + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.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" + + " OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate"); + } + + /** + * Get the actual instance, which can be the following: + * OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate + * + * @return The actual instance (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate`. If the + * actual instance is not `OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate` + * @throws ClassCastException if the instance is not + * `OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate` + */ + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate + getOpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate() throws ClassCastException { + return (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.java new file mode 100644 index 00000000000..60b694b3541 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.java @@ -0,0 +1,138 @@ +/* + * 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 an admin-scoped OpenAI API key. Project-scoped and standard keys + * cannot read organization usage or costs. Requests with an invalid key, or with a key that is not + * an admin key, return a 422 response. + */ +@JsonPropertyOrder({ + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.JSON_PROPERTY_AUTH_TYPE, + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest.JSON_PROPERTY_TOKEN +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTH_TYPE = "auth_type"; + private OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType authType = + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType.BEARER_TOKEN; + + public static final String JSON_PROPERTY_TOKEN = "token"; + private String token; + + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest() {} + + @JsonCreator + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_AUTH_TYPE) + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType authType, + @JsonProperty(required = true, value = JSON_PROPERTY_TOKEN) String token) { + this.authType = authType; + this.unparsed |= !authType.isValid(); + this.token = token; + } + + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest authType( + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType 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 OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType getAuthType() { + return authType; + } + + public void setAuthType(OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType authType) { + if (!authType.isValid()) { + this.unparsed = true; + } + this.authType = authType; + } + + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest token(String token) { + this.token = token; + return this; + } + + /** + * Secret token used to authenticate with OpenAI. + * + * @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 OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest object is equal + * to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest + openAiUsageAndCostsIntegrationAccountBearerTokenAuthRequest = + (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest) o; + return Objects.equals( + this.authType, openAiUsageAndCostsIntegrationAccountBearerTokenAuthRequest.authType) + && Objects.equals( + this.token, openAiUsageAndCostsIntegrationAccountBearerTokenAuthRequest.token); + } + + @Override + public int hashCode() { + return Objects.hash(authType, token); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthRequest {\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/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.java new file mode 100644 index 00000000000..a8103c67ec3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.java @@ -0,0 +1,162 @@ +/* + * 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({ + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse.JSON_PROPERTY_AUTH_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTH_TYPE = "auth_type"; + private OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType authType = + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType.BEARER_TOKEN; + + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse() {} + + @JsonCreator + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_AUTH_TYPE) + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType authType) { + this.authType = authType; + this.unparsed |= !authType.isValid(); + } + + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse authType( + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType 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 OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType getAuthType() { + return authType; + } + + public void setAuthType(OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType 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 OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse + */ + @JsonAnySetter + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse 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 OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse object is + * equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse + openAiUsageAndCostsIntegrationAccountBearerTokenAuthResponse = + (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse) o; + return Objects.equals( + this.authType, openAiUsageAndCostsIntegrationAccountBearerTokenAuthResponse.authType) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsIntegrationAccountBearerTokenAuthResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(authType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthResponse {\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/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType.java new file mode 100644 index 00000000000..ca892b05830 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType.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 = + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType + .OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthTypeSerializer.class) +public class OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("bearer_token")); + + public static final OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType BEARER_TOKEN = + new OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType("bearer_token"); + + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType(String value) { + super(value, allowedValues); + } + + public static class OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthTypeSerializer + extends StdSerializer { + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthTypeSerializer( + Class t) { + super(t); + } + + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthTypeSerializer() { + this(null); + } + + @Override + public void serialize( + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType fromValue(String value) { + return new OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.java new file mode 100644 index 00000000000..4662228d1bf --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.java @@ -0,0 +1,138 @@ +/* + * 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 an admin-scoped OpenAI API key. Project-scoped and standard keys + * cannot read organization usage or costs. Requests with an invalid key, or with a key that is not + * an admin key, return a 422 response. Only the provided fields are changed. To keep + * the stored token, omit token. + */ +@JsonPropertyOrder({ + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.JSON_PROPERTY_AUTH_TYPE, + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.JSON_PROPERTY_TOKEN +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTH_TYPE = "auth_type"; + private OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType authType = + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType.BEARER_TOKEN; + + public static final String JSON_PROPERTY_TOKEN = "token"; + private String token; + + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate() {} + + @JsonCreator + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_AUTH_TYPE) + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType authType) { + this.authType = authType; + this.unparsed |= !authType.isValid(); + } + + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate authType( + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType 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 OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType getAuthType() { + return authType; + } + + public void setAuthType(OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthType authType) { + if (!authType.isValid()) { + this.unparsed = true; + } + this.authType = authType; + } + + public OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate token(String token) { + this.token = token; + return this; + } + + /** + * Secret token used to authenticate with OpenAI. + * + * @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 OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate object is equal + * to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate + openAiUsageAndCostsIntegrationAccountBearerTokenAuthUpdate = + (OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate) o; + return Objects.equals( + this.authType, openAiUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.authType) + && Objects.equals( + this.token, openAiUsageAndCostsIntegrationAccountBearerTokenAuthUpdate.token); + } + + @Override + public int hashCode() { + return Objects.hash(authType, token); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountBearerTokenAuthUpdate {\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/OpenAIUsageAndCostsIntegrationAccountCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountCreateAttributes.java new file mode 100644 index 00000000000..37a4206cb43 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountCreateAttributes.java @@ -0,0 +1,263 @@ +/* + * 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 an OpenAI Usage and Costs integration account. */ +@JsonPropertyOrder({ + OpenAIUsageAndCostsIntegrationAccountCreateAttributes.JSON_PROPERTY_AUTHENTICATION, + OpenAIUsageAndCostsIntegrationAccountCreateAttributes.JSON_PROPERTY_DATAFLOWS, + OpenAIUsageAndCostsIntegrationAccountCreateAttributes.JSON_PROPERTY_NAME, + OpenAIUsageAndCostsIntegrationAccountCreateAttributes.JSON_PROPERTY_SETTINGS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountCreateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTHENTICATION = "authentication"; + private OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest authentication; + + public static final String JSON_PROPERTY_DATAFLOWS = "dataflows"; + private OpenAIUsageAndCostsIntegrationDataflowsRequest dataflows; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SETTINGS = "settings"; + private OpenAIUsageAndCostsIntegrationAccountSettingsRequest settings; + + public OpenAIUsageAndCostsIntegrationAccountCreateAttributes() {} + + @JsonCreator + public OpenAIUsageAndCostsIntegrationAccountCreateAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_AUTHENTICATION) + OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest authentication, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_SETTINGS) + OpenAIUsageAndCostsIntegrationAccountSettingsRequest settings) { + this.authentication = authentication; + this.unparsed |= authentication.unparsed; + this.name = name; + this.settings = settings; + this.unparsed |= settings.unparsed; + } + + public OpenAIUsageAndCostsIntegrationAccountCreateAttributes authentication( + OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest authentication) { + this.authentication = authentication; + this.unparsed |= authentication.unparsed; + return this; + } + + /** + * Authentication for creating the OpenAI Usage and Costs integration account. Set exactly one + * method. + * + * @return authentication + */ + @JsonProperty(JSON_PROPERTY_AUTHENTICATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest getAuthentication() { + return authentication; + } + + public void setAuthentication( + OpenAIUsageAndCostsIntegrationAccountAuthenticationRequest authentication) { + this.authentication = authentication; + if (authentication != null) { + this.unparsed |= authentication.unparsed; + } + } + + public OpenAIUsageAndCostsIntegrationAccountCreateAttributes dataflows( + OpenAIUsageAndCostsIntegrationDataflowsRequest dataflows) { + this.dataflows = dataflows; + this.unparsed |= dataflows.unparsed; + return this; + } + + /** + * Data Datadog collects from OpenAI Usage and Costs, keyed by dataflow ID. Datadog always + * collects organization usage metrics. Each dataflow in this object adds another type of + * collection. Set enabled to start or stop a dataflow. The default for each dataflow + * applies when the account is created. On update, omitted fields keep their current values. + * + * @return dataflows + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATAFLOWS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OpenAIUsageAndCostsIntegrationDataflowsRequest getDataflows() { + return dataflows; + } + + public void setDataflows(OpenAIUsageAndCostsIntegrationDataflowsRequest dataflows) { + this.dataflows = dataflows; + if (dataflows != null) { + this.unparsed |= dataflows.unparsed; + } + } + + public OpenAIUsageAndCostsIntegrationAccountCreateAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Human-readable name of the OpenAI Usage and 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 OpenAIUsageAndCostsIntegrationAccountCreateAttributes settings( + OpenAIUsageAndCostsIntegrationAccountSettingsRequest settings) { + this.settings = settings; + this.unparsed |= settings.unparsed; + return this; + } + + /** + * Settings for creating the OpenAI Usage and Costs integration account. + * + * @return settings + */ + @JsonProperty(JSON_PROPERTY_SETTINGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OpenAIUsageAndCostsIntegrationAccountSettingsRequest getSettings() { + return settings; + } + + public void setSettings(OpenAIUsageAndCostsIntegrationAccountSettingsRequest 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 OpenAIUsageAndCostsIntegrationAccountCreateAttributes + */ + @JsonAnySetter + public OpenAIUsageAndCostsIntegrationAccountCreateAttributes 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 OpenAIUsageAndCostsIntegrationAccountCreateAttributes object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountCreateAttributes + openAiUsageAndCostsIntegrationAccountCreateAttributes = + (OpenAIUsageAndCostsIntegrationAccountCreateAttributes) o; + return Objects.equals( + this.authentication, + openAiUsageAndCostsIntegrationAccountCreateAttributes.authentication) + && Objects.equals( + this.dataflows, openAiUsageAndCostsIntegrationAccountCreateAttributes.dataflows) + && Objects.equals(this.name, openAiUsageAndCostsIntegrationAccountCreateAttributes.name) + && Objects.equals( + this.settings, openAiUsageAndCostsIntegrationAccountCreateAttributes.settings) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsIntegrationAccountCreateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(authentication, dataflows, name, settings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountCreateAttributes {\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/OpenAIUsageAndCostsIntegrationAccountCreateData.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountCreateData.java new file mode 100644 index 00000000000..873ada8c3bf --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountCreateData.java @@ -0,0 +1,191 @@ +/* + * 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 an OpenAI Usage and Costs integration account. */ +@JsonPropertyOrder({ + OpenAIUsageAndCostsIntegrationAccountCreateData.JSON_PROPERTY_ATTRIBUTES, + OpenAIUsageAndCostsIntegrationAccountCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private OpenAIUsageAndCostsIntegrationAccountCreateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IntegrationAccountType type = IntegrationAccountType.INTEGRATION_ACCOUNT; + + public OpenAIUsageAndCostsIntegrationAccountCreateData() {} + + @JsonCreator + public OpenAIUsageAndCostsIntegrationAccountCreateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + OpenAIUsageAndCostsIntegrationAccountCreateAttributes 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 OpenAIUsageAndCostsIntegrationAccountCreateData attributes( + OpenAIUsageAndCostsIntegrationAccountCreateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Writable attributes used to create an OpenAI Usage and Costs integration account. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OpenAIUsageAndCostsIntegrationAccountCreateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(OpenAIUsageAndCostsIntegrationAccountCreateAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public OpenAIUsageAndCostsIntegrationAccountCreateData 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 OpenAIUsageAndCostsIntegrationAccountCreateData + */ + @JsonAnySetter + public OpenAIUsageAndCostsIntegrationAccountCreateData 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 OpenAIUsageAndCostsIntegrationAccountCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountCreateData + openAiUsageAndCostsIntegrationAccountCreateData = + (OpenAIUsageAndCostsIntegrationAccountCreateData) o; + return Objects.equals( + this.attributes, openAiUsageAndCostsIntegrationAccountCreateData.attributes) + && Objects.equals(this.type, openAiUsageAndCostsIntegrationAccountCreateData.type) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsIntegrationAccountCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountCreateData {\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/OpenAIUsageAndCostsIntegrationAccountCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountCreateRequest.java new file mode 100644 index 00000000000..a363098fe42 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountCreateRequest.java @@ -0,0 +1,157 @@ +/* + * 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 an OpenAI Usage and Costs integration account. */ +@JsonPropertyOrder({OpenAIUsageAndCostsIntegrationAccountCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private OpenAIUsageAndCostsIntegrationAccountCreateData data; + + public OpenAIUsageAndCostsIntegrationAccountCreateRequest() {} + + @JsonCreator + public OpenAIUsageAndCostsIntegrationAccountCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + OpenAIUsageAndCostsIntegrationAccountCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public OpenAIUsageAndCostsIntegrationAccountCreateRequest data( + OpenAIUsageAndCostsIntegrationAccountCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data envelope for creating an OpenAI Usage and Costs integration account. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OpenAIUsageAndCostsIntegrationAccountCreateData getData() { + return data; + } + + public void setData(OpenAIUsageAndCostsIntegrationAccountCreateData 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 OpenAIUsageAndCostsIntegrationAccountCreateRequest + */ + @JsonAnySetter + public OpenAIUsageAndCostsIntegrationAccountCreateRequest 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 OpenAIUsageAndCostsIntegrationAccountCreateRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountCreateRequest + openAiUsageAndCostsIntegrationAccountCreateRequest = + (OpenAIUsageAndCostsIntegrationAccountCreateRequest) o; + return Objects.equals(this.data, openAiUsageAndCostsIntegrationAccountCreateRequest.data) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsIntegrationAccountCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountCreateRequest {\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/OpenAIUsageAndCostsIntegrationAccountResponse.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountResponse.java new file mode 100644 index 00000000000..ae6f669dac2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountResponse.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.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 OpenAI Usage and Costs integration account. */ +@JsonPropertyOrder({OpenAIUsageAndCostsIntegrationAccountResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private OpenAIUsageAndCostsIntegrationAccountResponseData data; + + public OpenAIUsageAndCostsIntegrationAccountResponse() {} + + @JsonCreator + public OpenAIUsageAndCostsIntegrationAccountResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + OpenAIUsageAndCostsIntegrationAccountResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public OpenAIUsageAndCostsIntegrationAccountResponse data( + OpenAIUsageAndCostsIntegrationAccountResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data envelope of an OpenAI Usage and Costs integration account, including server-assigned + * identity. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OpenAIUsageAndCostsIntegrationAccountResponseData getData() { + return data; + } + + public void setData(OpenAIUsageAndCostsIntegrationAccountResponseData 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 OpenAIUsageAndCostsIntegrationAccountResponse + */ + @JsonAnySetter + public OpenAIUsageAndCostsIntegrationAccountResponse 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 OpenAIUsageAndCostsIntegrationAccountResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountResponse openAiUsageAndCostsIntegrationAccountResponse = + (OpenAIUsageAndCostsIntegrationAccountResponse) o; + return Objects.equals(this.data, openAiUsageAndCostsIntegrationAccountResponse.data) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsIntegrationAccountResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountResponse {\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/OpenAIUsageAndCostsIntegrationAccountResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountResponseAttributes.java new file mode 100644 index 00000000000..03c3c9d95a3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountResponseAttributes.java @@ -0,0 +1,257 @@ +/* + * 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 an OpenAI Usage and Costs integration account returned in responses. */ +@JsonPropertyOrder({ + OpenAIUsageAndCostsIntegrationAccountResponseAttributes.JSON_PROPERTY_AUTHENTICATION, + OpenAIUsageAndCostsIntegrationAccountResponseAttributes.JSON_PROPERTY_DATAFLOWS, + OpenAIUsageAndCostsIntegrationAccountResponseAttributes.JSON_PROPERTY_NAME, + OpenAIUsageAndCostsIntegrationAccountResponseAttributes.JSON_PROPERTY_SETTINGS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTHENTICATION = "authentication"; + private OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse authentication; + + public static final String JSON_PROPERTY_DATAFLOWS = "dataflows"; + private OpenAIUsageAndCostsIntegrationDataflowsResponse dataflows; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SETTINGS = "settings"; + private OpenAIUsageAndCostsIntegrationAccountSettingsResponse settings; + + public OpenAIUsageAndCostsIntegrationAccountResponseAttributes() {} + + @JsonCreator + public OpenAIUsageAndCostsIntegrationAccountResponseAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_SETTINGS) + OpenAIUsageAndCostsIntegrationAccountSettingsResponse settings) { + this.name = name; + this.settings = settings; + this.unparsed |= settings.unparsed; + } + + public OpenAIUsageAndCostsIntegrationAccountResponseAttributes authentication( + OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse authentication) { + this.authentication = authentication; + this.unparsed |= authentication.unparsed; + return this; + } + + /** + * Authentication configured on the OpenAI Usage and Costs integration account. + * + * @return authentication + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHENTICATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse getAuthentication() { + return authentication; + } + + public void setAuthentication( + OpenAIUsageAndCostsIntegrationAccountAuthenticationResponse authentication) { + this.authentication = authentication; + if (authentication != null) { + this.unparsed |= authentication.unparsed; + } + } + + public OpenAIUsageAndCostsIntegrationAccountResponseAttributes dataflows( + OpenAIUsageAndCostsIntegrationDataflowsResponse dataflows) { + this.dataflows = dataflows; + this.unparsed |= dataflows.unparsed; + return this; + } + + /** + * Data Datadog collects from OpenAI Usage and Costs, keyed by dataflow ID. + * + * @return dataflows + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATAFLOWS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OpenAIUsageAndCostsIntegrationDataflowsResponse getDataflows() { + return dataflows; + } + + public void setDataflows(OpenAIUsageAndCostsIntegrationDataflowsResponse dataflows) { + this.dataflows = dataflows; + if (dataflows != null) { + this.unparsed |= dataflows.unparsed; + } + } + + public OpenAIUsageAndCostsIntegrationAccountResponseAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Human-readable name of the OpenAI Usage and 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 OpenAIUsageAndCostsIntegrationAccountResponseAttributes settings( + OpenAIUsageAndCostsIntegrationAccountSettingsResponse settings) { + this.settings = settings; + this.unparsed |= settings.unparsed; + return this; + } + + /** + * Settings configured on the OpenAI Usage and Costs integration account. + * + * @return settings + */ + @JsonProperty(JSON_PROPERTY_SETTINGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OpenAIUsageAndCostsIntegrationAccountSettingsResponse getSettings() { + return settings; + } + + public void setSettings(OpenAIUsageAndCostsIntegrationAccountSettingsResponse 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 OpenAIUsageAndCostsIntegrationAccountResponseAttributes + */ + @JsonAnySetter + public OpenAIUsageAndCostsIntegrationAccountResponseAttributes 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 OpenAIUsageAndCostsIntegrationAccountResponseAttributes object is equal to + * o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountResponseAttributes + openAiUsageAndCostsIntegrationAccountResponseAttributes = + (OpenAIUsageAndCostsIntegrationAccountResponseAttributes) o; + return Objects.equals( + this.authentication, + openAiUsageAndCostsIntegrationAccountResponseAttributes.authentication) + && Objects.equals( + this.dataflows, openAiUsageAndCostsIntegrationAccountResponseAttributes.dataflows) + && Objects.equals(this.name, openAiUsageAndCostsIntegrationAccountResponseAttributes.name) + && Objects.equals( + this.settings, openAiUsageAndCostsIntegrationAccountResponseAttributes.settings) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsIntegrationAccountResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(authentication, dataflows, name, settings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountResponseAttributes {\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/OpenAIUsageAndCostsIntegrationAccountResponseData.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountResponseData.java new file mode 100644 index 00000000000..1e6bb6777e9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountResponseData.java @@ -0,0 +1,213 @@ +/* + * 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 an OpenAI Usage and Costs integration account, including server-assigned + * identity. + */ +@JsonPropertyOrder({ + OpenAIUsageAndCostsIntegrationAccountResponseData.JSON_PROPERTY_ATTRIBUTES, + OpenAIUsageAndCostsIntegrationAccountResponseData.JSON_PROPERTY_ID, + OpenAIUsageAndCostsIntegrationAccountResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private OpenAIUsageAndCostsIntegrationAccountResponseAttributes 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 OpenAIUsageAndCostsIntegrationAccountResponseData() {} + + @JsonCreator + public OpenAIUsageAndCostsIntegrationAccountResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + OpenAIUsageAndCostsIntegrationAccountResponseAttributes 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 OpenAIUsageAndCostsIntegrationAccountResponseData attributes( + OpenAIUsageAndCostsIntegrationAccountResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of an OpenAI Usage and Costs integration account returned in responses. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OpenAIUsageAndCostsIntegrationAccountResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(OpenAIUsageAndCostsIntegrationAccountResponseAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + /** + * Server-generated unique identifier of the OpenAI Usage and Costs integration account. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public OpenAIUsageAndCostsIntegrationAccountResponseData 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 OpenAIUsageAndCostsIntegrationAccountResponseData + */ + @JsonAnySetter + public OpenAIUsageAndCostsIntegrationAccountResponseData 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 OpenAIUsageAndCostsIntegrationAccountResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountResponseData + openAiUsageAndCostsIntegrationAccountResponseData = + (OpenAIUsageAndCostsIntegrationAccountResponseData) o; + return Objects.equals( + this.attributes, openAiUsageAndCostsIntegrationAccountResponseData.attributes) + && Objects.equals(this.id, openAiUsageAndCostsIntegrationAccountResponseData.id) + && Objects.equals(this.type, openAiUsageAndCostsIntegrationAccountResponseData.type) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsIntegrationAccountResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountResponseData {\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/OpenAIUsageAndCostsIntegrationAccountSettingsRequest.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountSettingsRequest.java new file mode 100644 index 00000000000..7d6e4f9091f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountSettingsRequest.java @@ -0,0 +1,87 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +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 creating the OpenAI Usage and Costs integration account. */ +@JsonPropertyOrder({OpenAIUsageAndCostsIntegrationAccountSettingsRequest.JSON_PROPERTY_CUSTOM_TAGS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountSettingsRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CUSTOM_TAGS = "custom_tags"; + private String customTags; + + public OpenAIUsageAndCostsIntegrationAccountSettingsRequest customTags(String customTags) { + this.customTags = customTags; + return this; + } + + /** + * Comma-separated list of custom tags applied to the data collected for this account, for example + * team:ai,env:prod. + * + * @return customTags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CUSTOM_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCustomTags() { + return customTags; + } + + public void setCustomTags(String customTags) { + this.customTags = customTags; + } + + /** + * Return true if this OpenAIUsageAndCostsIntegrationAccountSettingsRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountSettingsRequest + openAiUsageAndCostsIntegrationAccountSettingsRequest = + (OpenAIUsageAndCostsIntegrationAccountSettingsRequest) o; + return Objects.equals( + this.customTags, openAiUsageAndCostsIntegrationAccountSettingsRequest.customTags); + } + + @Override + public int hashCode() { + return Objects.hash(customTags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountSettingsRequest {\n"); + sb.append(" customTags: ").append(toIndentedString(customTags)).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/OpenAIUsageAndCostsIntegrationAccountSettingsResponse.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountSettingsResponse.java new file mode 100644 index 00000000000..7cd203dbf89 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountSettingsResponse.java @@ -0,0 +1,146 @@ +/* + * 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; + +/** Settings configured on the OpenAI Usage and Costs integration account. */ +@JsonPropertyOrder({ + OpenAIUsageAndCostsIntegrationAccountSettingsResponse.JSON_PROPERTY_CUSTOM_TAGS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountSettingsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CUSTOM_TAGS = "custom_tags"; + private String customTags; + + public OpenAIUsageAndCostsIntegrationAccountSettingsResponse customTags(String customTags) { + this.customTags = customTags; + return this; + } + + /** + * Comma-separated list of custom tags applied to the data collected for this account, for example + * team:ai,env:prod. + * + * @return customTags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CUSTOM_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCustomTags() { + return customTags; + } + + public void setCustomTags(String customTags) { + this.customTags = customTags; + } + + /** + * 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 OpenAIUsageAndCostsIntegrationAccountSettingsResponse + */ + @JsonAnySetter + public OpenAIUsageAndCostsIntegrationAccountSettingsResponse 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 OpenAIUsageAndCostsIntegrationAccountSettingsResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountSettingsResponse + openAiUsageAndCostsIntegrationAccountSettingsResponse = + (OpenAIUsageAndCostsIntegrationAccountSettingsResponse) o; + return Objects.equals( + this.customTags, openAiUsageAndCostsIntegrationAccountSettingsResponse.customTags) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsIntegrationAccountSettingsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(customTags, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountSettingsResponse {\n"); + sb.append(" customTags: ").append(toIndentedString(customTags)).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/OpenAIUsageAndCostsIntegrationAccountSettingsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountSettingsUpdate.java new file mode 100644 index 00000000000..bf0df8749df --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountSettingsUpdate.java @@ -0,0 +1,90 @@ +/* + * 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 OpenAI Usage and Costs integration account. Only the fields provided + * are changed. + */ +@JsonPropertyOrder({OpenAIUsageAndCostsIntegrationAccountSettingsUpdate.JSON_PROPERTY_CUSTOM_TAGS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountSettingsUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CUSTOM_TAGS = "custom_tags"; + private String customTags; + + public OpenAIUsageAndCostsIntegrationAccountSettingsUpdate customTags(String customTags) { + this.customTags = customTags; + return this; + } + + /** + * Comma-separated list of custom tags applied to the data collected for this account, for example + * team:ai,env:prod. + * + * @return customTags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CUSTOM_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCustomTags() { + return customTags; + } + + public void setCustomTags(String customTags) { + this.customTags = customTags; + } + + /** + * Return true if this OpenAIUsageAndCostsIntegrationAccountSettingsUpdate object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountSettingsUpdate + openAiUsageAndCostsIntegrationAccountSettingsUpdate = + (OpenAIUsageAndCostsIntegrationAccountSettingsUpdate) o; + return Objects.equals( + this.customTags, openAiUsageAndCostsIntegrationAccountSettingsUpdate.customTags); + } + + @Override + public int hashCode() { + return Objects.hash(customTags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountSettingsUpdate {\n"); + sb.append(" customTags: ").append(toIndentedString(customTags)).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/OpenAIUsageAndCostsIntegrationAccountUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountUpdateAttributes.java new file mode 100644 index 00000000000..4e74d5f7c97 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountUpdateAttributes.java @@ -0,0 +1,255 @@ +/* + * 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 an OpenAI Usage and Costs integration account. Every field is + * optional. Only the provided fields are changed. When dataflows is provided, only the + * dataflow IDs in the request are modified. Dataflows omitted from the map keep their current + * configuration. + */ +@JsonPropertyOrder({ + OpenAIUsageAndCostsIntegrationAccountUpdateAttributes.JSON_PROPERTY_AUTHENTICATION, + OpenAIUsageAndCostsIntegrationAccountUpdateAttributes.JSON_PROPERTY_DATAFLOWS, + OpenAIUsageAndCostsIntegrationAccountUpdateAttributes.JSON_PROPERTY_NAME, + OpenAIUsageAndCostsIntegrationAccountUpdateAttributes.JSON_PROPERTY_SETTINGS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountUpdateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTHENTICATION = "authentication"; + private OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate authentication; + + public static final String JSON_PROPERTY_DATAFLOWS = "dataflows"; + private OpenAIUsageAndCostsIntegrationDataflowsRequest dataflows; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_SETTINGS = "settings"; + private OpenAIUsageAndCostsIntegrationAccountSettingsUpdate settings; + + public OpenAIUsageAndCostsIntegrationAccountUpdateAttributes authentication( + OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate authentication) { + this.authentication = authentication; + this.unparsed |= authentication.unparsed; + return this; + } + + /** + * Authentication for updating the OpenAI Usage and Costs integration account. Set exactly one + * method. + * + * @return authentication + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHENTICATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate getAuthentication() { + return authentication; + } + + public void setAuthentication( + OpenAIUsageAndCostsIntegrationAccountAuthenticationUpdate authentication) { + this.authentication = authentication; + if (authentication != null) { + this.unparsed |= authentication.unparsed; + } + } + + public OpenAIUsageAndCostsIntegrationAccountUpdateAttributes dataflows( + OpenAIUsageAndCostsIntegrationDataflowsRequest dataflows) { + this.dataflows = dataflows; + this.unparsed |= dataflows.unparsed; + return this; + } + + /** + * Data Datadog collects from OpenAI Usage and Costs, keyed by dataflow ID. Datadog always + * collects organization usage metrics. Each dataflow in this object adds another type of + * collection. Set enabled to start or stop a dataflow. The default for each dataflow + * applies when the account is created. On update, omitted fields keep their current values. + * + * @return dataflows + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATAFLOWS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OpenAIUsageAndCostsIntegrationDataflowsRequest getDataflows() { + return dataflows; + } + + public void setDataflows(OpenAIUsageAndCostsIntegrationDataflowsRequest dataflows) { + this.dataflows = dataflows; + if (dataflows != null) { + this.unparsed |= dataflows.unparsed; + } + } + + public OpenAIUsageAndCostsIntegrationAccountUpdateAttributes name(String name) { + this.name = name; + return this; + } + + /** + * Human-readable name of the OpenAI Usage and 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 OpenAIUsageAndCostsIntegrationAccountUpdateAttributes settings( + OpenAIUsageAndCostsIntegrationAccountSettingsUpdate settings) { + this.settings = settings; + this.unparsed |= settings.unparsed; + return this; + } + + /** + * Settings for updating the OpenAI Usage and Costs integration account. Only the fields provided + * are changed. + * + * @return settings + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SETTINGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OpenAIUsageAndCostsIntegrationAccountSettingsUpdate getSettings() { + return settings; + } + + public void setSettings(OpenAIUsageAndCostsIntegrationAccountSettingsUpdate 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 OpenAIUsageAndCostsIntegrationAccountUpdateAttributes + */ + @JsonAnySetter + public OpenAIUsageAndCostsIntegrationAccountUpdateAttributes 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 OpenAIUsageAndCostsIntegrationAccountUpdateAttributes object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountUpdateAttributes + openAiUsageAndCostsIntegrationAccountUpdateAttributes = + (OpenAIUsageAndCostsIntegrationAccountUpdateAttributes) o; + return Objects.equals( + this.authentication, + openAiUsageAndCostsIntegrationAccountUpdateAttributes.authentication) + && Objects.equals( + this.dataflows, openAiUsageAndCostsIntegrationAccountUpdateAttributes.dataflows) + && Objects.equals(this.name, openAiUsageAndCostsIntegrationAccountUpdateAttributes.name) + && Objects.equals( + this.settings, openAiUsageAndCostsIntegrationAccountUpdateAttributes.settings) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsIntegrationAccountUpdateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(authentication, dataflows, name, settings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountUpdateAttributes {\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/OpenAIUsageAndCostsIntegrationAccountUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountUpdateData.java new file mode 100644 index 00000000000..b25dd931392 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountUpdateData.java @@ -0,0 +1,222 @@ +/* + * 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 an OpenAI Usage and Costs integration account. */ +@JsonPropertyOrder({ + OpenAIUsageAndCostsIntegrationAccountUpdateData.JSON_PROPERTY_ATTRIBUTES, + OpenAIUsageAndCostsIntegrationAccountUpdateData.JSON_PROPERTY_ID, + OpenAIUsageAndCostsIntegrationAccountUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private OpenAIUsageAndCostsIntegrationAccountUpdateAttributes 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 OpenAIUsageAndCostsIntegrationAccountUpdateData() {} + + @JsonCreator + public OpenAIUsageAndCostsIntegrationAccountUpdateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + OpenAIUsageAndCostsIntegrationAccountUpdateAttributes 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 OpenAIUsageAndCostsIntegrationAccountUpdateData attributes( + OpenAIUsageAndCostsIntegrationAccountUpdateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Writable attributes used to update an OpenAI Usage and Costs integration account. Every field + * is optional. Only the provided fields are changed. When dataflows is provided, + * only the dataflow IDs in the request are modified. Dataflows omitted from the map keep their + * current configuration. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OpenAIUsageAndCostsIntegrationAccountUpdateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(OpenAIUsageAndCostsIntegrationAccountUpdateAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public OpenAIUsageAndCostsIntegrationAccountUpdateData id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier of the OpenAI Usage and 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 OpenAIUsageAndCostsIntegrationAccountUpdateData 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 OpenAIUsageAndCostsIntegrationAccountUpdateData + */ + @JsonAnySetter + public OpenAIUsageAndCostsIntegrationAccountUpdateData 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 OpenAIUsageAndCostsIntegrationAccountUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountUpdateData + openAiUsageAndCostsIntegrationAccountUpdateData = + (OpenAIUsageAndCostsIntegrationAccountUpdateData) o; + return Objects.equals( + this.attributes, openAiUsageAndCostsIntegrationAccountUpdateData.attributes) + && Objects.equals(this.id, openAiUsageAndCostsIntegrationAccountUpdateData.id) + && Objects.equals(this.type, openAiUsageAndCostsIntegrationAccountUpdateData.type) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsIntegrationAccountUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountUpdateData {\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/OpenAIUsageAndCostsIntegrationAccountUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountUpdateRequest.java new file mode 100644 index 00000000000..c6fb80d6573 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountUpdateRequest.java @@ -0,0 +1,157 @@ +/* + * 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 an OpenAI Usage and Costs integration account. */ +@JsonPropertyOrder({OpenAIUsageAndCostsIntegrationAccountUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private OpenAIUsageAndCostsIntegrationAccountUpdateData data; + + public OpenAIUsageAndCostsIntegrationAccountUpdateRequest() {} + + @JsonCreator + public OpenAIUsageAndCostsIntegrationAccountUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + OpenAIUsageAndCostsIntegrationAccountUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public OpenAIUsageAndCostsIntegrationAccountUpdateRequest data( + OpenAIUsageAndCostsIntegrationAccountUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data envelope for updating an OpenAI Usage and Costs integration account. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OpenAIUsageAndCostsIntegrationAccountUpdateData getData() { + return data; + } + + public void setData(OpenAIUsageAndCostsIntegrationAccountUpdateData 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 OpenAIUsageAndCostsIntegrationAccountUpdateRequest + */ + @JsonAnySetter + public OpenAIUsageAndCostsIntegrationAccountUpdateRequest 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 OpenAIUsageAndCostsIntegrationAccountUpdateRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountUpdateRequest + openAiUsageAndCostsIntegrationAccountUpdateRequest = + (OpenAIUsageAndCostsIntegrationAccountUpdateRequest) o; + return Objects.equals(this.data, openAiUsageAndCostsIntegrationAccountUpdateRequest.data) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsIntegrationAccountUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountUpdateRequest {\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/OpenAIUsageAndCostsIntegrationAccountsResponse.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountsResponse.java new file mode 100644 index 00000000000..8036f4e834f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationAccountsResponse.java @@ -0,0 +1,169 @@ +/* + * 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 OpenAI Usage and Costs integration accounts. */ +@JsonPropertyOrder({OpenAIUsageAndCostsIntegrationAccountsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationAccountsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public OpenAIUsageAndCostsIntegrationAccountsResponse() {} + + @JsonCreator + public OpenAIUsageAndCostsIntegrationAccountsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + for (OpenAIUsageAndCostsIntegrationAccountResponseData item : data) { + this.unparsed |= item.unparsed; + } + } + + public OpenAIUsageAndCostsIntegrationAccountsResponse data( + List data) { + this.data = data; + for (OpenAIUsageAndCostsIntegrationAccountResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public OpenAIUsageAndCostsIntegrationAccountsResponse addDataItem( + OpenAIUsageAndCostsIntegrationAccountResponseData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * List of OpenAI Usage and 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 (OpenAIUsageAndCostsIntegrationAccountResponseData 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 OpenAIUsageAndCostsIntegrationAccountsResponse + */ + @JsonAnySetter + public OpenAIUsageAndCostsIntegrationAccountsResponse 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 OpenAIUsageAndCostsIntegrationAccountsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationAccountsResponse openAiUsageAndCostsIntegrationAccountsResponse = + (OpenAIUsageAndCostsIntegrationAccountsResponse) o; + return Objects.equals(this.data, openAiUsageAndCostsIntegrationAccountsResponse.data) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsIntegrationAccountsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationAccountsResponse {\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/OpenAIUsageAndCostsIntegrationDataflowsRequest.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationDataflowsRequest.java new file mode 100644 index 00000000000..bde33fafc4c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationDataflowsRequest.java @@ -0,0 +1,103 @@ +/* + * 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; + +/** + * Data Datadog collects from OpenAI Usage and Costs, keyed by dataflow ID. Datadog always collects + * organization usage metrics. Each dataflow in this object adds another type of collection. Set + * enabled to start or stop a dataflow. The default for each dataflow applies when the + * account is created. On update, omitted fields keep their current values. + */ +@JsonPropertyOrder({ + OpenAIUsageAndCostsIntegrationDataflowsRequest.JSON_PROPERTY_OPENAI_CLOUD_COST_DATA +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationDataflowsRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_OPENAI_CLOUD_COST_DATA = "openai-cloud-cost-data"; + private OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest openaiCloudCostData; + + public OpenAIUsageAndCostsIntegrationDataflowsRequest openaiCloudCostData( + OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest openaiCloudCostData) { + this.openaiCloudCostData = openaiCloudCostData; + this.unparsed |= openaiCloudCostData.unparsed; + return this; + } + + /** + * OpenAI organization costs, which you can analyze in Cloud Cost Management. See collected + * data for what is included. Cost data appears in Cloud Cost Management within 24 hours after + * you enable this dataflow. + * + * @return openaiCloudCostData + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OPENAI_CLOUD_COST_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest getOpenaiCloudCostData() { + return openaiCloudCostData; + } + + public void setOpenaiCloudCostData( + OpenAIUsageAndCostsCloudCostDataIntegrationDataflowRequest openaiCloudCostData) { + this.openaiCloudCostData = openaiCloudCostData; + if (openaiCloudCostData != null) { + this.unparsed |= openaiCloudCostData.unparsed; + } + } + + /** Return true if this OpenAIUsageAndCostsIntegrationDataflowsRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationDataflowsRequest openAiUsageAndCostsIntegrationDataflowsRequest = + (OpenAIUsageAndCostsIntegrationDataflowsRequest) o; + return Objects.equals( + this.openaiCloudCostData, + openAiUsageAndCostsIntegrationDataflowsRequest.openaiCloudCostData); + } + + @Override + public int hashCode() { + return Objects.hash(openaiCloudCostData); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationDataflowsRequest {\n"); + sb.append(" openaiCloudCostData: ") + .append(toIndentedString(openaiCloudCostData)) + .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/OpenAIUsageAndCostsIntegrationDataflowsResponse.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationDataflowsResponse.java new file mode 100644 index 00000000000..2c0ff826e24 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsIntegrationDataflowsResponse.java @@ -0,0 +1,195 @@ +/* + * 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 OpenAI Usage and Costs, keyed by dataflow ID. */ +@JsonPropertyOrder({ + OpenAIUsageAndCostsIntegrationDataflowsResponse.JSON_PROPERTY_OPENAI_CLOUD_COST_DATA, + OpenAIUsageAndCostsIntegrationDataflowsResponse.JSON_PROPERTY_OPENAI_USAGE_METRICS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsIntegrationDataflowsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_OPENAI_CLOUD_COST_DATA = "openai-cloud-cost-data"; + private OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse openaiCloudCostData; + + public static final String JSON_PROPERTY_OPENAI_USAGE_METRICS = "openai-usage-metrics"; + private OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse openaiUsageMetrics; + + public OpenAIUsageAndCostsIntegrationDataflowsResponse openaiCloudCostData( + OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse openaiCloudCostData) { + this.openaiCloudCostData = openaiCloudCostData; + this.unparsed |= openaiCloudCostData.unparsed; + return this; + } + + /** + * OpenAI organization costs, which you can analyze in Cloud Cost Management. See collected + * data for what is included. + * + * @return openaiCloudCostData + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OPENAI_CLOUD_COST_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse getOpenaiCloudCostData() { + return openaiCloudCostData; + } + + public void setOpenaiCloudCostData( + OpenAIUsageAndCostsCloudCostDataIntegrationDataflowResponse openaiCloudCostData) { + this.openaiCloudCostData = openaiCloudCostData; + if (openaiCloudCostData != null) { + this.unparsed |= openaiCloudCostData.unparsed; + } + } + + public OpenAIUsageAndCostsIntegrationDataflowsResponse openaiUsageMetrics( + OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse openaiUsageMetrics) { + this.openaiUsageMetrics = openaiUsageMetrics; + this.unparsed |= openaiUsageMetrics.unparsed; + return this; + } + + /** + * Organization usage metrics under the openai.* namespace, such as + * openai.completions.*, openai.embeddings.*, openai.images.*, + * openai.moderations.*, openai.audio_speeches.*, + * openai.audio_transcriptions.*, openai.code_interpreter_sessions.*, and + * openai.vector_stores.*. This dataflow is always on and cannot be turned off, so it + * appears only in responses. + * + * @return openaiUsageMetrics + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OPENAI_USAGE_METRICS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse getOpenaiUsageMetrics() { + return openaiUsageMetrics; + } + + public void setOpenaiUsageMetrics( + OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse openaiUsageMetrics) { + this.openaiUsageMetrics = openaiUsageMetrics; + if (openaiUsageMetrics != null) { + this.unparsed |= openaiUsageMetrics.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 OpenAIUsageAndCostsIntegrationDataflowsResponse + */ + @JsonAnySetter + public OpenAIUsageAndCostsIntegrationDataflowsResponse 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 OpenAIUsageAndCostsIntegrationDataflowsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsIntegrationDataflowsResponse + openAiUsageAndCostsIntegrationDataflowsResponse = + (OpenAIUsageAndCostsIntegrationDataflowsResponse) o; + return Objects.equals( + this.openaiCloudCostData, + openAiUsageAndCostsIntegrationDataflowsResponse.openaiCloudCostData) + && Objects.equals( + this.openaiUsageMetrics, + openAiUsageAndCostsIntegrationDataflowsResponse.openaiUsageMetrics) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsIntegrationDataflowsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(openaiCloudCostData, openaiUsageMetrics, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsIntegrationDataflowsResponse {\n"); + sb.append(" openaiCloudCostData: ") + .append(toIndentedString(openaiCloudCostData)) + .append("\n"); + sb.append(" openaiUsageMetrics: ").append(toIndentedString(openaiUsageMetrics)).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/OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse.java b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse.java new file mode 100644 index 00000000000..68063c3372f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse.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; + +/** + * Organization usage metrics under the openai.* namespace, such as + * openai.completions.*, openai.embeddings.*, openai.images.*, + * openai.moderations.*, openai.audio_speeches.*, + * openai.audio_transcriptions.*, openai.code_interpreter_sessions.*, and + * openai.vector_stores.*. This dataflow is always on and cannot be turned off, so it appears + * only in responses. + */ +@JsonPropertyOrder({ + OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse.JSON_PROPERTY_ENABLED, + OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse { + @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 OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse + */ + @JsonAnySetter + public OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse 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 OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse object is equal + * to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse + openAiUsageAndCostsUsageMetricsIntegrationDataflowResponse = + (OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse) o; + return Objects.equals( + this.enabled, openAiUsageAndCostsUsageMetricsIntegrationDataflowResponse.enabled) + && Objects.equals( + this.status, openAiUsageAndCostsUsageMetricsIntegrationDataflowResponse.status) + && Objects.equals( + this.additionalProperties, + openAiUsageAndCostsUsageMetricsIntegrationDataflowResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenAIUsageAndCostsUsageMetricsIntegrationDataflowResponse {\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/test/resources/com/datadog/api/client/v2/api/openai_usage_and_costs_integration.feature b/src/test/resources/com/datadog/api/client/v2/api/openai_usage_and_costs_integration.feature new file mode 100644 index 00000000000..0d3b082e7aa --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/openai_usage_and_costs_integration.feature @@ -0,0 +1,148 @@ +@endpoint(openai-usage-and-costs-integration) @endpoint(openai-usage-and-costs-integration-v2) +Feature: OpenAI Usage and Costs Integration + Manage your Datadog OpenAI Usage and Costs integration accounts and + account resources directly through the Datadog API. See the [OpenAI + integration page](https://docs.datadoghq.com/integrations/openai/) for + more information. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "OpenAIUsageandCostsIntegration" API + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Create an OpenAI Usage and Costs account returns "Bad Request" response + Given operation "CreateOpenAIUsageAndCostsIntegrationAccount" enabled + And new "CreateOpenAIUsageAndCostsIntegrationAccount" request + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "dataflows": {"openai-cloud-cost-data": {"enabled": true}}, "name": "openai-usage-and-costs-acme", "settings": {"custom_tags": "team:ai,env:prod"}}, "type": "integration-account"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Create an OpenAI Usage and Costs account returns "Created" response + Given operation "CreateOpenAIUsageAndCostsIntegrationAccount" enabled + And new "CreateOpenAIUsageAndCostsIntegrationAccount" request + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "dataflows": {"openai-cloud-cost-data": {"enabled": true}}, "name": "openai-usage-and-costs-acme", "settings": {"custom_tags": "team:ai,env:prod"}}, "type": "integration-account"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Create an OpenAI Usage and Costs account returns "Not Found" response + Given operation "CreateOpenAIUsageAndCostsIntegrationAccount" enabled + And new "CreateOpenAIUsageAndCostsIntegrationAccount" request + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "dataflows": {"openai-cloud-cost-data": {"enabled": true}}, "name": "openai-usage-and-costs-acme", "settings": {"custom_tags": "team:ai,env:prod"}}, "type": "integration-account"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Create an OpenAI Usage and Costs account returns "The server cannot process the request because it contains invalid data." response + Given operation "CreateOpenAIUsageAndCostsIntegrationAccount" enabled + And new "CreateOpenAIUsageAndCostsIntegrationAccount" request + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "dataflows": {"openai-cloud-cost-data": {"enabled": true}}, "name": "openai-usage-and-costs-acme", "settings": {"custom_tags": "team:ai,env:prod"}}, "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 an OpenAI Usage and Costs account returns "Bad Request" response + Given operation "DeleteOpenAIUsageAndCostsIntegrationAccount" enabled + And new "DeleteOpenAIUsageAndCostsIntegrationAccount" 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 an OpenAI Usage and Costs account returns "Not Found" response + Given operation "DeleteOpenAIUsageAndCostsIntegrationAccount" enabled + And new "DeleteOpenAIUsageAndCostsIntegrationAccount" 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 an OpenAI Usage and Costs account returns "OK" response + Given operation "DeleteOpenAIUsageAndCostsIntegrationAccount" enabled + And new "DeleteOpenAIUsageAndCostsIntegrationAccount" 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 an OpenAI Usage and Costs account returns "Bad Request" response + Given operation "GetOpenAIUsageAndCostsIntegrationAccount" enabled + And new "GetOpenAIUsageAndCostsIntegrationAccount" 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 an OpenAI Usage and Costs account returns "Not Found" response + Given operation "GetOpenAIUsageAndCostsIntegrationAccount" enabled + And new "GetOpenAIUsageAndCostsIntegrationAccount" 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 an OpenAI Usage and Costs account returns "OK" response + Given operation "GetOpenAIUsageAndCostsIntegrationAccount" enabled + And new "GetOpenAIUsageAndCostsIntegrationAccount" 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 OpenAI Usage and Costs accounts returns "Bad Request" response + Given operation "ListOpenAIUsageAndCostsIntegrationAccounts" enabled + And new "ListOpenAIUsageAndCostsIntegrationAccounts" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/saas-integrations + Scenario: List OpenAI Usage and Costs accounts returns "Not Found" response + Given operation "ListOpenAIUsageAndCostsIntegrationAccounts" enabled + And new "ListOpenAIUsageAndCostsIntegrationAccounts" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/saas-integrations + Scenario: List OpenAI Usage and Costs accounts returns "OK" response + Given operation "ListOpenAIUsageAndCostsIntegrationAccounts" enabled + And new "ListOpenAIUsageAndCostsIntegrationAccounts" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Update an OpenAI Usage and Costs account returns "Bad Request" response + Given operation "UpdateOpenAIUsageAndCostsIntegrationAccount" enabled + And new "UpdateOpenAIUsageAndCostsIntegrationAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "dataflows": {"openai-cloud-cost-data": {"enabled": true}}, "name": "openai-usage-and-costs-acme", "settings": {"custom_tags": "team:ai,env:prod"}}, "id": "9c4e7a2b-1d5f-4e8a-b3c6-0f2d8a6e4b17", "type": "integration-account"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Update an OpenAI Usage and Costs account returns "Not Found" response + Given operation "UpdateOpenAIUsageAndCostsIntegrationAccount" enabled + And new "UpdateOpenAIUsageAndCostsIntegrationAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "dataflows": {"openai-cloud-cost-data": {"enabled": true}}, "name": "openai-usage-and-costs-acme", "settings": {"custom_tags": "team:ai,env:prod"}}, "id": "9c4e7a2b-1d5f-4e8a-b3c6-0f2d8a6e4b17", "type": "integration-account"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Update an OpenAI Usage and Costs account returns "OK" response + Given operation "UpdateOpenAIUsageAndCostsIntegrationAccount" enabled + And new "UpdateOpenAIUsageAndCostsIntegrationAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "dataflows": {"openai-cloud-cost-data": {"enabled": true}}, "name": "openai-usage-and-costs-acme", "settings": {"custom_tags": "team:ai,env:prod"}}, "id": "9c4e7a2b-1d5f-4e8a-b3c6-0f2d8a6e4b17", "type": "integration-account"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/saas-integrations + Scenario: Update an OpenAI Usage and Costs account returns "The server cannot process the request because it contains invalid data." response + Given operation "UpdateOpenAIUsageAndCostsIntegrationAccount" enabled + And new "UpdateOpenAIUsageAndCostsIntegrationAccount" request + And request contains "account_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"authentication": {"auth_type": "bearer_token", "token": "your-token"}, "dataflows": {"openai-cloud-cost-data": {"enabled": true}}, "name": "openai-usage-and-costs-acme", "settings": {"custom_tags": "team:ai,env:prod"}}, "id": "9c4e7a2b-1d5f-4e8a-b3c6-0f2d8a6e4b17", "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 294d6dfb418..77e3ac5f971 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 @@ -2306,6 +2306,19 @@ "type": "unsafe" } }, + "CreateOpenAIUsageAndCostsIntegrationAccount": { + "tag": "OpenAI Usage and Costs Integration", + "undo": { + "operationId": "DeleteOpenAIUsageAndCostsIntegrationAccount", + "parameters": [ + { + "name": "account_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, "CreateOpenAPI": { "tag": "API Management", "undo": { @@ -4470,6 +4483,12 @@ "type": "idempotent" } }, + "DeleteOpenAIUsageAndCostsIntegrationAccount": { + "tag": "OpenAI Usage and Costs Integration", + "undo": { + "type": "idempotent" + } + }, "DeleteOpenAPI": { "tag": "API Management", "undo": { @@ -6703,6 +6722,12 @@ "type": "safe" } }, + "GetOpenAIUsageAndCostsIntegrationAccount": { + "tag": "OpenAI Usage and Costs Integration", + "undo": { + "type": "safe" + } + }, "GetOpenAPI": { "tag": "API Management", "undo": { @@ -9088,6 +9113,12 @@ "type": "safe" } }, + "ListOpenAIUsageAndCostsIntegrationAccounts": { + "tag": "OpenAI Usage and Costs Integration", + "undo": { + "type": "safe" + } + }, "ListOpsgenieAccounts": { "tag": "Opsgenie Integration", "undo": { @@ -11835,6 +11866,12 @@ "type": "idempotent" } }, + "UpdateOpenAIUsageAndCostsIntegrationAccount": { + "tag": "OpenAI Usage and Costs Integration", + "undo": { + "type": "idempotent" + } + }, "UpdateOpenAPI": { "tag": "API Management", "undo": {