From a7f48d8f39d298563be7ecc512b03769fa4efce9 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 26 Aug 2026 21:09:30 +0000 Subject: [PATCH] Regenerate client from commit 0bf48cf of spec repo --- .generator/schemas/v2/openapi.yaml | 619 +++++++++++ examples/v2/usage-metering/CreateQuotas.java | 44 + examples/v2/usage-metering/DeleteQuota.java | 23 + examples/v2/usage-metering/ListQuotas.java | 25 + .../usage-metering/ListQuotas_918754421.java | 27 + examples/v2/usage-metering/UpdateQuota.java | 40 + .../com/datadog/api/client/ApiClient.java | 4 + .../api/client/v2/api/UsageMeteringApi.java | 989 ++++++++++++++++++ .../model/UsageQuotaBulkResultAttributes.java | 264 +++++ .../v2/model/UsageQuotaBulkResultData.java | 214 ++++ .../v2/model/UsageQuotaCreateAttributes.java | 217 ++++ .../client/v2/model/UsageQuotaCreateData.java | 184 ++++ .../client/v2/model/UsageQuotaResponse.java | 148 +++ .../model/UsageQuotaResponseAttributes.java | 240 +++++ .../v2/model/UsageQuotaResponseData.java | 213 ++++ .../api/client/v2/model/UsageQuotaType.java | 53 + .../v2/model/UsageQuotaUpdateAttributes.java | 191 ++++ .../client/v2/model/UsageQuotaUpdateData.java | 212 ++++ .../v2/model/UsageQuotaUpdateRequest.java | 148 +++ .../v2/model/UsageQuotasBulkResponse.java | 168 +++ .../v2/model/UsageQuotasCreateRequest.java | 165 +++ .../v2/model/UsageQuotasListResponse.java | 197 ++++ .../v2/model/UsageQuotasResponseMeta.java | 148 +++ .../v2/model/UsageQuotasResponseMetaPage.java | 136 +++ .../com/datadog/api/client/v2/api/undo.json | 24 + .../api/client/v2/api/usage_metering.feature | 99 ++ 26 files changed, 4792 insertions(+) create mode 100644 examples/v2/usage-metering/CreateQuotas.java create mode 100644 examples/v2/usage-metering/DeleteQuota.java create mode 100644 examples/v2/usage-metering/ListQuotas.java create mode 100644 examples/v2/usage-metering/ListQuotas_918754421.java create mode 100644 examples/v2/usage-metering/UpdateQuota.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotaBulkResultAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotaBulkResultData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotaCreateAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotaCreateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotaResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotaResponseAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotaResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotaType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotaUpdateAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotaUpdateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotaUpdateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotasBulkResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotasCreateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotasListResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotasResponseMeta.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UsageQuotasResponseMetaPage.java diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e24a358f1bd..2b7a53a5acd 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -121116,6 +121116,249 @@ components: $ref: "#/components/schemas/UsageDataObject" type: array type: object + UsageQuotaBulkResultAttributes: + description: Attributes of a usage quota bulk write result. On success, all fields except `error` are present. On failure, only `error` is present and the other fields are omitted. + properties: + enforced: + description: Whether usage above the limit is actively blocked instead of only tracked or alerted on. Omitted if this item failed to write. + example: true + type: boolean + error: + description: An error message describing why this item failed to write. Omitted if this item was written successfully. + example: usage_limit is out of range + type: string + org_public_id: + description: The public ID of the organization that owns the quota. Omitted if this item failed to write. + example: abcdef12345 + type: string + scope: + $ref: "#/components/schemas/UsageQuotaResponseScope" + usage_limit: + description: The quota limit in the usage units defined by the quota namespace. Omitted if this item failed to write. + example: 100000 + format: int64 + type: integer + type: object + UsageQuotaBulkResultData: + description: The result of writing one usage quota in a bulk create-or-update request. + properties: + attributes: + $ref: "#/components/schemas/UsageQuotaBulkResultAttributes" + id: + description: An opaque usage quota identifier. Clients must pass this value back verbatim in update and delete requests and must not infer any structure from it. + example: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + type: string + type: + $ref: "#/components/schemas/UsageQuotaType" + required: + - id + - type + - attributes + type: object + UsageQuotaBulkResultDataList: + description: The results of writing each usage quota in a bulk create-or-update request, in the same order as the request. + items: + $ref: "#/components/schemas/UsageQuotaBulkResultData" + type: array + UsageQuotaCreateAttributes: + description: Attributes for creating or updating a usage quota by scope. + properties: + enforced: + description: Whether to actively block usage above the limit instead of only tracking or alerting on it. + example: true + type: boolean + scope: + $ref: "#/components/schemas/UsageQuotaRequestScope" + usage_limit: + description: The quota limit to set in the usage units defined by the quota namespace. For an organization-wide quota (scope omitted), the limit must be greater than the usage already recorded in the current period. + example: 100000 + format: int64 + minimum: 0 + type: integer + required: + - usage_limit + - enforced + type: object + UsageQuotaCreateData: + description: A usage quota resource to create or update by scope. + properties: + attributes: + $ref: "#/components/schemas/UsageQuotaCreateAttributes" + type: + $ref: "#/components/schemas/UsageQuotaType" + required: + - type + - attributes + type: object + UsageQuotaCreateDataList: + description: A bulk list of usage quota resources to create or update by scope. + items: + $ref: "#/components/schemas/UsageQuotaCreateData" + minItems: 1 + type: array + UsageQuotaRequestScope: + additionalProperties: + example: jane@example.com + type: string + description: A namespace-specific key and value identifying what the quota applies to within an organization. The object must contain exactly one entry. Use `"*"` as the value for the default quota applied to entities without a specific quota, or omit the scope for an organization-wide quota. A specific value must identify an existing user handle in the caller's organization. When `include_descendants` is true, the quota is applied only to the caller's organization and to descendant organizations where that user handle also exists; the request fails only if the handle exists in none of them. + example: + user_handle: jane@example.com + maxProperties: 1 + minProperties: 1 + type: object + UsageQuotaResponse: + description: Response containing a usage quota. + properties: + data: + $ref: "#/components/schemas/UsageQuotaResponseData" + required: + - data + type: object + UsageQuotaResponseAttributes: + description: Attributes of a usage quota. + properties: + enforced: + description: Whether usage above the limit is actively blocked instead of only tracked or alerted on. + example: true + type: boolean + org_public_id: + description: The public ID of the organization that owns the quota. + example: abcdef12345 + type: string + scope: + $ref: "#/components/schemas/UsageQuotaResponseScope" + usage_limit: + description: The quota limit in the usage units defined by the quota namespace. + example: 100000 + format: int64 + type: integer + required: + - org_public_id + - usage_limit + - enforced + type: object + UsageQuotaResponseData: + description: A usage quota resource. + properties: + attributes: + $ref: "#/components/schemas/UsageQuotaResponseAttributes" + id: + description: An opaque usage quota identifier. Clients must pass this value back verbatim in update and delete requests and must not infer any structure from it. + example: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + type: string + type: + $ref: "#/components/schemas/UsageQuotaType" + required: + - id + - type + - attributes + type: object + UsageQuotaResponseDataList: + description: A list of usage quota resources. + items: + $ref: "#/components/schemas/UsageQuotaResponseData" + type: array + UsageQuotaResponseScope: + additionalProperties: + example: jane@example.com + type: string + description: A namespace-specific key and value identifying what the quota applies to within an organization. The object contains exactly one entry. A value of `"*"` identifies the default quota applied to entities without a specific quota. This field is omitted for an organization-wide quota. + example: + user_handle: jane@example.com + maxProperties: 1 + minProperties: 1 + type: object + UsageQuotaType: + description: The JSON:API resource type for a usage quota. + enum: + - quotas + example: quotas + type: string + x-enum-varnames: + - QUOTAS + UsageQuotaUpdateAttributes: + description: Attributes to update on a usage quota. Omitting a property leaves its current value unchanged. + properties: + enforced: + description: Whether to actively block usage above the limit. Omit this field to leave the current enforcement setting unchanged. + example: false + nullable: true + type: boolean + usage_limit: + description: The new quota limit in the usage units defined by the quota namespace. For an organization-wide quota (empty scope), the limit must be greater than the usage already recorded in the current period. Omit this field to leave the current limit unchanged. + example: 120000 + format: int64 + minimum: 0 + nullable: true + type: integer + type: object + UsageQuotaUpdateData: + description: A usage quota resource to update. + properties: + attributes: + $ref: "#/components/schemas/UsageQuotaUpdateAttributes" + id: + description: The opaque usage quota identifier, which must match the identifier in the request path. + example: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + type: string + type: + $ref: "#/components/schemas/UsageQuotaType" + required: + - id + - type + - attributes + type: object + UsageQuotaUpdateRequest: + description: Request containing the usage quota resource to update. + properties: + data: + $ref: "#/components/schemas/UsageQuotaUpdateData" + required: + - data + type: object + UsageQuotasBulkResponse: + description: Response containing the result of a bulk usage quota create-or-update request. Returned with a `200` status when every item succeeded, or `207` when one or more items failed. Failed items carry an `error` and omit the other attributes. + properties: + data: + $ref: "#/components/schemas/UsageQuotaBulkResultDataList" + required: + - data + type: object + UsageQuotasCreateRequest: + description: A JSON:API bulk request containing an array of usage quota resources rather than a single resource. + properties: + data: + $ref: "#/components/schemas/UsageQuotaCreateDataList" + required: + - data + type: object + UsageQuotasListResponse: + description: Response containing a paginated list of usage quotas. + properties: + data: + $ref: "#/components/schemas/UsageQuotaResponseDataList" + meta: + $ref: "#/components/schemas/UsageQuotasResponseMeta" + required: + - data + - meta + type: object + UsageQuotasResponseMeta: + description: Pagination metadata for a usage quota list response. + properties: + page: + $ref: "#/components/schemas/UsageQuotasResponseMetaPage" + required: + - page + type: object + UsageQuotasResponseMetaPage: + description: Cursor pagination fields for a usage quota list response. + properties: + next_cursor: + description: An opaque cursor for retrieving the next page. Omitted when there are no more results. + example: eyJvZmZzZXQiOjEwMH0= + type: string + type: object UsageSummaryAvailableFieldsAttributes: description: |- The lists of field names returned by `GET /api/v1/usage/summary` at each @@ -217939,6 +218182,382 @@ paths: permissions: - usage_read - billing_read + /api/v2/usage/quotas/{quota_namespace}: + get: + description: |- + Lists usage quotas for the caller's organization in a quota namespace. You can optionally include descendant organizations in the same datacenter as the caller. Requires the `user_access_manage`, `billing_edit`, and `org_management` permissions. + operationId: ListQuotas + parameters: + - description: The product-specific namespace whose usage quotas are being managed. + in: path + name: quota_namespace + required: true + schema: + example: ai_credits + type: string + - description: Whether to include quotas configured on descendant organizations in the caller's organization hierarchy. Only descendants in the same datacenter are supported. + in: query + name: include_descendants + required: false + schema: + default: false + type: boolean + - description: An opaque cursor from a previous response's `meta.page.next_cursor` used to retrieve the next page. + in: query + name: page[cursor] + required: false + schema: + type: string + - description: The number of usage quotas to return per page. + in: query + name: page[limit] + required: false + schema: + default: 100 + format: int64 + maximum: 1000 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + enforced: true + org_public_id: abcdef12345 + scope: + user_handle: jane@example.com + usage_limit: 100000 + id: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + type: quotas + meta: + page: + next_cursor: eyJvZmZzZXQiOjEwMH0= + schema: + $ref: "#/components/schemas/UsageQuotasListResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - user_access_manage + - billing_edit + - org_management + summary: List usage quotas + tags: + - Usage Metering + x-pagination: + cursorParam: page[cursor] + cursorPath: meta.page.next_cursor + limitParam: page[limit] + resultsPath: data + "x-permission": + operator: AND + permissions: + - user_access_manage + - billing_edit + - org_management + 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: |- + Creates or updates one or more usage quotas by scope. If a quota already exists for a supplied scope, it is updated; otherwise, a new quota is created. Requires the `user_access_manage`, `billing_edit`, and `org_management` permissions. + operationId: CreateQuotas + parameters: + - description: The product-specific namespace whose usage quotas are being managed. + in: path + name: quota_namespace + required: true + schema: + example: ai_credits + type: string + - description: Whether to write every item in the request to the caller's organization and all of its descendant organizations, instead of only the caller's organization. Only descendants in the same datacenter are supported. For a user-handle scope, the quota is applied only to the caller's organization and to descendant organizations where that user handle exists; the item fails only if the handle exists in none of them. + in: query + name: include_descendants + required: false + schema: + default: false + type: boolean + requestBody: + content: + application/json: + examples: + default: + summary: Create or update quotas for the caller's organization. + value: + data: + - attributes: + enforced: true + scope: + user_handle: jane@example.com + usage_limit: 100000 + type: quotas + - attributes: + enforced: false + scope: + user_handle: "*" + usage_limit: 250000 + type: quotas + schema: + $ref: "#/components/schemas/UsageQuotasCreateRequest" + description: The usage quotas to create or update. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + enforced: true + org_public_id: abcdef12345 + scope: + user_handle: jane@example.com + usage_limit: 100000 + id: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + type: quotas + - attributes: + enforced: false + org_public_id: abcdef12345 + scope: + user_handle: "*" + usage_limit: 250000 + id: "MjAfYWlfY3JlZGl0czp1c2VyX2hhbmRsZTpfX0FMTF9f" + type: quotas + schema: + $ref: "#/components/schemas/UsageQuotasBulkResponse" + description: OK. Every item in the batch was written successfully. + "207": + content: + application/json: + examples: + default: + value: + data: + - attributes: + enforced: true + org_public_id: abcdef12345 + scope: + user_handle: jane@example.com + usage_limit: 100000 + id: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + type: quotas + - attributes: + error: usage_limit is out of range + id: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTp1c2VyQGV4YW1wbGUuY29t" + type: quotas + schema: + $ref: "#/components/schemas/UsageQuotasBulkResponse" + description: Multi-Status. One or more items in the batch failed to write; see each item's `error` attribute. Items that succeeded were written even though others failed. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error. Every item in the batch failed to write. + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - user_access_manage + - billing_edit + - org_management + summary: Create or update usage quotas + tags: + - Usage Metering + "x-permission": + operator: AND + permissions: + - user_access_manage + - billing_edit + - org_management + 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/usage/quotas/{quota_namespace}/{id}: + delete: + description: |- + Deletes a usage quota by its opaque identifier. The quota must belong to the caller's organization or one of its descendants, and its opaque identifier must belong to the requested quota namespace. Requires the `user_access_manage`, `billing_edit`, and `org_management` permissions. + operationId: DeleteQuota + parameters: + - description: The product-specific namespace whose usage quotas are being managed. + in: path + name: quota_namespace + required: true + schema: + example: ai_credits + type: string + - description: The opaque quota identifier returned by a previous list or create request. Clients must pass this value verbatim. + in: path + name: id + required: true + schema: + example: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + type: string + responses: + "204": + description: No Content + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - user_access_manage + - billing_edit + - org_management + summary: Delete a usage quota + tags: + - Usage Metering + "x-permission": + operator: AND + permissions: + - user_access_manage + - billing_edit + - org_management + 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: |- + Updates the supplied fields on a usage quota and leaves omitted fields unchanged. The quota must belong to the caller's organization or one of its descendants, and its opaque identifier must belong to the requested quota namespace. Requires the `user_access_manage`, `billing_edit`, and `org_management` permissions. + operationId: UpdateQuota + parameters: + - description: The product-specific namespace whose usage quotas are being managed. + in: path + name: quota_namespace + required: true + schema: + example: ai_credits + type: string + - description: The opaque quota identifier returned by a previous list or create request. Clients must pass this value verbatim. + in: path + name: id + required: true + schema: + example: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + enforced: false + usage_limit: 120000 + id: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + type: quotas + schema: + $ref: "#/components/schemas/UsageQuotaUpdateRequest" + description: The usage quota fields to update. Omitting an attribute leaves its current value unchanged. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + enforced: false + org_public_id: abcdef12345 + scope: + user_handle: jane@example.com + usage_limit: 120000 + id: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + type: quotas + schema: + $ref: "#/components/schemas/UsageQuotaResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request. Returned if the request is malformed, or if the `id` in the request body does not match the `id` in the request path. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - user_access_manage + - billing_edit + - org_management + summary: Update a usage quota + tags: + - Usage Metering + "x-permission": + operator: AND + permissions: + - user_access_manage + - billing_edit + - org_management + 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/usage/summary/available_fields: get: description: |- diff --git a/examples/v2/usage-metering/CreateQuotas.java b/examples/v2/usage-metering/CreateQuotas.java new file mode 100644 index 00000000000..0d1bdfbae73 --- /dev/null +++ b/examples/v2/usage-metering/CreateQuotas.java @@ -0,0 +1,44 @@ +// Create or update usage quotas returns "OK. Every item in the batch was written successfully." +// response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.UsageMeteringApi; +import com.datadog.api.client.v2.model.UsageQuotaCreateAttributes; +import com.datadog.api.client.v2.model.UsageQuotaCreateData; +import com.datadog.api.client.v2.model.UsageQuotaType; +import com.datadog.api.client.v2.model.UsageQuotasBulkResponse; +import com.datadog.api.client.v2.model.UsageQuotasCreateRequest; +import java.util.Collections; +import java.util.Map; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createQuotas", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + UsageQuotasCreateRequest body = + new UsageQuotasCreateRequest() + .data( + Collections.singletonList( + new UsageQuotaCreateData() + .attributes( + new UsageQuotaCreateAttributes() + .enforced(true) + .scope(Map.ofEntries(Map.entry("user_handle", "jane@example.com"))) + .usageLimit(100000L)) + .type(UsageQuotaType.QUOTAS))); + + try { + UsageQuotasBulkResponse result = apiInstance.createQuotas("ai_credits", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsageMeteringApi#createQuotas"); + 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/usage-metering/DeleteQuota.java b/examples/v2/usage-metering/DeleteQuota.java new file mode 100644 index 00000000000..5cb55ae7f86 --- /dev/null +++ b/examples/v2/usage-metering/DeleteQuota.java @@ -0,0 +1,23 @@ +// Delete a usage quota returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.UsageMeteringApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteQuota", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + try { + apiInstance.deleteQuota("ai_credits", "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f"); + } catch (ApiException e) { + System.err.println("Exception when calling UsageMeteringApi#deleteQuota"); + 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/usage-metering/ListQuotas.java b/examples/v2/usage-metering/ListQuotas.java new file mode 100644 index 00000000000..d36cfd16e9e --- /dev/null +++ b/examples/v2/usage-metering/ListQuotas.java @@ -0,0 +1,25 @@ +// List usage quotas returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.UsageMeteringApi; +import com.datadog.api.client.v2.model.UsageQuotasListResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listQuotas", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + try { + UsageQuotasListResponse result = apiInstance.listQuotas("ai_credits"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsageMeteringApi#listQuotas"); + 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/usage-metering/ListQuotas_918754421.java b/examples/v2/usage-metering/ListQuotas_918754421.java new file mode 100644 index 00000000000..44802bb377e --- /dev/null +++ b/examples/v2/usage-metering/ListQuotas_918754421.java @@ -0,0 +1,27 @@ +// List usage quotas returns "OK" response with pagination + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.PaginationIterable; +import com.datadog.api.client.v2.api.UsageMeteringApi; +import com.datadog.api.client.v2.model.UsageQuotaResponseData; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listQuotas", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + try { + PaginationIterable iterable = + apiInstance.listQuotasWithPagination("ai_credits"); + + for (UsageQuotaResponseData item : iterable) { + System.out.println(item); + } + } catch (RuntimeException e) { + System.err.println("Exception when calling UsageMeteringApi#listQuotasWithPagination"); + System.err.println("Reason: " + e.getMessage()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/usage-metering/UpdateQuota.java b/examples/v2/usage-metering/UpdateQuota.java new file mode 100644 index 00000000000..81a9d1bf950 --- /dev/null +++ b/examples/v2/usage-metering/UpdateQuota.java @@ -0,0 +1,40 @@ +// Update a usage quota returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.UsageMeteringApi; +import com.datadog.api.client.v2.model.UsageQuotaResponse; +import com.datadog.api.client.v2.model.UsageQuotaType; +import com.datadog.api.client.v2.model.UsageQuotaUpdateAttributes; +import com.datadog.api.client.v2.model.UsageQuotaUpdateData; +import com.datadog.api.client.v2.model.UsageQuotaUpdateRequest; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateQuota", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + UsageQuotaUpdateRequest body = + new UsageQuotaUpdateRequest() + .data( + new UsageQuotaUpdateData() + .attributes( + new UsageQuotaUpdateAttributes().enforced(false).usageLimit(120000L)) + .id("MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f") + .type(UsageQuotaType.QUOTAS)); + + try { + UsageQuotaResponse result = + apiInstance.updateQuota( + "ai_credits", "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsageMeteringApi#updateQuota"); + 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 b088e22db49..2aac4cb6225 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1052,6 +1052,10 @@ public class ApiClient { put("v2.listCostTagMetadataMonths", false); put("v2.listCostTagMetadataOrchestrators", false); put("v2.searchCostRecommendations", false); + put("v2.createQuotas", false); + put("v2.deleteQuota", false); + put("v2.listQuotas", false); + put("v2.updateQuota", false); put("v2.createOwnershipFeedback", false); put("v2.getOwnershipEvidence", false); put("v2.getOwnershipInference", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/UsageMeteringApi.java b/src/main/java/com/datadog/api/client/v2/api/UsageMeteringApi.java index 3610facb72a..cc595c9e7a0 100644 --- a/src/main/java/com/datadog/api/client/v2/api/UsageMeteringApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/UsageMeteringApi.java @@ -3,6 +3,7 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.PaginationIterable; import com.datadog.api.client.Pair; import com.datadog.api.client.v2.model.ActiveBillingDimensionsResponse; import com.datadog.api.client.v2.model.BillingDimensionsMappingResponse; @@ -16,12 +17,19 @@ import com.datadog.api.client.v2.model.UsageAttributionTypesResponse; import com.datadog.api.client.v2.model.UsageLambdaTracedInvocationsResponse; import com.datadog.api.client.v2.model.UsageObservabilityPipelinesResponse; +import com.datadog.api.client.v2.model.UsageQuotaResponse; +import com.datadog.api.client.v2.model.UsageQuotaResponseData; +import com.datadog.api.client.v2.model.UsageQuotaUpdateRequest; +import com.datadog.api.client.v2.model.UsageQuotasBulkResponse; +import com.datadog.api.client.v2.model.UsageQuotasCreateRequest; +import com.datadog.api.client.v2.model.UsageQuotasListResponse; import com.datadog.api.client.v2.model.UsageSummaryAvailableFieldsResponse; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -57,6 +65,456 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** Manage optional parameters to createQuotas. */ + public static class CreateQuotasOptionalParameters { + private Boolean includeDescendants; + + /** + * Set includeDescendants. + * + * @param includeDescendants Whether to write every item in the request to the caller's + * organization and all of its descendant organizations, instead of only the caller's + * organization. Only descendants in the same datacenter are supported. For a user-handle + * scope, the quota is applied only to the caller's organization and to descendant + * organizations where that user handle exists; the item fails only if the handle exists in + * none of them. (optional, default to false) + * @return CreateQuotasOptionalParameters + */ + public CreateQuotasOptionalParameters includeDescendants(Boolean includeDescendants) { + this.includeDescendants = includeDescendants; + return this; + } + } + + /** + * Create or update usage quotas. + * + *

See {@link #createQuotasWithHttpInfo}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param body The usage quotas to create or update. (required) + * @return UsageQuotasBulkResponse + * @throws ApiException if fails to make API call + */ + public UsageQuotasBulkResponse createQuotas(String quotaNamespace, UsageQuotasCreateRequest body) + throws ApiException { + return createQuotasWithHttpInfo(quotaNamespace, body, new CreateQuotasOptionalParameters()) + .getData(); + } + + /** + * Create or update usage quotas. + * + *

See {@link #createQuotasWithHttpInfoAsync}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param body The usage quotas to create or update. (required) + * @return CompletableFuture<UsageQuotasBulkResponse> + */ + public CompletableFuture createQuotasAsync( + String quotaNamespace, UsageQuotasCreateRequest body) { + return createQuotasWithHttpInfoAsync(quotaNamespace, body, new CreateQuotasOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create or update usage quotas. + * + *

See {@link #createQuotasWithHttpInfo}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param body The usage quotas to create or update. (required) + * @param parameters Optional parameters for the request. + * @return UsageQuotasBulkResponse + * @throws ApiException if fails to make API call + */ + public UsageQuotasBulkResponse createQuotas( + String quotaNamespace, + UsageQuotasCreateRequest body, + CreateQuotasOptionalParameters parameters) + throws ApiException { + return createQuotasWithHttpInfo(quotaNamespace, body, parameters).getData(); + } + + /** + * Create or update usage quotas. + * + *

See {@link #createQuotasWithHttpInfoAsync}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param body The usage quotas to create or update. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<UsageQuotasBulkResponse> + */ + public CompletableFuture createQuotasAsync( + String quotaNamespace, + UsageQuotasCreateRequest body, + CreateQuotasOptionalParameters parameters) { + return createQuotasWithHttpInfoAsync(quotaNamespace, body, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Creates or updates one or more usage quotas by scope. If a quota already exists for a supplied + * scope, it is updated; otherwise, a new quota is created. Requires the user_access_manage + * , billing_edit, and org_management permissions. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param body The usage quotas to create or update. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<UsageQuotasBulkResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK. Every item in the batch was written successfully. -
207 Multi-Status. One or more items in the batch failed to write; see each item's `error` attribute. Items that succeeded were written even though others failed. -
400 Bad Request -
403 Forbidden -
429 Too many requests -
500 Internal Server Error. Every item in the batch failed to write. -
+ */ + public ApiResponse createQuotasWithHttpInfo( + String quotaNamespace, + UsageQuotasCreateRequest body, + CreateQuotasOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createQuotas"; + 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 'quotaNamespace' is set + if (quotaNamespace == null) { + throw new ApiException( + 400, "Missing the required parameter 'quotaNamespace' when calling createQuotas"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createQuotas"); + } + Boolean includeDescendants = parameters.includeDescendants; + // create path and map variables + String localVarPath = + "/api/v2/usage/quotas/{quota_namespace}" + .replaceAll( + "\\{" + "quota_namespace" + "\\}", + apiClient.escapeString(quotaNamespace.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "include_descendants", includeDescendants)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.createQuotas", + localVarPath, + localVarQueryParams, + 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 or update usage quotas. + * + *

See {@link #createQuotasWithHttpInfo}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param body The usage quotas to create or update. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<UsageQuotasBulkResponse>> + */ + public CompletableFuture> createQuotasWithHttpInfoAsync( + String quotaNamespace, + UsageQuotasCreateRequest body, + CreateQuotasOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "createQuotas"; + 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 'quotaNamespace' is set + if (quotaNamespace == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'quotaNamespace' when calling createQuotas")); + 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 createQuotas")); + return result; + } + Boolean includeDescendants = parameters.includeDescendants; + // create path and map variables + String localVarPath = + "/api/v2/usage/quotas/{quota_namespace}" + .replaceAll( + "\\{" + "quota_namespace" + "\\}", + apiClient.escapeString(quotaNamespace.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "include_descendants", includeDescendants)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.createQuotas", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Delete a usage quota. + * + *

See {@link #deleteQuotaWithHttpInfo}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param id The opaque quota identifier returned by a previous list or create request. Clients + * must pass this value verbatim. (required) + * @throws ApiException if fails to make API call + */ + public void deleteQuota(String quotaNamespace, String id) throws ApiException { + deleteQuotaWithHttpInfo(quotaNamespace, id); + } + + /** + * Delete a usage quota. + * + *

See {@link #deleteQuotaWithHttpInfoAsync}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param id The opaque quota identifier returned by a previous list or create request. Clients + * must pass this value verbatim. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteQuotaAsync(String quotaNamespace, String id) { + return deleteQuotaWithHttpInfoAsync(quotaNamespace, id) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Deletes a usage quota by its opaque identifier. The quota must belong to the caller's + * organization or one of its descendants, and its opaque identifier must belong to the requested + * quota namespace. Requires the user_access_manage, billing_edit, and + * org_management permissions. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param id The opaque quota identifier returned by a previous list or create request. Clients + * must pass this value verbatim. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteQuotaWithHttpInfo(String quotaNamespace, String id) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteQuota"; + 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 'quotaNamespace' is set + if (quotaNamespace == null) { + throw new ApiException( + 400, "Missing the required parameter 'quotaNamespace' when calling deleteQuota"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException(400, "Missing the required parameter 'id' when calling deleteQuota"); + } + // create path and map variables + String localVarPath = + "/api/v2/usage/quotas/{quota_namespace}/{id}" + .replaceAll( + "\\{" + "quota_namespace" + "\\}", + apiClient.escapeString(quotaNamespace.toString())) + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.deleteQuota", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete a usage quota. + * + *

See {@link #deleteQuotaWithHttpInfo}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param id The opaque quota identifier returned by a previous list or create request. Clients + * must pass this value verbatim. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteQuotaWithHttpInfoAsync( + String quotaNamespace, String id) { + // Check if unstable operation is enabled + String operationId = "deleteQuota"; + 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 'quotaNamespace' is set + if (quotaNamespace == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'quotaNamespace' when calling deleteQuota")); + return result; + } + + // verify the required parameter 'id' is set + if (id == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(400, "Missing the required parameter 'id' when calling deleteQuota")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/usage/quotas/{quota_namespace}/{id}" + .replaceAll( + "\\{" + "quota_namespace" + "\\}", + apiClient.escapeString(quotaNamespace.toString())) + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.deleteQuota", + 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 active billing dimensions for cost attribution. * @@ -3161,4 +3619,535 @@ public UsageSummaryAvailableFieldsResponse getUsageSummaryAvailableFields() thro false, new GenericType() {}); } + + /** Manage optional parameters to listQuotas. */ + public static class ListQuotasOptionalParameters { + private Boolean includeDescendants; + private String pageCursor; + private Long pageLimit; + + /** + * Set includeDescendants. + * + * @param includeDescendants Whether to include quotas configured on descendant organizations in + * the caller's organization hierarchy. Only descendants in the same datacenter are + * supported. (optional, default to false) + * @return ListQuotasOptionalParameters + */ + public ListQuotasOptionalParameters includeDescendants(Boolean includeDescendants) { + this.includeDescendants = includeDescendants; + return this; + } + + /** + * Set pageCursor. + * + * @param pageCursor An opaque cursor from a previous response's meta.page.next_cursor + * used to retrieve the next page. (optional) + * @return ListQuotasOptionalParameters + */ + public ListQuotasOptionalParameters pageCursor(String pageCursor) { + this.pageCursor = pageCursor; + return this; + } + + /** + * Set pageLimit. + * + * @param pageLimit The number of usage quotas to return per page. (optional, default to 100) + * @return ListQuotasOptionalParameters + */ + public ListQuotasOptionalParameters pageLimit(Long pageLimit) { + this.pageLimit = pageLimit; + return this; + } + } + + /** + * List usage quotas. + * + *

See {@link #listQuotasWithHttpInfo}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @return UsageQuotasListResponse + * @throws ApiException if fails to make API call + */ + public UsageQuotasListResponse listQuotas(String quotaNamespace) throws ApiException { + return listQuotasWithHttpInfo(quotaNamespace, new ListQuotasOptionalParameters()).getData(); + } + + /** + * List usage quotas. + * + *

See {@link #listQuotasWithHttpInfoAsync}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @return CompletableFuture<UsageQuotasListResponse> + */ + public CompletableFuture listQuotasAsync(String quotaNamespace) { + return listQuotasWithHttpInfoAsync(quotaNamespace, new ListQuotasOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List usage quotas. + * + *

See {@link #listQuotasWithHttpInfo}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param parameters Optional parameters for the request. + * @return UsageQuotasListResponse + * @throws ApiException if fails to make API call + */ + public UsageQuotasListResponse listQuotas( + String quotaNamespace, ListQuotasOptionalParameters parameters) throws ApiException { + return listQuotasWithHttpInfo(quotaNamespace, parameters).getData(); + } + + /** + * List usage quotas. + * + *

See {@link #listQuotasWithHttpInfoAsync}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<UsageQuotasListResponse> + */ + public CompletableFuture listQuotasAsync( + String quotaNamespace, ListQuotasOptionalParameters parameters) { + return listQuotasWithHttpInfoAsync(quotaNamespace, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List usage quotas. + * + *

See {@link #listQuotasWithHttpInfo}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @return PaginationIterable<UsageQuotaResponseData> + */ + public PaginationIterable listQuotasWithPagination( + String quotaNamespace) { + ListQuotasOptionalParameters parameters = new ListQuotasOptionalParameters(); + return listQuotasWithPagination(quotaNamespace, parameters); + } + + /** + * List usage quotas. + * + *

See {@link #listQuotasWithHttpInfo}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @return UsageQuotasListResponse + */ + public PaginationIterable listQuotasWithPagination( + String quotaNamespace, ListQuotasOptionalParameters parameters) { + String resultsPath = "getData"; + String valueGetterPath = "getMeta.getPage.getNextCursor"; + String valueSetterPath = "pageCursor"; + Boolean valueSetterParamOptional = true; + Long limit; + + if (parameters.pageLimit == null) { + limit = 100l; + parameters.pageLimit(limit); + } else { + limit = parameters.pageLimit; + } + + LinkedHashMap args = new LinkedHashMap(); + args.put("quotaNamespace", quotaNamespace); + args.put("optionalParams", parameters); + + PaginationIterable iterator = + new PaginationIterable( + this, + "listQuotas", + resultsPath, + valueGetterPath, + valueSetterPath, + valueSetterParamOptional, + true, + true, + limit, + args, + 0); + + return iterator; + } + + /** + * Lists usage quotas for the caller's organization in a quota namespace. You can optionally + * include descendant organizations in the same datacenter as the caller. Requires the + * user_access_manage, billing_edit, and org_management + * permissions. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<UsageQuotasListResponse> + * @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 -
429 Too many requests -
+ */ + public ApiResponse listQuotasWithHttpInfo( + String quotaNamespace, ListQuotasOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listQuotas"; + 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 'quotaNamespace' is set + if (quotaNamespace == null) { + throw new ApiException( + 400, "Missing the required parameter 'quotaNamespace' when calling listQuotas"); + } + Boolean includeDescendants = parameters.includeDescendants; + String pageCursor = parameters.pageCursor; + Long pageLimit = parameters.pageLimit; + // create path and map variables + String localVarPath = + "/api/v2/usage/quotas/{quota_namespace}" + .replaceAll( + "\\{" + "quota_namespace" + "\\}", + apiClient.escapeString(quotaNamespace.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "include_descendants", includeDescendants)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[cursor]", pageCursor)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.listQuotas", + localVarPath, + localVarQueryParams, + 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 usage quotas. + * + *

See {@link #listQuotasWithHttpInfo}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<UsageQuotasListResponse>> + */ + public CompletableFuture> listQuotasWithHttpInfoAsync( + String quotaNamespace, ListQuotasOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listQuotas"; + 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 'quotaNamespace' is set + if (quotaNamespace == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'quotaNamespace' when calling listQuotas")); + return result; + } + Boolean includeDescendants = parameters.includeDescendants; + String pageCursor = parameters.pageCursor; + Long pageLimit = parameters.pageLimit; + // create path and map variables + String localVarPath = + "/api/v2/usage/quotas/{quota_namespace}" + .replaceAll( + "\\{" + "quota_namespace" + "\\}", + apiClient.escapeString(quotaNamespace.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "include_descendants", includeDescendants)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[cursor]", pageCursor)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.listQuotas", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a usage quota. + * + *

See {@link #updateQuotaWithHttpInfo}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param id The opaque quota identifier returned by a previous list or create request. Clients + * must pass this value verbatim. (required) + * @param body The usage quota fields to update. Omitting an attribute leaves its current value + * unchanged. (required) + * @return UsageQuotaResponse + * @throws ApiException if fails to make API call + */ + public UsageQuotaResponse updateQuota( + String quotaNamespace, String id, UsageQuotaUpdateRequest body) throws ApiException { + return updateQuotaWithHttpInfo(quotaNamespace, id, body).getData(); + } + + /** + * Update a usage quota. + * + *

See {@link #updateQuotaWithHttpInfoAsync}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param id The opaque quota identifier returned by a previous list or create request. Clients + * must pass this value verbatim. (required) + * @param body The usage quota fields to update. Omitting an attribute leaves its current value + * unchanged. (required) + * @return CompletableFuture<UsageQuotaResponse> + */ + public CompletableFuture updateQuotaAsync( + String quotaNamespace, String id, UsageQuotaUpdateRequest body) { + return updateQuotaWithHttpInfoAsync(quotaNamespace, id, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Updates the supplied fields on a usage quota and leaves omitted fields unchanged. The quota + * must belong to the caller's organization or one of its descendants, and its opaque identifier + * must belong to the requested quota namespace. Requires the user_access_manage, + * billing_edit, and org_management permissions. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param id The opaque quota identifier returned by a previous list or create request. Clients + * must pass this value verbatim. (required) + * @param body The usage quota fields to update. Omitting an attribute leaves its current value + * unchanged. (required) + * @return ApiResponse<UsageQuotaResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request. Returned if the request is malformed, or if the `id` in the request body does not match the `id` in the request path. -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateQuotaWithHttpInfo( + String quotaNamespace, String id, UsageQuotaUpdateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateQuota"; + 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 'quotaNamespace' is set + if (quotaNamespace == null) { + throw new ApiException( + 400, "Missing the required parameter 'quotaNamespace' when calling updateQuota"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException(400, "Missing the required parameter 'id' when calling updateQuota"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updateQuota"); + } + // create path and map variables + String localVarPath = + "/api/v2/usage/quotas/{quota_namespace}/{id}" + .replaceAll( + "\\{" + "quota_namespace" + "\\}", + apiClient.escapeString(quotaNamespace.toString())) + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.updateQuota", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a usage quota. + * + *

See {@link #updateQuotaWithHttpInfo}. + * + * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. + * (required) + * @param id The opaque quota identifier returned by a previous list or create request. Clients + * must pass this value verbatim. (required) + * @param body The usage quota fields to update. Omitting an attribute leaves its current value + * unchanged. (required) + * @return CompletableFuture<ApiResponse<UsageQuotaResponse>> + */ + public CompletableFuture> updateQuotaWithHttpInfoAsync( + String quotaNamespace, String id, UsageQuotaUpdateRequest body) { + // Check if unstable operation is enabled + String operationId = "updateQuota"; + 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 'quotaNamespace' is set + if (quotaNamespace == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'quotaNamespace' when calling updateQuota")); + return result; + } + + // verify the required parameter 'id' is set + if (id == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(400, "Missing the required parameter 'id' when calling updateQuota")); + 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 updateQuota")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/usage/quotas/{quota_namespace}/{id}" + .replaceAll( + "\\{" + "quota_namespace" + "\\}", + apiClient.escapeString(quotaNamespace.toString())) + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.updateQuota", + 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/UsageQuotaBulkResultAttributes.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaBulkResultAttributes.java new file mode 100644 index 00000000000..2e43efe000a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaBulkResultAttributes.java @@ -0,0 +1,264 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * Attributes of a usage quota bulk write result. On success, all fields except error + * are present. On failure, only error is present and the other fields are omitted. + */ +@JsonPropertyOrder({ + UsageQuotaBulkResultAttributes.JSON_PROPERTY_ENFORCED, + UsageQuotaBulkResultAttributes.JSON_PROPERTY_ERROR, + UsageQuotaBulkResultAttributes.JSON_PROPERTY_ORG_PUBLIC_ID, + UsageQuotaBulkResultAttributes.JSON_PROPERTY_SCOPE, + UsageQuotaBulkResultAttributes.JSON_PROPERTY_USAGE_LIMIT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotaBulkResultAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENFORCED = "enforced"; + private Boolean enforced; + + public static final String JSON_PROPERTY_ERROR = "error"; + private String error; + + public static final String JSON_PROPERTY_ORG_PUBLIC_ID = "org_public_id"; + private String orgPublicId; + + public static final String JSON_PROPERTY_SCOPE = "scope"; + private Map scope = null; + + public static final String JSON_PROPERTY_USAGE_LIMIT = "usage_limit"; + private Long usageLimit; + + public UsageQuotaBulkResultAttributes enforced(Boolean enforced) { + this.enforced = enforced; + return this; + } + + /** + * Whether usage above the limit is actively blocked instead of only tracked or alerted on. + * Omitted if this item failed to write. + * + * @return enforced + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENFORCED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getEnforced() { + return enforced; + } + + public void setEnforced(Boolean enforced) { + this.enforced = enforced; + } + + public UsageQuotaBulkResultAttributes error(String error) { + this.error = error; + return this; + } + + /** + * An error message describing why this item failed to write. Omitted if this item was written + * successfully. + * + * @return error + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ERROR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getError() { + return error; + } + + public void setError(String error) { + this.error = error; + } + + public UsageQuotaBulkResultAttributes orgPublicId(String orgPublicId) { + this.orgPublicId = orgPublicId; + return this; + } + + /** + * The public ID of the organization that owns the quota. Omitted if this item failed to write. + * + * @return orgPublicId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ORG_PUBLIC_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getOrgPublicId() { + return orgPublicId; + } + + public void setOrgPublicId(String orgPublicId) { + this.orgPublicId = orgPublicId; + } + + public UsageQuotaBulkResultAttributes scope(Map scope) { + this.scope = scope; + return this; + } + + public UsageQuotaBulkResultAttributes putScopeItem(String key, String scopeItem) { + if (this.scope == null) { + this.scope = new HashMap<>(); + } + this.scope.put(key, scopeItem); + return this; + } + + /** + * A namespace-specific key and value identifying what the quota applies to within an + * organization. The object contains exactly one entry. A value of "*" identifies the + * default quota applied to entities without a specific quota. This field is omitted for an + * organization-wide quota. + * + * @return scope + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getScope() { + return scope; + } + + public void setScope(Map scope) { + this.scope = scope; + } + + public UsageQuotaBulkResultAttributes usageLimit(Long usageLimit) { + this.usageLimit = usageLimit; + return this; + } + + /** + * The quota limit in the usage units defined by the quota namespace. Omitted if this item failed + * to write. + * + * @return usageLimit + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_USAGE_LIMIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getUsageLimit() { + return usageLimit; + } + + public void setUsageLimit(Long usageLimit) { + this.usageLimit = usageLimit; + } + + /** + * 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 UsageQuotaBulkResultAttributes + */ + @JsonAnySetter + public UsageQuotaBulkResultAttributes 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 UsageQuotaBulkResultAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotaBulkResultAttributes usageQuotaBulkResultAttributes = + (UsageQuotaBulkResultAttributes) o; + return Objects.equals(this.enforced, usageQuotaBulkResultAttributes.enforced) + && Objects.equals(this.error, usageQuotaBulkResultAttributes.error) + && Objects.equals(this.orgPublicId, usageQuotaBulkResultAttributes.orgPublicId) + && Objects.equals(this.scope, usageQuotaBulkResultAttributes.scope) + && Objects.equals(this.usageLimit, usageQuotaBulkResultAttributes.usageLimit) + && Objects.equals( + this.additionalProperties, usageQuotaBulkResultAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enforced, error, orgPublicId, scope, usageLimit, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotaBulkResultAttributes {\n"); + sb.append(" enforced: ").append(toIndentedString(enforced)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" orgPublicId: ").append(toIndentedString(orgPublicId)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" usageLimit: ").append(toIndentedString(usageLimit)).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/UsageQuotaBulkResultData.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaBulkResultData.java new file mode 100644 index 00000000000..910f91285ed --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaBulkResultData.java @@ -0,0 +1,214 @@ +/* + * 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 result of writing one usage quota in a bulk create-or-update request. */ +@JsonPropertyOrder({ + UsageQuotaBulkResultData.JSON_PROPERTY_ATTRIBUTES, + UsageQuotaBulkResultData.JSON_PROPERTY_ID, + UsageQuotaBulkResultData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotaBulkResultData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UsageQuotaBulkResultAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private UsageQuotaType type; + + public UsageQuotaBulkResultData() {} + + @JsonCreator + public UsageQuotaBulkResultData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + UsageQuotaBulkResultAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) UsageQuotaType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public UsageQuotaBulkResultData attributes(UsageQuotaBulkResultAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a usage quota bulk write result. On success, all fields except error + * are present. On failure, only error is present and the other fields are omitted. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UsageQuotaBulkResultAttributes getAttributes() { + return attributes; + } + + public void setAttributes(UsageQuotaBulkResultAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public UsageQuotaBulkResultData id(String id) { + this.id = id; + return this; + } + + /** + * An opaque usage quota identifier. Clients must pass this value back verbatim in update and + * delete requests and must not infer any structure from it. + * + * @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 UsageQuotaBulkResultData type(UsageQuotaType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The JSON:API resource type for a usage quota. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UsageQuotaType getType() { + return type; + } + + public void setType(UsageQuotaType 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 UsageQuotaBulkResultData + */ + @JsonAnySetter + public UsageQuotaBulkResultData 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 UsageQuotaBulkResultData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotaBulkResultData usageQuotaBulkResultData = (UsageQuotaBulkResultData) o; + return Objects.equals(this.attributes, usageQuotaBulkResultData.attributes) + && Objects.equals(this.id, usageQuotaBulkResultData.id) + && Objects.equals(this.type, usageQuotaBulkResultData.type) + && Objects.equals(this.additionalProperties, usageQuotaBulkResultData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotaBulkResultData {\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/UsageQuotaCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaCreateAttributes.java new file mode 100644 index 00000000000..adfd9a2fe3f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaCreateAttributes.java @@ -0,0 +1,217 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes for creating or updating a usage quota by scope. */ +@JsonPropertyOrder({ + UsageQuotaCreateAttributes.JSON_PROPERTY_ENFORCED, + UsageQuotaCreateAttributes.JSON_PROPERTY_SCOPE, + UsageQuotaCreateAttributes.JSON_PROPERTY_USAGE_LIMIT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotaCreateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENFORCED = "enforced"; + private Boolean enforced; + + public static final String JSON_PROPERTY_SCOPE = "scope"; + private Map scope = null; + + public static final String JSON_PROPERTY_USAGE_LIMIT = "usage_limit"; + private Long usageLimit; + + public UsageQuotaCreateAttributes() {} + + @JsonCreator + public UsageQuotaCreateAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ENFORCED) Boolean enforced, + @JsonProperty(required = true, value = JSON_PROPERTY_USAGE_LIMIT) Long usageLimit) { + this.enforced = enforced; + this.usageLimit = usageLimit; + } + + public UsageQuotaCreateAttributes enforced(Boolean enforced) { + this.enforced = enforced; + return this; + } + + /** + * Whether to actively block usage above the limit instead of only tracking or alerting on it. + * + * @return enforced + */ + @JsonProperty(JSON_PROPERTY_ENFORCED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getEnforced() { + return enforced; + } + + public void setEnforced(Boolean enforced) { + this.enforced = enforced; + } + + public UsageQuotaCreateAttributes scope(Map scope) { + this.scope = scope; + return this; + } + + public UsageQuotaCreateAttributes putScopeItem(String key, String scopeItem) { + if (this.scope == null) { + this.scope = new HashMap<>(); + } + this.scope.put(key, scopeItem); + return this; + } + + /** + * A namespace-specific key and value identifying what the quota applies to within an + * organization. The object must contain exactly one entry. Use "*" as the value for + * the default quota applied to entities without a specific quota, or omit the scope for an + * organization-wide quota. A specific value must identify an existing user handle in the caller's + * organization. When include_descendants is true, the quota is applied only to the + * caller's organization and to descendant organizations where that user handle also exists; the + * request fails only if the handle exists in none of them. + * + * @return scope + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getScope() { + return scope; + } + + public void setScope(Map scope) { + this.scope = scope; + } + + public UsageQuotaCreateAttributes usageLimit(Long usageLimit) { + this.usageLimit = usageLimit; + return this; + } + + /** + * The quota limit to set in the usage units defined by the quota namespace. For an + * organization-wide quota (scope omitted), the limit must be greater than the usage already + * recorded in the current period. minimum: 0 + * + * @return usageLimit + */ + @JsonProperty(JSON_PROPERTY_USAGE_LIMIT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getUsageLimit() { + return usageLimit; + } + + public void setUsageLimit(Long usageLimit) { + this.usageLimit = usageLimit; + } + + /** + * 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 UsageQuotaCreateAttributes + */ + @JsonAnySetter + public UsageQuotaCreateAttributes 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 UsageQuotaCreateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotaCreateAttributes usageQuotaCreateAttributes = (UsageQuotaCreateAttributes) o; + return Objects.equals(this.enforced, usageQuotaCreateAttributes.enforced) + && Objects.equals(this.scope, usageQuotaCreateAttributes.scope) + && Objects.equals(this.usageLimit, usageQuotaCreateAttributes.usageLimit) + && Objects.equals( + this.additionalProperties, usageQuotaCreateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enforced, scope, usageLimit, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotaCreateAttributes {\n"); + sb.append(" enforced: ").append(toIndentedString(enforced)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" usageLimit: ").append(toIndentedString(usageLimit)).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/UsageQuotaCreateData.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaCreateData.java new file mode 100644 index 00000000000..e0f8334ef5a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaCreateData.java @@ -0,0 +1,184 @@ +/* + * 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; + +/** A usage quota resource to create or update by scope. */ +@JsonPropertyOrder({ + UsageQuotaCreateData.JSON_PROPERTY_ATTRIBUTES, + UsageQuotaCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotaCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UsageQuotaCreateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private UsageQuotaType type; + + public UsageQuotaCreateData() {} + + @JsonCreator + public UsageQuotaCreateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + UsageQuotaCreateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) UsageQuotaType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public UsageQuotaCreateData attributes(UsageQuotaCreateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for creating or updating a usage quota by scope. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UsageQuotaCreateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(UsageQuotaCreateAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public UsageQuotaCreateData type(UsageQuotaType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The JSON:API resource type for a usage quota. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UsageQuotaType getType() { + return type; + } + + public void setType(UsageQuotaType 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 UsageQuotaCreateData + */ + @JsonAnySetter + public UsageQuotaCreateData 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 UsageQuotaCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotaCreateData usageQuotaCreateData = (UsageQuotaCreateData) o; + return Objects.equals(this.attributes, usageQuotaCreateData.attributes) + && Objects.equals(this.type, usageQuotaCreateData.type) + && Objects.equals(this.additionalProperties, usageQuotaCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotaCreateData {\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/UsageQuotaResponse.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaResponse.java new file mode 100644 index 00000000000..8d96cea6266 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaResponse.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response containing a usage quota. */ +@JsonPropertyOrder({UsageQuotaResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotaResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private UsageQuotaResponseData data; + + public UsageQuotaResponse() {} + + @JsonCreator + public UsageQuotaResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) UsageQuotaResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public UsageQuotaResponse data(UsageQuotaResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A usage quota resource. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UsageQuotaResponseData getData() { + return data; + } + + public void setData(UsageQuotaResponseData 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 UsageQuotaResponse + */ + @JsonAnySetter + public UsageQuotaResponse 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 UsageQuotaResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotaResponse usageQuotaResponse = (UsageQuotaResponse) o; + return Objects.equals(this.data, usageQuotaResponse.data) + && Objects.equals(this.additionalProperties, usageQuotaResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotaResponse {\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/UsageQuotaResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaResponseAttributes.java new file mode 100644 index 00000000000..d894f1780e8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaResponseAttributes.java @@ -0,0 +1,240 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes of a usage quota. */ +@JsonPropertyOrder({ + UsageQuotaResponseAttributes.JSON_PROPERTY_ENFORCED, + UsageQuotaResponseAttributes.JSON_PROPERTY_ORG_PUBLIC_ID, + UsageQuotaResponseAttributes.JSON_PROPERTY_SCOPE, + UsageQuotaResponseAttributes.JSON_PROPERTY_USAGE_LIMIT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotaResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENFORCED = "enforced"; + private Boolean enforced; + + public static final String JSON_PROPERTY_ORG_PUBLIC_ID = "org_public_id"; + private String orgPublicId; + + public static final String JSON_PROPERTY_SCOPE = "scope"; + private Map scope = null; + + public static final String JSON_PROPERTY_USAGE_LIMIT = "usage_limit"; + private Long usageLimit; + + public UsageQuotaResponseAttributes() {} + + @JsonCreator + public UsageQuotaResponseAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ENFORCED) Boolean enforced, + @JsonProperty(required = true, value = JSON_PROPERTY_ORG_PUBLIC_ID) String orgPublicId, + @JsonProperty(required = true, value = JSON_PROPERTY_USAGE_LIMIT) Long usageLimit) { + this.enforced = enforced; + this.orgPublicId = orgPublicId; + this.usageLimit = usageLimit; + } + + public UsageQuotaResponseAttributes enforced(Boolean enforced) { + this.enforced = enforced; + return this; + } + + /** + * Whether usage above the limit is actively blocked instead of only tracked or alerted on. + * + * @return enforced + */ + @JsonProperty(JSON_PROPERTY_ENFORCED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getEnforced() { + return enforced; + } + + public void setEnforced(Boolean enforced) { + this.enforced = enforced; + } + + public UsageQuotaResponseAttributes orgPublicId(String orgPublicId) { + this.orgPublicId = orgPublicId; + return this; + } + + /** + * The public ID of the organization that owns the quota. + * + * @return orgPublicId + */ + @JsonProperty(JSON_PROPERTY_ORG_PUBLIC_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getOrgPublicId() { + return orgPublicId; + } + + public void setOrgPublicId(String orgPublicId) { + this.orgPublicId = orgPublicId; + } + + public UsageQuotaResponseAttributes scope(Map scope) { + this.scope = scope; + return this; + } + + public UsageQuotaResponseAttributes putScopeItem(String key, String scopeItem) { + if (this.scope == null) { + this.scope = new HashMap<>(); + } + this.scope.put(key, scopeItem); + return this; + } + + /** + * A namespace-specific key and value identifying what the quota applies to within an + * organization. The object contains exactly one entry. A value of "*" identifies the + * default quota applied to entities without a specific quota. This field is omitted for an + * organization-wide quota. + * + * @return scope + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getScope() { + return scope; + } + + public void setScope(Map scope) { + this.scope = scope; + } + + public UsageQuotaResponseAttributes usageLimit(Long usageLimit) { + this.usageLimit = usageLimit; + return this; + } + + /** + * The quota limit in the usage units defined by the quota namespace. + * + * @return usageLimit + */ + @JsonProperty(JSON_PROPERTY_USAGE_LIMIT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getUsageLimit() { + return usageLimit; + } + + public void setUsageLimit(Long usageLimit) { + this.usageLimit = usageLimit; + } + + /** + * 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 UsageQuotaResponseAttributes + */ + @JsonAnySetter + public UsageQuotaResponseAttributes 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 UsageQuotaResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotaResponseAttributes usageQuotaResponseAttributes = (UsageQuotaResponseAttributes) o; + return Objects.equals(this.enforced, usageQuotaResponseAttributes.enforced) + && Objects.equals(this.orgPublicId, usageQuotaResponseAttributes.orgPublicId) + && Objects.equals(this.scope, usageQuotaResponseAttributes.scope) + && Objects.equals(this.usageLimit, usageQuotaResponseAttributes.usageLimit) + && Objects.equals( + this.additionalProperties, usageQuotaResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enforced, orgPublicId, scope, usageLimit, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotaResponseAttributes {\n"); + sb.append(" enforced: ").append(toIndentedString(enforced)).append("\n"); + sb.append(" orgPublicId: ").append(toIndentedString(orgPublicId)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" usageLimit: ").append(toIndentedString(usageLimit)).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/UsageQuotaResponseData.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaResponseData.java new file mode 100644 index 00000000000..4f36b7a1824 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaResponseData.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; + +/** A usage quota resource. */ +@JsonPropertyOrder({ + UsageQuotaResponseData.JSON_PROPERTY_ATTRIBUTES, + UsageQuotaResponseData.JSON_PROPERTY_ID, + UsageQuotaResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotaResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UsageQuotaResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private UsageQuotaType type; + + public UsageQuotaResponseData() {} + + @JsonCreator + public UsageQuotaResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + UsageQuotaResponseAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) UsageQuotaType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public UsageQuotaResponseData attributes(UsageQuotaResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a usage quota. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UsageQuotaResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(UsageQuotaResponseAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public UsageQuotaResponseData id(String id) { + this.id = id; + return this; + } + + /** + * An opaque usage quota identifier. Clients must pass this value back verbatim in update and + * delete requests and must not infer any structure from it. + * + * @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 UsageQuotaResponseData type(UsageQuotaType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The JSON:API resource type for a usage quota. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UsageQuotaType getType() { + return type; + } + + public void setType(UsageQuotaType 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 UsageQuotaResponseData + */ + @JsonAnySetter + public UsageQuotaResponseData 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 UsageQuotaResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotaResponseData usageQuotaResponseData = (UsageQuotaResponseData) o; + return Objects.equals(this.attributes, usageQuotaResponseData.attributes) + && Objects.equals(this.id, usageQuotaResponseData.id) + && Objects.equals(this.type, usageQuotaResponseData.type) + && Objects.equals(this.additionalProperties, usageQuotaResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotaResponseData {\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/UsageQuotaType.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaType.java new file mode 100644 index 00000000000..20ca1814698 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaType.java @@ -0,0 +1,53 @@ +/* + * 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 JSON:API resource type for a usage quota. */ +@JsonSerialize(using = UsageQuotaType.UsageQuotaTypeSerializer.class) +public class UsageQuotaType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("quotas")); + + public static final UsageQuotaType QUOTAS = new UsageQuotaType("quotas"); + + UsageQuotaType(String value) { + super(value, allowedValues); + } + + public static class UsageQuotaTypeSerializer extends StdSerializer { + public UsageQuotaTypeSerializer(Class t) { + super(t); + } + + public UsageQuotaTypeSerializer() { + this(null); + } + + @Override + public void serialize(UsageQuotaType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static UsageQuotaType fromValue(String value) { + return new UsageQuotaType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UsageQuotaUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaUpdateAttributes.java new file mode 100644 index 00000000000..daaafd0c83a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaUpdateAttributes.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Attributes to update on a usage quota. Omitting a property leaves its current value unchanged. + */ +@JsonPropertyOrder({ + UsageQuotaUpdateAttributes.JSON_PROPERTY_ENFORCED, + UsageQuotaUpdateAttributes.JSON_PROPERTY_USAGE_LIMIT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotaUpdateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENFORCED = "enforced"; + private JsonNullable enforced = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_USAGE_LIMIT = "usage_limit"; + private JsonNullable usageLimit = JsonNullable.undefined(); + + public UsageQuotaUpdateAttributes enforced(Boolean enforced) { + this.enforced = JsonNullable.of(enforced); + return this; + } + + /** + * Whether to actively block usage above the limit. Omit this field to leave the current + * enforcement setting unchanged. + * + * @return enforced + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Boolean getEnforced() { + return enforced.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENFORCED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getEnforced_JsonNullable() { + return enforced; + } + + @JsonProperty(JSON_PROPERTY_ENFORCED) + public void setEnforced_JsonNullable(JsonNullable enforced) { + this.enforced = enforced; + } + + public void setEnforced(Boolean enforced) { + this.enforced = JsonNullable.of(enforced); + } + + public UsageQuotaUpdateAttributes usageLimit(Long usageLimit) { + this.usageLimit = JsonNullable.of(usageLimit); + return this; + } + + /** + * The new quota limit in the usage units defined by the quota namespace. For an organization-wide + * quota (empty scope), the limit must be greater than the usage already recorded in the current + * period. Omit this field to leave the current limit unchanged. minimum: 0 + * + * @return usageLimit + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getUsageLimit() { + return usageLimit.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_USAGE_LIMIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getUsageLimit_JsonNullable() { + return usageLimit; + } + + @JsonProperty(JSON_PROPERTY_USAGE_LIMIT) + public void setUsageLimit_JsonNullable(JsonNullable usageLimit) { + this.usageLimit = usageLimit; + } + + public void setUsageLimit(Long usageLimit) { + this.usageLimit = JsonNullable.of(usageLimit); + } + + /** + * 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 UsageQuotaUpdateAttributes + */ + @JsonAnySetter + public UsageQuotaUpdateAttributes 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 UsageQuotaUpdateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotaUpdateAttributes usageQuotaUpdateAttributes = (UsageQuotaUpdateAttributes) o; + return Objects.equals(this.enforced, usageQuotaUpdateAttributes.enforced) + && Objects.equals(this.usageLimit, usageQuotaUpdateAttributes.usageLimit) + && Objects.equals( + this.additionalProperties, usageQuotaUpdateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enforced, usageLimit, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotaUpdateAttributes {\n"); + sb.append(" enforced: ").append(toIndentedString(enforced)).append("\n"); + sb.append(" usageLimit: ").append(toIndentedString(usageLimit)).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/UsageQuotaUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaUpdateData.java new file mode 100644 index 00000000000..2faa9e49607 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaUpdateData.java @@ -0,0 +1,212 @@ +/* + * 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; + +/** A usage quota resource to update. */ +@JsonPropertyOrder({ + UsageQuotaUpdateData.JSON_PROPERTY_ATTRIBUTES, + UsageQuotaUpdateData.JSON_PROPERTY_ID, + UsageQuotaUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotaUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UsageQuotaUpdateAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private UsageQuotaType type; + + public UsageQuotaUpdateData() {} + + @JsonCreator + public UsageQuotaUpdateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + UsageQuotaUpdateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) UsageQuotaType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public UsageQuotaUpdateData attributes(UsageQuotaUpdateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes to update on a usage quota. Omitting a property leaves its current value unchanged. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UsageQuotaUpdateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(UsageQuotaUpdateAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public UsageQuotaUpdateData id(String id) { + this.id = id; + return this; + } + + /** + * The opaque usage quota identifier, which must match the identifier in the request path. + * + * @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 UsageQuotaUpdateData type(UsageQuotaType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The JSON:API resource type for a usage quota. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UsageQuotaType getType() { + return type; + } + + public void setType(UsageQuotaType 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 UsageQuotaUpdateData + */ + @JsonAnySetter + public UsageQuotaUpdateData 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 UsageQuotaUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotaUpdateData usageQuotaUpdateData = (UsageQuotaUpdateData) o; + return Objects.equals(this.attributes, usageQuotaUpdateData.attributes) + && Objects.equals(this.id, usageQuotaUpdateData.id) + && Objects.equals(this.type, usageQuotaUpdateData.type) + && Objects.equals(this.additionalProperties, usageQuotaUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotaUpdateData {\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/UsageQuotaUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaUpdateRequest.java new file mode 100644 index 00000000000..0f2e94a63a9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaUpdateRequest.java @@ -0,0 +1,148 @@ +/* + * 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 containing the usage quota resource to update. */ +@JsonPropertyOrder({UsageQuotaUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotaUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private UsageQuotaUpdateData data; + + public UsageQuotaUpdateRequest() {} + + @JsonCreator + public UsageQuotaUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) UsageQuotaUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public UsageQuotaUpdateRequest data(UsageQuotaUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A usage quota resource to update. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UsageQuotaUpdateData getData() { + return data; + } + + public void setData(UsageQuotaUpdateData 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 UsageQuotaUpdateRequest + */ + @JsonAnySetter + public UsageQuotaUpdateRequest 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 UsageQuotaUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotaUpdateRequest usageQuotaUpdateRequest = (UsageQuotaUpdateRequest) o; + return Objects.equals(this.data, usageQuotaUpdateRequest.data) + && Objects.equals(this.additionalProperties, usageQuotaUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotaUpdateRequest {\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/UsageQuotasBulkResponse.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotasBulkResponse.java new file mode 100644 index 00000000000..bb94ffe5c08 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotasBulkResponse.java @@ -0,0 +1,168 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * Response containing the result of a bulk usage quota create-or-update request. Returned with a + * 200 status when every item succeeded, or 207 when one or more items + * failed. Failed items carry an error and omit the other attributes. + */ +@JsonPropertyOrder({UsageQuotasBulkResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotasBulkResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public UsageQuotasBulkResponse() {} + + @JsonCreator + public UsageQuotasBulkResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + for (UsageQuotaBulkResultData item : data) { + this.unparsed |= item.unparsed; + } + } + + public UsageQuotasBulkResponse data(List data) { + this.data = data; + for (UsageQuotaBulkResultData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public UsageQuotasBulkResponse addDataItem(UsageQuotaBulkResultData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The results of writing each usage quota in a bulk create-or-update request, in the same order + * as the request. + * + * @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 (UsageQuotaBulkResultData 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 UsageQuotasBulkResponse + */ + @JsonAnySetter + public UsageQuotasBulkResponse 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 UsageQuotasBulkResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotasBulkResponse usageQuotasBulkResponse = (UsageQuotasBulkResponse) o; + return Objects.equals(this.data, usageQuotasBulkResponse.data) + && Objects.equals(this.additionalProperties, usageQuotasBulkResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotasBulkResponse {\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/UsageQuotasCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotasCreateRequest.java new file mode 100644 index 00000000000..0be36ecad3a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotasCreateRequest.java @@ -0,0 +1,165 @@ +/* + * 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; + +/** + * A JSON:API bulk request containing an array of usage quota resources rather than a single + * resource. + */ +@JsonPropertyOrder({UsageQuotasCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotasCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public UsageQuotasCreateRequest() {} + + @JsonCreator + public UsageQuotasCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + for (UsageQuotaCreateData item : data) { + this.unparsed |= item.unparsed; + } + } + + public UsageQuotasCreateRequest data(List data) { + this.data = data; + for (UsageQuotaCreateData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public UsageQuotasCreateRequest addDataItem(UsageQuotaCreateData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * A bulk list of usage quota resources to create or update by scope. + * + * @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 (UsageQuotaCreateData 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 UsageQuotasCreateRequest + */ + @JsonAnySetter + public UsageQuotasCreateRequest 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 UsageQuotasCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotasCreateRequest usageQuotasCreateRequest = (UsageQuotasCreateRequest) o; + return Objects.equals(this.data, usageQuotasCreateRequest.data) + && Objects.equals(this.additionalProperties, usageQuotasCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotasCreateRequest {\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/UsageQuotasListResponse.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotasListResponse.java new file mode 100644 index 00000000000..ee9202f4c18 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotasListResponse.java @@ -0,0 +1,197 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing a paginated list of usage quotas. */ +@JsonPropertyOrder({ + UsageQuotasListResponse.JSON_PROPERTY_DATA, + UsageQuotasListResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotasListResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_META = "meta"; + private UsageQuotasResponseMeta meta; + + public UsageQuotasListResponse() {} + + @JsonCreator + public UsageQuotasListResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data, + @JsonProperty(required = true, value = JSON_PROPERTY_META) UsageQuotasResponseMeta meta) { + this.data = data; + for (UsageQuotaResponseData item : data) { + this.unparsed |= item.unparsed; + } + this.meta = meta; + this.unparsed |= meta.unparsed; + } + + public UsageQuotasListResponse data(List data) { + this.data = data; + for (UsageQuotaResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public UsageQuotasListResponse addDataItem(UsageQuotaResponseData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * A list of usage quota resources. + * + * @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 (UsageQuotaResponseData item : data) { + this.unparsed |= item.unparsed; + } + } + } + + public UsageQuotasListResponse meta(UsageQuotasResponseMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Pagination metadata for a usage quota list response. + * + * @return meta + */ + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UsageQuotasResponseMeta getMeta() { + return meta; + } + + public void setMeta(UsageQuotasResponseMeta meta) { + this.meta = meta; + if (meta != null) { + this.unparsed |= meta.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 UsageQuotasListResponse + */ + @JsonAnySetter + public UsageQuotasListResponse 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 UsageQuotasListResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotasListResponse usageQuotasListResponse = (UsageQuotasListResponse) o; + return Objects.equals(this.data, usageQuotasListResponse.data) + && Objects.equals(this.meta, usageQuotasListResponse.meta) + && Objects.equals(this.additionalProperties, usageQuotasListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotasListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).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/UsageQuotasResponseMeta.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotasResponseMeta.java new file mode 100644 index 00000000000..5858a8b4a3d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotasResponseMeta.java @@ -0,0 +1,148 @@ +/* + * 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; + +/** Pagination metadata for a usage quota list response. */ +@JsonPropertyOrder({UsageQuotasResponseMeta.JSON_PROPERTY_PAGE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotasResponseMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PAGE = "page"; + private UsageQuotasResponseMetaPage page; + + public UsageQuotasResponseMeta() {} + + @JsonCreator + public UsageQuotasResponseMeta( + @JsonProperty(required = true, value = JSON_PROPERTY_PAGE) UsageQuotasResponseMetaPage page) { + this.page = page; + this.unparsed |= page.unparsed; + } + + public UsageQuotasResponseMeta page(UsageQuotasResponseMetaPage page) { + this.page = page; + this.unparsed |= page.unparsed; + return this; + } + + /** + * Cursor pagination fields for a usage quota list response. + * + * @return page + */ + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UsageQuotasResponseMetaPage getPage() { + return page; + } + + public void setPage(UsageQuotasResponseMetaPage page) { + this.page = page; + if (page != null) { + this.unparsed |= page.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 UsageQuotasResponseMeta + */ + @JsonAnySetter + public UsageQuotasResponseMeta 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 UsageQuotasResponseMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotasResponseMeta usageQuotasResponseMeta = (UsageQuotasResponseMeta) o; + return Objects.equals(this.page, usageQuotasResponseMeta.page) + && Objects.equals(this.additionalProperties, usageQuotasResponseMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(page, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotasResponseMeta {\n"); + sb.append(" page: ").append(toIndentedString(page)).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/UsageQuotasResponseMetaPage.java b/src/main/java/com/datadog/api/client/v2/model/UsageQuotasResponseMetaPage.java new file mode 100644 index 00000000000..a9b3a69173d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotasResponseMetaPage.java @@ -0,0 +1,136 @@ +/* + * 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; + +/** Cursor pagination fields for a usage quota list response. */ +@JsonPropertyOrder({UsageQuotasResponseMetaPage.JSON_PROPERTY_NEXT_CURSOR}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UsageQuotasResponseMetaPage { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NEXT_CURSOR = "next_cursor"; + private String nextCursor; + + public UsageQuotasResponseMetaPage nextCursor(String nextCursor) { + this.nextCursor = nextCursor; + return this; + } + + /** + * An opaque cursor for retrieving the next page. Omitted when there are no more results. + * + * @return nextCursor + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NEXT_CURSOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getNextCursor() { + return nextCursor; + } + + public void setNextCursor(String nextCursor) { + this.nextCursor = nextCursor; + } + + /** + * 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 UsageQuotasResponseMetaPage + */ + @JsonAnySetter + public UsageQuotasResponseMetaPage 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 UsageQuotasResponseMetaPage object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsageQuotasResponseMetaPage usageQuotasResponseMetaPage = (UsageQuotasResponseMetaPage) o; + return Objects.equals(this.nextCursor, usageQuotasResponseMetaPage.nextCursor) + && Objects.equals( + this.additionalProperties, usageQuotasResponseMetaPage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(nextCursor, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageQuotasResponseMetaPage {\n"); + sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).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/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 16e0df0b387..a7960e38c9b 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 @@ -10158,6 +10158,30 @@ "type": "safe" } }, + "ListQuotas": { + "tag": "Usage Metering", + "undo": { + "type": "safe" + } + }, + "CreateQuotas": { + "tag": "Usage Metering", + "undo": { + "type": "idempotent" + } + }, + "DeleteQuota": { + "tag": "Usage Metering", + "undo": { + "type": "idempotent" + } + }, + "UpdateQuota": { + "tag": "Usage Metering", + "undo": { + "type": "idempotent" + } + }, "GetUsageSummaryAvailableFields": { "tag": "Usage Metering", "undo": { diff --git a/src/test/resources/com/datadog/api/client/v2/api/usage_metering.feature b/src/test/resources/com/datadog/api/client/v2/api/usage_metering.feature index ee698989227..52c0943c3bc 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/usage_metering.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/usage_metering.feature @@ -14,6 +14,51 @@ Feature: Usage Metering And a valid "appKeyAuth" key in the system And an instance of "UsageMetering" API + @generated @skip @team:DataDog/billing-hub + Scenario: Create or update usage quotas returns "Bad Request" response + Given operation "CreateQuotas" enabled + And new "CreateQuotas" request + And request contains "quota_namespace" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"enforced": true, "scope": {"user_handle": "jane@example.com"}, "usage_limit": 100000}, "type": "quotas"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/billing-hub + Scenario: Create or update usage quotas returns "Multi-Status. One or more items in the batch failed to write; see each item's `error` attribute. Items that succeeded were written even though others failed." response + Given operation "CreateQuotas" enabled + And new "CreateQuotas" request + And request contains "quota_namespace" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"enforced": true, "scope": {"user_handle": "jane@example.com"}, "usage_limit": 100000}, "type": "quotas"}]} + When the request is sent + Then the response status is 207 Multi-Status. One or more items in the batch failed to write; see each item's `error` attribute. Items that succeeded were written even though others failed. + + @generated @skip @team:DataDog/billing-hub + Scenario: Create or update usage quotas returns "OK. Every item in the batch was written successfully." response + Given operation "CreateQuotas" enabled + And new "CreateQuotas" request + And request contains "quota_namespace" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"enforced": true, "scope": {"user_handle": "jane@example.com"}, "usage_limit": 100000}, "type": "quotas"}]} + When the request is sent + Then the response status is 200 OK. Every item in the batch was written successfully. + + @generated @skip @team:DataDog/billing-hub + Scenario: Delete a usage quota returns "No Content" response + Given operation "DeleteQuota" enabled + And new "DeleteQuota" request + And request contains "quota_namespace" parameter from "REPLACE.ME" + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/billing-hub + Scenario: Delete a usage quota returns "Not Found" response + Given operation "DeleteQuota" enabled + And new "DeleteQuota" request + And request contains "quota_namespace" parameter from "REPLACE.ME" + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @replay-only @team:DataDog/billing-hub Scenario: Get Monthly Cost Attribution returns "Bad Request" response Given new "GetMonthlyCostAttribution" request @@ -242,3 +287,57 @@ Feature: Usage Metering And request contains "start_month" parameter with value "{{ timeISO('now') }}" When the request is sent Then the response status is 200 OK + + @generated @skip @team:DataDog/billing-hub + Scenario: List usage quotas returns "Bad Request" response + Given operation "ListQuotas" enabled + And new "ListQuotas" request + And request contains "quota_namespace" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/billing-hub + Scenario: List usage quotas returns "OK" response + Given operation "ListQuotas" enabled + And new "ListQuotas" request + And request contains "quota_namespace" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/billing-hub @with-pagination + Scenario: List usage quotas returns "OK" response with pagination + Given operation "ListQuotas" enabled + And new "ListQuotas" request + And request contains "quota_namespace" parameter from "REPLACE.ME" + When the request with pagination is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/billing-hub + Scenario: Update a usage quota returns "Bad Request. Returned if the request is malformed, or if the `id` in the request body does not match the `id` in the request path." response + Given operation "UpdateQuota" enabled + And new "UpdateQuota" request + And request contains "quota_namespace" parameter from "REPLACE.ME" + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enforced": false, "usage_limit": 120000}, "id": "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f", "type": "quotas"}} + When the request is sent + Then the response status is 400 Bad Request. Returned if the request is malformed, or if the `id` in the request body does not match the `id` in the request path. + + @generated @skip @team:DataDog/billing-hub + Scenario: Update a usage quota returns "Not Found" response + Given operation "UpdateQuota" enabled + And new "UpdateQuota" request + And request contains "quota_namespace" parameter from "REPLACE.ME" + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enforced": false, "usage_limit": 120000}, "id": "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f", "type": "quotas"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/billing-hub + Scenario: Update a usage quota returns "OK" response + Given operation "UpdateQuota" enabled + And new "UpdateQuota" request + And request contains "quota_namespace" parameter from "REPLACE.ME" + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enforced": false, "usage_limit": 120000}, "id": "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f", "type": "quotas"}} + When the request is sent + Then the response status is 200 OK