From 871ed084338966dfd519d424c5fbf46d74b1ae73 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 9 Oct 2026 18:03:41 +0000 Subject: [PATCH] Regenerate client from commit 53b2f9a of spec repo --- .generator/schemas/v2/openapi.yaml | 162 ++++++++++++-- examples/v2/usage-metering/CreateQuotas.java | 5 +- .../v2/usage-metering/DeletePendingQuota.java | 25 +++ examples/v2/usage-metering/DeleteQuota.java | 2 +- examples/v2/usage-metering/UpdateQuota.java | 9 +- .../com/datadog/api/client/ApiClient.java | 1 + .../api/client/v2/api/UsageMeteringApi.java | 211 +++++++++++++++++- .../model/UsageQuotaBulkResultAttributes.java | 77 ++++++- .../v2/model/UsageQuotaBulkResultData.java | 5 +- .../v2/model/UsageQuotaCreateAttributes.java | 70 ++++-- .../client/v2/model/UsageQuotaCreateData.java | 5 +- .../model/UsageQuotaResponseAttributes.java | 71 +++++- .../v2/model/UsageQuotaUpdateAttributes.java | 49 +++- .../client/v2/model/UsageQuotaUpdateData.java | 4 +- .../com/datadog/api/client/v2/api/undo.json | 6 + .../api/client/v2/api/usage_metering.feature | 45 +++- 16 files changed, 670 insertions(+), 77 deletions(-) create mode 100644 examples/v2/usage-metering/DeletePendingQuota.java diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 91955c670c9..e616006a9df 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -135865,7 +135865,7 @@ components: 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. + description: Attributes of a usage quota bulk write result. On success, quota fields are present as applicable, and pending fields are present only when a change is scheduled. 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. @@ -135879,6 +135879,16 @@ components: description: The public ID of the organization that owns the quota. Omitted if this item failed to write. example: abcdef12345 type: string + pending_effective_from: + description: The future UTC month when the scheduled limit takes effect, formatted as `YYYY-MM`, starting at 00:00 UTC on its first day. Present only together with `pending_usage_limit` and omitted when no change is scheduled or this item failed to write. + example: "2026-11" + pattern: '^\d{4}-\d{2}$' + type: string + pending_usage_limit: + description: The usage limit scheduled for the organization-wide quota in the usage units defined by the quota namespace. A value of `0` is valid. At the start of the effective month, this value becomes `usage_limit` and both pending fields are omitted. Omitted when no change is scheduled or this item failed to write. + example: 50000 + format: double + type: number scope: $ref: "#/components/schemas/UsageQuotaResponseScope" usage_limit: @@ -135894,7 +135904,7 @@ components: $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" + example: "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18" type: string type: $ref: "#/components/schemas/UsageQuotaType" @@ -135909,23 +135919,30 @@ components: $ref: "#/components/schemas/UsageQuotaBulkResultData" type: array UsageQuotaCreateAttributes: - description: Attributes for creating or updating a usage quota by scope. + description: Attributes for creating or updating a usage quota by scope. Each item must provide `usage_limit`, `pending_usage_limit`, or both. Providing only `pending_usage_limit` updates an existing organization-wide quota, never creates one, requires `enforced` to be omitted, and fails if the quota does not exist. + example: + enforced: true + pending_usage_limit: 100000 + usage_limit: 600000 properties: enforced: - description: Whether to actively block usage above the limit instead of only tracking or alerting on it. + description: Whether to actively block usage above `usage_limit` instead of only tracking or alerting on it. Required when `usage_limit` is provided and must be omitted when only `pending_usage_limit` is provided. example: true type: boolean + pending_usage_limit: + description: The non-negative, whole-number limit to schedule for the organization-wide quota in the usage units defined by the quota namespace. It is not checked against current usage. Each write schedules the value for 00:00 UTC on the first day of the next calendar month and replaces any previously scheduled change; the server computes `pending_effective_from`. Omit this field to leave any scheduled change unchanged, including when raising `usage_limit`. Cancel a scheduled change only by deleting the quota's `/pending` sub-resource. + example: 50000 + format: int64 + minimum: 0 + type: integer 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. + description: The non-negative, whole-number 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 usage already recorded in the current period. When this field is provided, `enforced` is required. 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. @@ -135973,6 +135990,19 @@ components: description: The public ID of the organization that owns the quota. example: abcdef12345 type: string + pending_effective_from: + description: The future UTC month when the scheduled limit takes effect, formatted as `YYYY-MM`, starting at 00:00 UTC on its first day. Present only together with `pending_usage_limit` and omitted when no change is scheduled. + example: "2026-11" + pattern: '^\d{4}-\d{2}$' + type: string + pending_usage_limit: + description: |- + The usage limit scheduled for the organization-wide quota in the usage units defined by the quota namespace. + A value of `0` is valid. At the start of the effective month, this value becomes `usage_limit` and both pending + fields are omitted. Omitted when no change is scheduled. + example: 50000 + format: double + type: number scope: $ref: "#/components/schemas/UsageQuotaResponseScope" usage_limit: @@ -135992,7 +136022,7 @@ components: $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" + example: "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18" type: string type: $ref: "#/components/schemas/UsageQuotaType" @@ -136025,13 +136055,20 @@ components: x-enum-varnames: - QUOTAS UsageQuotaUpdateAttributes: - description: Attributes to update on a usage quota. Omitting a property leaves its current value unchanged. + description: Attributes to update on a usage quota. At least one of `usage_limit`, `enforced`, or `pending_usage_limit` must be provided. 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 + pending_usage_limit: + description: The non-negative, whole-number limit to schedule for the organization-wide quota in the usage units defined by the quota namespace. It is not checked against current usage. Each write schedules the value for 00:00 UTC on the first day of the next calendar month and replaces any previously scheduled change; the server computes `pending_effective_from`. Omit this field to leave any scheduled change unchanged, including when raising `usage_limit`; use `DELETE /api/v2/usage/quotas/{quota_namespace}/{id}/pending` to cancel one. + example: 50000 + format: int64 + minimum: 0 + nullable: true + type: integer 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 @@ -136047,7 +136084,7 @@ components: $ref: "#/components/schemas/UsageQuotaUpdateAttributes" id: description: The opaque usage quota identifier, which must match the identifier in the request path. - example: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + example: "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18" type: string type: $ref: "#/components/schemas/UsageQuotaType" @@ -243176,7 +243213,15 @@ paths: scope: user_handle: jane@example.com usage_limit: 100000 - id: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + id: "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOmphbmVAZXhhbXBsZS5jb20" + type: quotas + - attributes: + enforced: true + org_public_id: abcdef12345 + pending_effective_from: "2026-11" + pending_usage_limit: 100000 + usage_limit: 600000 + id: "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18" type: quotas meta: page: @@ -243223,7 +243268,11 @@ paths: 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 `billing_edit` permission. + Creates or updates one or more usage quotas by scope. If a quota already exists for a supplied scope, it is updated. + Otherwise, a quota is created only when `usage_limit` and `enforced` are provided. + For the organization-wide quota, `pending_usage_limit` schedules a limit for the next usage period and can + accompany an immediate limit or update an existing quota by itself. + Scheduled changes follow `include_descendants` like the other fields. Requires the `billing_edit` permission. operationId: CreateQuotas parameters: - description: The product-specific namespace whose usage quotas are being managed. @@ -243260,6 +243309,15 @@ paths: user_handle: "*" usage_limit: 250000 type: quotas + schedule_reduction: + summary: Set a limit and schedule a reduction + value: + data: + - attributes: + enforced: true + pending_usage_limit: 100000 + usage_limit: 600000 + type: quotas schema: $ref: "#/components/schemas/UsageQuotasCreateRequest" description: The usage quotas to create or update. @@ -243278,11 +243336,11 @@ paths: scope: user_handle: jane@example.com usage_limit: 100000 - id: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + id: "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOmphbmVAZXhhbXBsZS5jb20" type: quotas - attributes: error: usage_limit is out of range - id: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTp1c2VyQGV4YW1wbGUuY29t" + id: "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOnVzZXJAZXhhbXBsZS5jb20" type: quotas schema: $ref: "#/components/schemas/UsageQuotasBulkResponse" @@ -243292,7 +243350,7 @@ paths: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Bad Request + description: Bad Request. Returned if the request is malformed, including when an item sets `pending_usage_limit` on a scoped quota, provides `enforced` without `usage_limit`, or provides neither limit. A pending-only item for a quota that does not exist is reported in that item's `error`; when only the caller's organization is targeted, this failure returns `400`. "403": content: application/json: @@ -243340,7 +243398,7 @@ paths: name: id required: true schema: - example: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + example: "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18" type: string responses: "204": @@ -243376,7 +243434,7 @@ paths: 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 `billing_edit` permission. + Updates the supplied fields on a usage quota and leaves omitted fields unchanged. For an organization-wide quota, `pending_usage_limit` schedules a limit for the next usage period. 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 `billing_edit` permission. operationId: UpdateQuota parameters: - description: The product-specific namespace whose usage quotas are being managed. @@ -243391,7 +243449,7 @@ paths: name: id required: true schema: - example: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + example: "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18" type: string requestBody: content: @@ -243403,7 +243461,7 @@ paths: attributes: enforced: false usage_limit: 120000 - id: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + id: "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18" type: quotas schema: $ref: "#/components/schemas/UsageQuotaUpdateRequest" @@ -243420,10 +243478,8 @@ paths: attributes: enforced: false org_public_id: abcdef12345 - scope: - user_handle: jane@example.com usage_limit: 120000 - id: "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f" + id: "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18" type: quotas schema: $ref: "#/components/schemas/UsageQuotaResponse" @@ -243433,7 +243489,7 @@ paths: 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. + description: Bad Request. Returned if the request is malformed, if the `id` in the request body does not match the `id` in the request path, if none of `usage_limit`, `enforced`, or `pending_usage_limit` is provided, or if `pending_usage_limit` is set on a scoped quota. "403": content: application/json: @@ -243463,6 +243519,64 @@ paths: x-unstable: |- **Note**: This endpoint is in Preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/usage/quotas/{quota_namespace}/{id}/pending: + delete: + description: |- + Cancels the limit change scheduled to take effect at the start of the next usage period, leaving the usage quota and its current limit unchanged. Returns `404` when the quota does not exist, has no scheduled change, or its scheduled change has already taken effect; in every case the quota is left 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 `billing_edit` permission. + operationId: DeletePendingQuota + 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: "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18" + type: string + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request. Returned if the `id` is malformed or does not belong to the requested quota namespace. + "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: + - billing_edit + summary: Cancel a scheduled usage quota limit + tags: + - Usage Metering + "x-permission": + operator: OR + permissions: + - billing_edit + 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 index 8f4330fba7d..a14ba18e0b0 100644 --- a/examples/v2/usage-metering/CreateQuotas.java +++ b/examples/v2/usage-metering/CreateQuotas.java @@ -11,7 +11,6 @@ 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) { @@ -28,8 +27,8 @@ public static void main(String[] args) { .attributes( new UsageQuotaCreateAttributes() .enforced(true) - .scope(Map.ofEntries(Map.entry("user_handle", "jane@example.com"))) - .usageLimit(100000L)) + .pendingUsageLimit(100000L) + .usageLimit(600000L)) .type(UsageQuotaType.QUOTAS))); try { diff --git a/examples/v2/usage-metering/DeletePendingQuota.java b/examples/v2/usage-metering/DeletePendingQuota.java new file mode 100644 index 00000000000..d64698608bd --- /dev/null +++ b/examples/v2/usage-metering/DeletePendingQuota.java @@ -0,0 +1,25 @@ +// Cancel a scheduled usage quota limit 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.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.deletePendingQuota", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + try { + apiInstance.deletePendingQuota( + "ai_credits", "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18"); + } catch (ApiException e) { + System.err.println("Exception when calling UsageMeteringApi#deletePendingQuota"); + 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 index 69f4b7ec9e2..b88b39fd412 100644 --- a/examples/v2/usage-metering/DeleteQuota.java +++ b/examples/v2/usage-metering/DeleteQuota.java @@ -12,7 +12,7 @@ public static void main(String[] args) { UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); try { - apiInstance.deleteQuota("ai_credits", "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f"); + apiInstance.deleteQuota("ai_credits", "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18"); } catch (ApiException e) { System.err.println("Exception when calling UsageMeteringApi#deleteQuota"); System.err.println("Status code: " + e.getCode()); diff --git a/examples/v2/usage-metering/UpdateQuota.java b/examples/v2/usage-metering/UpdateQuota.java index 5875f17eb67..e504bed975b 100644 --- a/examples/v2/usage-metering/UpdateQuota.java +++ b/examples/v2/usage-metering/UpdateQuota.java @@ -21,14 +21,17 @@ public static void main(String[] args) { .data( new UsageQuotaUpdateData() .attributes( - new UsageQuotaUpdateAttributes().enforced(false).usageLimit(120000L)) - .id("MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f") + new UsageQuotaUpdateAttributes() + .enforced(false) + .pendingUsageLimit(50000L) + .usageLimit(120000L)) + .id("MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18") .type(UsageQuotaType.QUOTAS)); try { UsageQuotaResponse result = apiInstance.updateQuota( - "ai_credits", "MjAfYWlfY3JlZGl0c1911c2VyX2hhbmRsZTpfX0FMTF9f", body); + "ai_credits", "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18", body); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling UsageMeteringApi#updateQuota"); diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 6acbb2691aa..21d925b1b7a 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1215,6 +1215,7 @@ public class ApiClient { put("v2.searchCostRecommendations", false); put("v2.updateUnitCost", false); put("v2.createQuotas", false); + put("v2.deletePendingQuota", false); put("v2.deleteQuota", false); put("v2.listQuotas", false); put("v2.updateQuota", 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 0be5a567dc2..0e2a637442b 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 @@ -166,8 +166,11 @@ public CompletableFuture createQuotasAsync( /** * 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 billing_edit - * permission. + * scope, it is updated. Otherwise, a quota is created only when usage_limit and + * enforced are provided. For the organization-wide quota, pending_usage_limit + * schedules a limit for the next usage period and can accompany an immediate limit or + * update an existing quota by itself. Scheduled changes follow include_descendants + * like the other fields. Requires the billing_edit permission. * * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. * (required) @@ -180,7 +183,7 @@ public CompletableFuture createQuotasAsync( * Response details * Status Code Description Response Headers * 200 OK. The response includes each item's result; see each item's `error` attribute for any that failed to write. - - * 400 Bad Request - + * 400 Bad Request. Returned if the request is malformed, including when an item sets `pending_usage_limit` on a scoped quota, provides `enforced` without `usage_limit`, or provides neither limit. A pending-only item for a quota that does not exist is reported in that item's `error`; when only the caller's organization is targeted, this failure returns `400`. - * 403 Forbidden - * 429 Too many requests - * 500 Internal Server Error. Every item in the batch failed to write. - @@ -329,6 +332,197 @@ public CompletableFuture> createQuotasWithH new GenericType() {}); } + /** + * Cancel a scheduled usage quota limit. + * + *

See {@link #deletePendingQuotaWithHttpInfo}. + * + * @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 deletePendingQuota(String quotaNamespace, String id) throws ApiException { + deletePendingQuotaWithHttpInfo(quotaNamespace, id); + } + + /** + * Cancel a scheduled usage quota limit. + * + *

See {@link #deletePendingQuotaWithHttpInfoAsync}. + * + * @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 deletePendingQuotaAsync(String quotaNamespace, String id) { + return deletePendingQuotaWithHttpInfoAsync(quotaNamespace, id) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Cancels the limit change scheduled to take effect at the start of the next usage period, + * leaving the usage quota and its current limit unchanged. Returns 404 when the + * quota does not exist, has no scheduled change, or its scheduled change has already taken + * effect; in every case the quota is left 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 billing_edit permission. + * + * @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 -
400 Bad Request. Returned if the `id` is malformed or does not belong to the requested quota namespace. -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deletePendingQuotaWithHttpInfo(String quotaNamespace, String id) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deletePendingQuota"; + 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 deletePendingQuota"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + 400, "Missing the required parameter 'id' when calling deletePendingQuota"); + } + // create path and map variables + String localVarPath = + "/api/v2/usage/quotas/{quota_namespace}/{id}/pending" + .replaceAll( + "\\{" + "quota_namespace" + "\\}", + apiClient.escapeString(quotaNamespace.toString())) + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.deletePendingQuota", + 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); + } + + /** + * Cancel a scheduled usage quota limit. + * + *

See {@link #deletePendingQuotaWithHttpInfo}. + * + * @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> deletePendingQuotaWithHttpInfoAsync( + String quotaNamespace, String id) { + // Check if unstable operation is enabled + String operationId = "deletePendingQuota"; + 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 deletePendingQuota")); + 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 deletePendingQuota")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/usage/quotas/{quota_namespace}/{id}/pending" + .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.deletePendingQuota", + 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); + } + /** * Delete a usage quota. * @@ -3980,10 +4174,11 @@ public CompletableFuture updateQuotaAsync( } /** - * 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 billing_edit - * permission. + * Updates the supplied fields on a usage quota and leaves omitted fields unchanged. For an + * organization-wide quota, pending_usage_limit schedules a limit for the next usage + * period. 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 billing_edit + * permission. * * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. * (required) @@ -3998,7 +4193,7 @@ public CompletableFuture updateQuotaAsync( * 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. - + * 400 Bad Request. Returned if the request is malformed, if the `id` in the request body does not match the `id` in the request path, if none of `usage_limit`, `enforced`, or `pending_usage_limit` is provided, or if `pending_usage_limit` is set on a scoped quota. - * 403 Forbidden - * 404 Not Found - * 429 Too many requests - 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 index 3b44aafb47c..7f80d79772d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/UsageQuotaBulkResultAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaBulkResultAttributes.java @@ -17,13 +17,16 @@ 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. + * Attributes of a usage quota bulk write result. On success, quota fields are present as + * applicable, and pending fields are present only when a change is scheduled. 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_PENDING_EFFECTIVE_FROM, + UsageQuotaBulkResultAttributes.JSON_PROPERTY_PENDING_USAGE_LIMIT, UsageQuotaBulkResultAttributes.JSON_PROPERTY_SCOPE, UsageQuotaBulkResultAttributes.JSON_PROPERTY_USAGE_LIMIT }) @@ -40,6 +43,12 @@ public class UsageQuotaBulkResultAttributes { public static final String JSON_PROPERTY_ORG_PUBLIC_ID = "org_public_id"; private String orgPublicId; + public static final String JSON_PROPERTY_PENDING_EFFECTIVE_FROM = "pending_effective_from"; + private String pendingEffectiveFrom; + + public static final String JSON_PROPERTY_PENDING_USAGE_LIMIT = "pending_usage_limit"; + private Double pendingUsageLimit; + public static final String JSON_PROPERTY_SCOPE = "scope"; private Map scope = null; @@ -111,6 +120,53 @@ public void setOrgPublicId(String orgPublicId) { this.orgPublicId = orgPublicId; } + public UsageQuotaBulkResultAttributes pendingEffectiveFrom(String pendingEffectiveFrom) { + this.pendingEffectiveFrom = pendingEffectiveFrom; + return this; + } + + /** + * The future UTC month when the scheduled limit takes effect, formatted as YYYY-MM, + * starting at 00:00 UTC on its first day. Present only together with pending_usage_limit + * and omitted when no change is scheduled or this item failed to write. + * + * @return pendingEffectiveFrom + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PENDING_EFFECTIVE_FROM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPendingEffectiveFrom() { + return pendingEffectiveFrom; + } + + public void setPendingEffectiveFrom(String pendingEffectiveFrom) { + this.pendingEffectiveFrom = pendingEffectiveFrom; + } + + public UsageQuotaBulkResultAttributes pendingUsageLimit(Double pendingUsageLimit) { + this.pendingUsageLimit = pendingUsageLimit; + return this; + } + + /** + * The usage limit scheduled for the organization-wide quota in the usage units defined by the + * quota namespace. A value of 0 is valid. At the start of the effective month, this + * value becomes usage_limit and both pending fields are omitted. Omitted when no + * change is scheduled or this item failed to write. + * + * @return pendingUsageLimit + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PENDING_USAGE_LIMIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getPendingUsageLimit() { + return pendingUsageLimit; + } + + public void setPendingUsageLimit(Double pendingUsageLimit) { + this.pendingUsageLimit = pendingUsageLimit; + } + public UsageQuotaBulkResultAttributes scope(Map scope) { this.scope = scope; return this; @@ -225,6 +281,9 @@ public boolean equals(Object o) { return Objects.equals(this.enforced, usageQuotaBulkResultAttributes.enforced) && Objects.equals(this.error, usageQuotaBulkResultAttributes.error) && Objects.equals(this.orgPublicId, usageQuotaBulkResultAttributes.orgPublicId) + && Objects.equals( + this.pendingEffectiveFrom, usageQuotaBulkResultAttributes.pendingEffectiveFrom) + && Objects.equals(this.pendingUsageLimit, usageQuotaBulkResultAttributes.pendingUsageLimit) && Objects.equals(this.scope, usageQuotaBulkResultAttributes.scope) && Objects.equals(this.usageLimit, usageQuotaBulkResultAttributes.usageLimit) && Objects.equals( @@ -233,7 +292,15 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(enforced, error, orgPublicId, scope, usageLimit, additionalProperties); + return Objects.hash( + enforced, + error, + orgPublicId, + pendingEffectiveFrom, + pendingUsageLimit, + scope, + usageLimit, + additionalProperties); } @Override @@ -243,6 +310,10 @@ public String toString() { 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(" pendingEffectiveFrom: ") + .append(toIndentedString(pendingEffectiveFrom)) + .append("\n"); + sb.append(" pendingUsageLimit: ").append(toIndentedString(pendingUsageLimit)).append("\n"); sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); sb.append(" usageLimit: ").append(toIndentedString(usageLimit)).append("\n"); sb.append(" additionalProperties: ") 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 index 910f91285ed..8c143d8d74e 100644 --- a/src/main/java/com/datadog/api/client/v2/model/UsageQuotaBulkResultData.java +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaBulkResultData.java @@ -58,8 +58,9 @@ public UsageQuotaBulkResultData attributes(UsageQuotaBulkResultAttributes attrib } /** - * 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. + * Attributes of a usage quota bulk write result. On success, quota fields are present as + * applicable, and pending fields are present only when a change is scheduled. On failure, only + * error is present and the other fields are omitted. * * @return attributes */ 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 index 9a270c10074..8ae57deaba6 100644 --- a/src/main/java/com/datadog/api/client/v2/model/UsageQuotaCreateAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaCreateAttributes.java @@ -8,7 +8,6 @@ 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; @@ -17,9 +16,15 @@ import java.util.Map; import java.util.Objects; -/** Attributes for creating or updating a usage quota by scope. */ +/** + * Attributes for creating or updating a usage quota by scope. Each item must provide + * usage_limit, pending_usage_limit, or both. Providing only + * pending_usage_limit updates an existing organization-wide quota, never creates one, + * requires enforced to be omitted, and fails if the quota does not exist. + */ @JsonPropertyOrder({ UsageQuotaCreateAttributes.JSON_PROPERTY_ENFORCED, + UsageQuotaCreateAttributes.JSON_PROPERTY_PENDING_USAGE_LIMIT, UsageQuotaCreateAttributes.JSON_PROPERTY_SCOPE, UsageQuotaCreateAttributes.JSON_PROPERTY_USAGE_LIMIT }) @@ -30,34 +35,30 @@ public class UsageQuotaCreateAttributes { public static final String JSON_PROPERTY_ENFORCED = "enforced"; private Boolean enforced; + public static final String JSON_PROPERTY_PENDING_USAGE_LIMIT = "pending_usage_limit"; + private Long pendingUsageLimit; + 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. + * Whether to actively block usage above usage_limit instead of only tracking or + * alerting on it. Required when usage_limit is provided and must be omitted when + * only pending_usage_limit is provided. * * @return enforced */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ENFORCED) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnforced() { return enforced; } @@ -66,6 +67,33 @@ public void setEnforced(Boolean enforced) { this.enforced = enforced; } + public UsageQuotaCreateAttributes pendingUsageLimit(Long pendingUsageLimit) { + this.pendingUsageLimit = pendingUsageLimit; + return this; + } + + /** + * The non-negative, whole-number limit to schedule for the organization-wide quota in the usage + * units defined by the quota namespace. It is not checked against current usage. Each write + * schedules the value for 00:00 UTC on the first day of the next calendar month and replaces any + * previously scheduled change; the server computes pending_effective_from. Omit this + * field to leave any scheduled change unchanged, including when raising usage_limit. + * Cancel a scheduled change only by deleting the quota's /pending sub-resource. + * minimum: 0 + * + * @return pendingUsageLimit + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PENDING_USAGE_LIMIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getPendingUsageLimit() { + return pendingUsageLimit; + } + + public void setPendingUsageLimit(Long pendingUsageLimit) { + this.pendingUsageLimit = pendingUsageLimit; + } + public UsageQuotaCreateAttributes scope(Map scope) { this.scope = scope; return this; @@ -108,14 +136,16 @@ public UsageQuotaCreateAttributes usageLimit(Long usageLimit) { } /** - * 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 + * The non-negative, whole-number 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 usage + * already recorded in the current period. When this field is provided, enforced is + * required. minimum: 0 * * @return usageLimit */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_USAGE_LIMIT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Long getUsageLimit() { return usageLimit; } @@ -181,6 +211,7 @@ public boolean equals(Object o) { } UsageQuotaCreateAttributes usageQuotaCreateAttributes = (UsageQuotaCreateAttributes) o; return Objects.equals(this.enforced, usageQuotaCreateAttributes.enforced) + && Objects.equals(this.pendingUsageLimit, usageQuotaCreateAttributes.pendingUsageLimit) && Objects.equals(this.scope, usageQuotaCreateAttributes.scope) && Objects.equals(this.usageLimit, usageQuotaCreateAttributes.usageLimit) && Objects.equals( @@ -189,7 +220,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(enforced, scope, usageLimit, additionalProperties); + return Objects.hash(enforced, pendingUsageLimit, scope, usageLimit, additionalProperties); } @Override @@ -197,6 +228,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class UsageQuotaCreateAttributes {\n"); sb.append(" enforced: ").append(toIndentedString(enforced)).append("\n"); + sb.append(" pendingUsageLimit: ").append(toIndentedString(pendingUsageLimit)).append("\n"); sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); sb.append(" usageLimit: ").append(toIndentedString(usageLimit)).append("\n"); sb.append(" additionalProperties: ") 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 index e0f8334ef5a..598aa4623b6 100644 --- a/src/main/java/com/datadog/api/client/v2/model/UsageQuotaCreateData.java +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaCreateData.java @@ -52,7 +52,10 @@ public UsageQuotaCreateData attributes(UsageQuotaCreateAttributes attributes) { } /** - * Attributes for creating or updating a usage quota by scope. + * Attributes for creating or updating a usage quota by scope. Each item must provide + * usage_limit, pending_usage_limit, or both. Providing only + * pending_usage_limit updates an existing organization-wide quota, never creates one, + * requires enforced to be omitted, and fails if the quota does not exist. * * @return attributes */ 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 index 0bc42ab69c5..55ef95d57f0 100644 --- a/src/main/java/com/datadog/api/client/v2/model/UsageQuotaResponseAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaResponseAttributes.java @@ -21,6 +21,8 @@ @JsonPropertyOrder({ UsageQuotaResponseAttributes.JSON_PROPERTY_ENFORCED, UsageQuotaResponseAttributes.JSON_PROPERTY_ORG_PUBLIC_ID, + UsageQuotaResponseAttributes.JSON_PROPERTY_PENDING_EFFECTIVE_FROM, + UsageQuotaResponseAttributes.JSON_PROPERTY_PENDING_USAGE_LIMIT, UsageQuotaResponseAttributes.JSON_PROPERTY_SCOPE, UsageQuotaResponseAttributes.JSON_PROPERTY_USAGE_LIMIT }) @@ -34,6 +36,12 @@ public class UsageQuotaResponseAttributes { public static final String JSON_PROPERTY_ORG_PUBLIC_ID = "org_public_id"; private String orgPublicId; + public static final String JSON_PROPERTY_PENDING_EFFECTIVE_FROM = "pending_effective_from"; + private String pendingEffectiveFrom; + + public static final String JSON_PROPERTY_PENDING_USAGE_LIMIT = "pending_usage_limit"; + private Double pendingUsageLimit; + public static final String JSON_PROPERTY_SCOPE = "scope"; private Map scope = null; @@ -92,6 +100,53 @@ public void setOrgPublicId(String orgPublicId) { this.orgPublicId = orgPublicId; } + public UsageQuotaResponseAttributes pendingEffectiveFrom(String pendingEffectiveFrom) { + this.pendingEffectiveFrom = pendingEffectiveFrom; + return this; + } + + /** + * The future UTC month when the scheduled limit takes effect, formatted as YYYY-MM, + * starting at 00:00 UTC on its first day. Present only together with pending_usage_limit + * and omitted when no change is scheduled. + * + * @return pendingEffectiveFrom + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PENDING_EFFECTIVE_FROM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPendingEffectiveFrom() { + return pendingEffectiveFrom; + } + + public void setPendingEffectiveFrom(String pendingEffectiveFrom) { + this.pendingEffectiveFrom = pendingEffectiveFrom; + } + + public UsageQuotaResponseAttributes pendingUsageLimit(Double pendingUsageLimit) { + this.pendingUsageLimit = pendingUsageLimit; + return this; + } + + /** + * The usage limit scheduled for the organization-wide quota in the usage units defined by the + * quota namespace. A value of 0 is valid. At the start of the effective month, this + * value becomes usage_limit and both pending fields are omitted. Omitted when no + * change is scheduled. + * + * @return pendingUsageLimit + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PENDING_USAGE_LIMIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getPendingUsageLimit() { + return pendingUsageLimit; + } + + public void setPendingUsageLimit(Double pendingUsageLimit) { + this.pendingUsageLimit = pendingUsageLimit; + } + public UsageQuotaResponseAttributes scope(Map scope) { this.scope = scope; return this; @@ -203,6 +258,9 @@ public boolean equals(Object o) { UsageQuotaResponseAttributes usageQuotaResponseAttributes = (UsageQuotaResponseAttributes) o; return Objects.equals(this.enforced, usageQuotaResponseAttributes.enforced) && Objects.equals(this.orgPublicId, usageQuotaResponseAttributes.orgPublicId) + && Objects.equals( + this.pendingEffectiveFrom, usageQuotaResponseAttributes.pendingEffectiveFrom) + && Objects.equals(this.pendingUsageLimit, usageQuotaResponseAttributes.pendingUsageLimit) && Objects.equals(this.scope, usageQuotaResponseAttributes.scope) && Objects.equals(this.usageLimit, usageQuotaResponseAttributes.usageLimit) && Objects.equals( @@ -211,7 +269,14 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(enforced, orgPublicId, scope, usageLimit, additionalProperties); + return Objects.hash( + enforced, + orgPublicId, + pendingEffectiveFrom, + pendingUsageLimit, + scope, + usageLimit, + additionalProperties); } @Override @@ -220,6 +285,10 @@ public String toString() { sb.append("class UsageQuotaResponseAttributes {\n"); sb.append(" enforced: ").append(toIndentedString(enforced)).append("\n"); sb.append(" orgPublicId: ").append(toIndentedString(orgPublicId)).append("\n"); + sb.append(" pendingEffectiveFrom: ") + .append(toIndentedString(pendingEffectiveFrom)) + .append("\n"); + sb.append(" pendingUsageLimit: ").append(toIndentedString(pendingUsageLimit)).append("\n"); sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); sb.append(" usageLimit: ").append(toIndentedString(usageLimit)).append("\n"); sb.append(" additionalProperties: ") 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 index daaafd0c83a..23e82fb6c22 100644 --- a/src/main/java/com/datadog/api/client/v2/model/UsageQuotaUpdateAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaUpdateAttributes.java @@ -18,10 +18,13 @@ import org.openapitools.jackson.nullable.JsonNullable; /** - * Attributes to update on a usage quota. Omitting a property leaves its current value unchanged. + * Attributes to update on a usage quota. At least one of usage_limit, enforced + * , or pending_usage_limit must be provided. Omitting a property leaves its + * current value unchanged. */ @JsonPropertyOrder({ UsageQuotaUpdateAttributes.JSON_PROPERTY_ENFORCED, + UsageQuotaUpdateAttributes.JSON_PROPERTY_PENDING_USAGE_LIMIT, UsageQuotaUpdateAttributes.JSON_PROPERTY_USAGE_LIMIT }) @jakarta.annotation.Generated( @@ -31,6 +34,9 @@ public class UsageQuotaUpdateAttributes { public static final String JSON_PROPERTY_ENFORCED = "enforced"; private JsonNullable enforced = JsonNullable.undefined(); + public static final String JSON_PROPERTY_PENDING_USAGE_LIMIT = "pending_usage_limit"; + private JsonNullable pendingUsageLimit = JsonNullable.undefined(); + public static final String JSON_PROPERTY_USAGE_LIMIT = "usage_limit"; private JsonNullable usageLimit = JsonNullable.undefined(); @@ -66,6 +72,43 @@ public void setEnforced(Boolean enforced) { this.enforced = JsonNullable.of(enforced); } + public UsageQuotaUpdateAttributes pendingUsageLimit(Long pendingUsageLimit) { + this.pendingUsageLimit = JsonNullable.of(pendingUsageLimit); + return this; + } + + /** + * The non-negative, whole-number limit to schedule for the organization-wide quota in the usage + * units defined by the quota namespace. It is not checked against current usage. Each write + * schedules the value for 00:00 UTC on the first day of the next calendar month and replaces any + * previously scheduled change; the server computes pending_effective_from. Omit this + * field to leave any scheduled change unchanged, including when raising usage_limit; + * use DELETE /api/v2/usage/quotas/{quota_namespace}/{id}/pending to cancel one. + * minimum: 0 + * + * @return pendingUsageLimit + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getPendingUsageLimit() { + return pendingUsageLimit.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PENDING_USAGE_LIMIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getPendingUsageLimit_JsonNullable() { + return pendingUsageLimit; + } + + @JsonProperty(JSON_PROPERTY_PENDING_USAGE_LIMIT) + public void setPendingUsageLimit_JsonNullable(JsonNullable pendingUsageLimit) { + this.pendingUsageLimit = pendingUsageLimit; + } + + public void setPendingUsageLimit(Long pendingUsageLimit) { + this.pendingUsageLimit = JsonNullable.of(pendingUsageLimit); + } + public UsageQuotaUpdateAttributes usageLimit(Long usageLimit) { this.usageLimit = JsonNullable.of(usageLimit); return this; @@ -156,6 +199,7 @@ public boolean equals(Object o) { } UsageQuotaUpdateAttributes usageQuotaUpdateAttributes = (UsageQuotaUpdateAttributes) o; return Objects.equals(this.enforced, usageQuotaUpdateAttributes.enforced) + && Objects.equals(this.pendingUsageLimit, usageQuotaUpdateAttributes.pendingUsageLimit) && Objects.equals(this.usageLimit, usageQuotaUpdateAttributes.usageLimit) && Objects.equals( this.additionalProperties, usageQuotaUpdateAttributes.additionalProperties); @@ -163,7 +207,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(enforced, usageLimit, additionalProperties); + return Objects.hash(enforced, pendingUsageLimit, usageLimit, additionalProperties); } @Override @@ -171,6 +215,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class UsageQuotaUpdateAttributes {\n"); sb.append(" enforced: ").append(toIndentedString(enforced)).append("\n"); + sb.append(" pendingUsageLimit: ").append(toIndentedString(pendingUsageLimit)).append("\n"); sb.append(" usageLimit: ").append(toIndentedString(usageLimit)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) 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 index 2faa9e49607..e92c9b14609 100644 --- a/src/main/java/com/datadog/api/client/v2/model/UsageQuotaUpdateData.java +++ b/src/main/java/com/datadog/api/client/v2/model/UsageQuotaUpdateData.java @@ -58,7 +58,9 @@ public UsageQuotaUpdateData attributes(UsageQuotaUpdateAttributes attributes) { } /** - * Attributes to update on a usage quota. Omitting a property leaves its current value unchanged. + * Attributes to update on a usage quota. At least one of usage_limit, enforced + * , or pending_usage_limit must be provided. Omitting a property leaves its + * current value unchanged. * * @return attributes */ 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 8c110cf9e5f..c6993b858d5 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 @@ -10974,6 +10974,12 @@ "type": "idempotent" } }, + "DeletePendingQuota": { + "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 cdab1476abf..9fd783ecd66 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 @@ -15,20 +15,47 @@ Feature: Usage Metering And an instance of "UsageMetering" API @generated @skip @team:ddoghq/billing-hub - Scenario: Create or update usage quotas returns "Bad Request" response + Scenario: Cancel a scheduled usage quota limit returns "Bad Request. Returned if the `id` is malformed or does not belong to the requested quota namespace." response + Given operation "DeletePendingQuota" enabled + And new "DeletePendingQuota" 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 400 Bad Request. Returned if the `id` is malformed or does not belong to the requested quota namespace. + + @generated @skip @team:ddoghq/billing-hub + Scenario: Cancel a scheduled usage quota limit returns "No Content" response + Given operation "DeletePendingQuota" enabled + And new "DeletePendingQuota" 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:ddoghq/billing-hub + Scenario: Cancel a scheduled usage quota limit returns "Not Found" response + Given operation "DeletePendingQuota" enabled + And new "DeletePendingQuota" 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 + + @generated @skip @team:ddoghq/billing-hub + Scenario: Create or update usage quotas returns "Bad Request. Returned if the request is malformed, including when an item sets `pending_usage_limit` on a scoped quota, provides `enforced` without `usage_limit`, or provides neither limit. A pending-only item for a quota that does not exist is reported in that item's `error`; when only the caller's organization is targeted, this failure returns `400`." 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"}]} + And body with value {"data": [{"attributes": {"enforced": true, "pending_usage_limit": 100000, "usage_limit": 600000}, "type": "quotas"}]} When the request is sent - Then the response status is 400 Bad Request + Then the response status is 400 Bad Request. Returned if the request is malformed, including when an item sets `pending_usage_limit` on a scoped quota, provides `enforced` without `usage_limit`, or provides neither limit. A pending-only item for a quota that does not exist is reported in that item's `error`; when only the caller's organization is targeted, this failure returns `400`. @generated @skip @team:ddoghq/billing-hub Scenario: Create or update usage quotas returns "OK. The response includes each item's result; see each item's `error` attribute for any that failed to write." 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"}]} + And body with value {"data": [{"attributes": {"enforced": true, "pending_usage_limit": 100000, "usage_limit": 600000}, "type": "quotas"}]} When the request is sent Then the response status is 200 OK. The response includes each item's result; see each item's `error` attribute for any that failed to write. @@ -304,14 +331,14 @@ Feature: Usage Metering Then the response status is 200 OK @generated @skip @team:ddoghq/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 + Scenario: Update a usage quota returns "Bad Request. Returned if the request is malformed, if the `id` in the request body does not match the `id` in the request path, if none of `usage_limit`, `enforced`, or `pending_usage_limit` is provided, or if `pending_usage_limit` is set on a scoped quota." 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"}} + And body with value {"data": {"attributes": {"enforced": false, "pending_usage_limit": 50000, "usage_limit": 120000}, "id": "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18", "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. + Then the response status is 400 Bad Request. Returned if the request is malformed, if the `id` in the request body does not match the `id` in the request path, if none of `usage_limit`, `enforced`, or `pending_usage_limit` is provided, or if `pending_usage_limit` is set on a scoped quota. @generated @skip @team:ddoghq/billing-hub Scenario: Update a usage quota returns "Not Found" response @@ -319,7 +346,7 @@ Feature: Usage Metering 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"}} + And body with value {"data": {"attributes": {"enforced": false, "pending_usage_limit": 50000, "usage_limit": 120000}, "id": "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18", "type": "quotas"}} When the request is sent Then the response status is 404 Not Found @@ -329,6 +356,6 @@ Feature: Usage Metering 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"}} + And body with value {"data": {"attributes": {"enforced": false, "pending_usage_limit": 50000, "usage_limit": 120000}, "id": "MTIzNB9haV9jcmVkaXRzH3VzZXJfaGFuZGxlOl9fQUxMX18", "type": "quotas"}} When the request is sent Then the response status is 200 OK