From 297649f6a3db817b11f320c413863c2fbd10f026 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 29 Oct 2026 20:10:41 +0000 Subject: [PATCH] Regenerate client from commit 222b428 of spec repo --- .generator/schemas/v2/openapi.yaml | 1000 +++++++ .../CreateTemporaryGrantRequest.java | 42 + .../DeleteRequestedTemporaryGrant.java | 26 + .../DeleteTemporaryGrantRequest.java | 26 + .../GetMyTemporaryGrantRequest.java | 37 + .../GetTemporaryGrantRequest.java | 37 + .../ListMyTemporaryGrantRequests.java | 26 + ...stMyTemporaryGrantRequests_3885243213.java | 29 + .../ListTemporaryGrantRequests.java | 26 + ...ListTemporaryGrantRequests_3760725651.java | 29 + .../UpdateTemporaryGrantRequest.java | 52 + .../com/datadog/api/client/ApiClient.java | 8 + .../api/client/v2/api/UsageMeteringApi.java | 2494 ++++++++++++++--- .../TemporaryGrantRequestAttributes.java | 456 +++ ...TemporaryGrantRequestCreateAttributes.java | 162 ++ .../TemporaryGrantRequestCreateData.java | 187 ++ .../TemporaryGrantRequestCreateRequest.java | 151 + .../v2/model/TemporaryGrantRequestData.java | 216 ++ .../model/TemporaryGrantRequestDecision.java | 59 + ...mporaryGrantRequestDecisionAttributes.java | 99 + .../TemporaryGrantRequestDecisionData.java | 218 ++ .../TemporaryGrantRequestDecisionRequest.java | 151 + .../TemporaryGrantRequestGrantState.java | 68 + .../model/TemporaryGrantRequestListMeta.java | 149 + .../TemporaryGrantRequestListResponse.java | 201 ++ .../v2/model/TemporaryGrantRequestPage.java | 137 + .../model/TemporaryGrantRequestResponse.java | 149 + .../v2/model/TemporaryGrantRequestStatus.java | 63 + .../v2/model/TemporaryGrantRequestType.java | 57 + .../com/datadog/api/client/v2/api/given.json | 12 + .../com/datadog/api/client/v2/api/undo.json | 55 + .../api/client/v2/api/usage_metering.feature | 272 ++ .../test-runner-data/manifest.json | 21 + ...ary-grant-request-returns-ok-response.json | 51 + ...ary-grant-request-returns-ok-response.json | 35 + ...ary-grant-request-returns-ok-response.json | 35 + .../test-server-data/v2/usage-metering.json | 259 ++ 37 files changed, 6646 insertions(+), 449 deletions(-) create mode 100644 examples/v2/usage-metering/CreateTemporaryGrantRequest.java create mode 100644 examples/v2/usage-metering/DeleteRequestedTemporaryGrant.java create mode 100644 examples/v2/usage-metering/DeleteTemporaryGrantRequest.java create mode 100644 examples/v2/usage-metering/GetMyTemporaryGrantRequest.java create mode 100644 examples/v2/usage-metering/GetTemporaryGrantRequest.java create mode 100644 examples/v2/usage-metering/ListMyTemporaryGrantRequests.java create mode 100644 examples/v2/usage-metering/ListMyTemporaryGrantRequests_3885243213.java create mode 100644 examples/v2/usage-metering/ListTemporaryGrantRequests.java create mode 100644 examples/v2/usage-metering/ListTemporaryGrantRequests_3760725651.java create mode 100644 examples/v2/usage-metering/UpdateTemporaryGrantRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestCreateAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestCreateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestCreateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestDecision.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestDecisionAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestDecisionData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestDecisionRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestGrantState.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestListMeta.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestListResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestPage.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestStatus.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestType.java create mode 100644 src/test/resources/generated-test/test-runner-data/v2/usage-metering/decide-a-temporary-grant-request-returns-ok-response.json create mode 100644 src/test/resources/generated-test/test-runner-data/v2/usage-metering/get-an-organization-temporary-grant-request-returns-ok-response.json create mode 100644 src/test/resources/generated-test/test-runner-data/v2/usage-metering/get-your-temporary-grant-request-returns-ok-response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index dbd876c34d7..b0a2f61cc8b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -136453,6 +136453,252 @@ components: description: Pagination type. One of `offset_limit` or `number_size`. type: string type: object + TemporaryGrantRequestAttributes: + description: Request history and the linked grant state. List and detail reads include grant_state for approved requests. Decision responses record the decision. Read the request for current grant state. + properties: + created_at: + description: When the request was submitted. + example: "2028-02-16T00:00:00Z" + format: date-time + type: string + decided_at: + description: When the decision or cancellation was recorded. + example: "2028-02-16T00:00:00Z" + format: date-time + type: string + decided_by_user_id: + description: UUID of the reviewer, or of the requester if the request was canceled. + example: 12345678-1234-1234-1234-123456789012 + format: uuid + type: string + entity_key: + description: The requester identity resolved by the server. + example: user_handle:jane@example.com + type: string + expires_at: + description: Immutable exclusive expiry, normalized to UTC microsecond precision. + example: "2028-02-16T00:00:00Z" + format: date-time + type: string + grant_state: + $ref: "#/components/schemas/TemporaryGrantRequestGrantState" + justification: + description: Reason for requesting temporary credits. Trimmed and limited to 4096 UTF-8 bytes. + example: Credits needed to finish the incident investigation. + maxLength: 4096 + minLength: 1 + type: string + quota_namespace: + description: The quota namespace. Only AI credits are supported. + example: ai_credits + type: string + requested_by_user_id: + description: UUID of the authenticated requester. + example: 12345678-1234-1234-1234-123456789012 + format: uuid + type: string + status: + $ref: "#/components/schemas/TemporaryGrantRequestStatus" + total: + description: Target monthly AI credit limit in positive whole credits, not additional credits. Fractional credits are not accepted. + example: 200 + format: int64 + maximum: 9223372036854 + minimum: 1 + type: integer + required: + - quota_namespace + - entity_key + - requested_by_user_id + - total + - justification + - expires_at + - status + - created_at + type: object + TemporaryGrantRequestCreateAttributes: + additionalProperties: false + description: Immutable terms and justification for a temporary grant request. + properties: + expires_at: + description: Exclusive expiry. Must be a future timestamp with a timezone. Date-only values are rejected. If omitted or null, defaults to the next UTC month boundary. Approval accepts this deadline unchanged. + example: "2028-02-16T00:00:00Z" + format: date-time + nullable: true + type: string + justification: + description: Reason for requesting temporary credits. Trimmed and limited to 4096 UTF-8 bytes. + example: Credits needed to finish the incident investigation. + maxLength: 4096 + minLength: 1 + type: string + total: + description: Target monthly AI credit limit in positive whole credits, not additional credits. Fractional credits are not accepted. + example: 200 + format: int64 + maximum: 9223372036854 + minimum: 1 + type: integer + required: + - total + - justification + type: object + TemporaryGrantRequestCreateData: + description: The request resource to create. The server generates its ID. + properties: + attributes: + $ref: "#/components/schemas/TemporaryGrantRequestCreateAttributes" + type: + $ref: "#/components/schemas/TemporaryGrantRequestType" + required: + - type + - attributes + type: object + TemporaryGrantRequestCreateRequest: + description: Create a request for the authenticated human user. + properties: + data: + $ref: "#/components/schemas/TemporaryGrantRequestCreateData" + required: + - data + type: object + TemporaryGrantRequestData: + description: A temporary grant request resource. + properties: + attributes: + $ref: "#/components/schemas/TemporaryGrantRequestAttributes" + id: + description: Server-generated request UUID. + example: 12345678-1234-1234-1234-123456789012 + format: uuid + type: string + type: + $ref: "#/components/schemas/TemporaryGrantRequestType" + required: + - id + - type + - attributes + type: object + TemporaryGrantRequestDecision: + description: Approve the exact submitted total and expiry, or deny the request. + enum: + - approved + - denied + example: approved + type: string + x-enum-varnames: + - APPROVED + - DENIED + TemporaryGrantRequestDecisionAttributes: + additionalProperties: false + description: Binary decision. Overrides, reason fields, and unknown attributes are rejected, including null values. + properties: + decision: + $ref: "#/components/schemas/TemporaryGrantRequestDecision" + required: + - decision + type: object + TemporaryGrantRequestDecisionData: + description: A decision on a pending request. + properties: + attributes: + $ref: "#/components/schemas/TemporaryGrantRequestDecisionAttributes" + id: + description: Request UUID. Must match request_id in the path. Missing or mismatched IDs return 400 Bad Request. + example: 12345678-1234-1234-1234-123456789012 + format: uuid + type: string + type: + $ref: "#/components/schemas/TemporaryGrantRequestType" + required: + - id + - type + - attributes + type: object + TemporaryGrantRequestDecisionRequest: + description: Approve or deny a pending request. + properties: + data: + $ref: "#/components/schemas/TemporaryGrantRequestDecisionData" + required: + - data + type: object + TemporaryGrantRequestGrantState: + description: Current state of the grant associated with an approved request. Replaced means a newer grant superseded this grant. The newer grant might no longer be active. This field is absent for requests that weren't approved. + enum: + - active + - expired + - revoked + - replaced + example: active + type: string + x-enum-varnames: + - ACTIVE + - EXPIRED + - REVOKED + - REPLACED + TemporaryGrantRequestListMeta: + description: Pagination metadata. + properties: + page: + $ref: "#/components/schemas/TemporaryGrantRequestPage" + required: + - page + type: object + TemporaryGrantRequestListResponse: + description: A page of temporary grant requests, ordered by UUID rather than creation time. + properties: + data: + description: Requests visible to the authenticated caller. + items: + $ref: "#/components/schemas/TemporaryGrantRequestData" + type: array + meta: + $ref: "#/components/schemas/TemporaryGrantRequestListMeta" + required: + - data + - meta + type: object + TemporaryGrantRequestPage: + description: UUID cursor pagination. A full final page can return a cursor followed by an empty page. + properties: + next_cursor: + description: Use this UUID as page[cursor] to retrieve the next page. Omitted when the page is not full. + example: 12345678-1234-1234-1234-123456789012 + format: uuid + type: string + type: object + TemporaryGrantRequestResponse: + description: A single temporary grant request. + properties: + data: + $ref: "#/components/schemas/TemporaryGrantRequestData" + required: + - data + type: object + TemporaryGrantRequestStatus: + description: The durable request decision, independent of whether its grant is still active. + enum: + - pending + - approved + - denied + - cancelled + example: pending + type: string + x-enum-varnames: + - PENDING + - APPROVED + - DENIED + - CANCELLED + TemporaryGrantRequestType: + default: temporary_grant_requests + description: The temporary grant request resource type. + enum: + - temporary_grant_requests + example: temporary_grant_requests + type: string + x-enum-varnames: + - TEMPORARY_GRANT_REQUESTS TenancyConfig: description: Response containing a single OCI tenancy integration configuration. example: @@ -252119,6 +252365,363 @@ 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/admin/temporary-grant-requests: + get: + description: List all request statuses within the authenticated organization. Filter by pending status for the review queue. Requires Billing Edit, including for reads. Requires an authenticated human user. Service-account credentials are unsupported. Request status remains approved after expiry, revocation, or replacement. + operationId: ListTemporaryGrantRequests + parameters: + - description: Optional status. Defaults to all statuses. + in: query + name: filter[status] + required: false + schema: + $ref: "#/components/schemas/TemporaryGrantRequestStatus" + - description: Page size, from 1 to 100. + in: query + name: page[limit] + required: false + schema: + default: 50 + format: int64 + maximum: 100 + minimum: 1 + type: integer + - description: UUID cursor from meta.page.next_cursor. + in: query + name: page[cursor] + required: false + schema: + format: uuid + type: string + - description: Filter by requester UUID within the authenticated organization. + in: query + name: filter[requested_by_user_id] + required: false + schema: + format: uuid + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + created_at: "2028-02-16T00:00:00Z" + entity_key: user_handle:jane@example.com + expires_at: "2028-03-01T00:00:00Z" + justification: Credits needed to finish the incident investigation. + quota_namespace: ai_credits + requested_by_user_id: 12345678-1234-1234-1234-123456789012 + status: pending + total: 200 + id: 34567890-3456-3456-3456-345678901234 + type: temporary_grant_requests + meta: + page: {} + schema: + $ref: "#/components/schemas/TemporaryGrantRequestListResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - billing_edit + summary: List organization temporary grant requests + tags: + - Usage Metering + x-pagination: + cursorParam: page[cursor] + cursorPath: meta.page.next_cursor + limitParam: page[limit] + resultsPath: data + 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/admin/temporary-grant-requests/{request_id}: + get: + description: Read an organization request, justification, decision, and linked grant state. Requires Billing Edit. Requires an authenticated human user. Service-account credentials are unsupported. Request status remains approved after expiry, revocation, or replacement. + operationId: GetTemporaryGrantRequest + parameters: + - description: The temporary grant request UUID. + in: path + name: request_id + required: true + schema: + description: The request UUID. + example: 12345678-1234-1234-1234-123456789012 + format: uuid + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2028-02-16T00:00:00Z" + entity_key: user_handle:jane@example.com + expires_at: "2028-03-01T00:00:00Z" + justification: Credits needed to finish the incident investigation. + quota_namespace: ai_credits + requested_by_user_id: 12345678-1234-1234-1234-123456789012 + status: pending + total: 200 + id: 34567890-3456-3456-3456-345678901234 + type: temporary_grant_requests + schema: + $ref: "#/components/schemas/TemporaryGrantRequestResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - billing_edit + summary: Get an organization temporary grant request + 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/admin/temporary-grant-requests/{request_id}/decision: + post: + description: Approve or deny the submitted terms, which are immutable. Approval atomically writes the grant, audit record, and request decision. An expired request can't be approved. Requires the Billing Edit permission. Requires an authenticated human user. Service-account credentials aren't supported. Request status remains approved after the grant's expiry, revocation, or replacement. + operationId: UpdateTemporaryGrantRequest + parameters: + - description: The temporary grant request UUID. + in: path + name: request_id + required: true + schema: + description: The request UUID. + example: 12345678-1234-1234-1234-123456789012 + format: uuid + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + decision: approved + id: 12345678-1234-1234-1234-123456789012 + type: temporary_grant_requests + schema: + $ref: "#/components/schemas/TemporaryGrantRequestDecisionRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2028-02-16T00:00:00Z" + decided_at: "2028-02-16T01:00:00Z" + decided_by_user_id: 23456789-2345-2345-2345-234567890123 + entity_key: user_handle:jane@example.com + expires_at: "2028-03-01T00:00:00Z" + justification: Credits needed to finish the incident investigation. + quota_namespace: ai_credits + requested_by_user_id: 12345678-1234-1234-1234-123456789012 + status: approved + total: 200 + id: 34567890-3456-3456-3456-345678901234 + type: temporary_grant_requests + schema: + $ref: "#/components/schemas/TemporaryGrantRequestResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - billing_edit + summary: Decide a temporary grant request + 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/admin/temporary-grant-requests/{request_id}/grant: + delete: + description: Revoke only the grant that's still associated with this approved request. The request and audit history remain. A stale request can't revoke a replacement grant. Requires the Billing Edit permission. Requires an authenticated human user. Service-account credentials aren't supported. Request status remains approved after the grant's expiry, revocation, or replacement. + operationId: DeleteRequestedTemporaryGrant + parameters: + - description: The temporary grant request UUID. + in: path + name: request_id + required: true + schema: + description: The request UUID. + example: 12345678-1234-1234-1234-123456789012 + format: uuid + type: string + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - billing_edit + summary: Revoke a requested temporary grant + 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/application_security: get: deprecated: true @@ -253326,6 +253929,403 @@ paths: operator: OR permissions: - usage_read + /api/v2/usage/temporary-grant-requests: + get: + description: List the authenticated user's own requests, including decided requests. Other users' requests are never included. Requires an authenticated human user. Service-account credentials aren't supported. Request status remains approved after the grant's expiry, revocation, or replacement. + operationId: ListMyTemporaryGrantRequests + parameters: + - description: Optional status. Defaults to all statuses. + in: query + name: filter[status] + required: false + schema: + $ref: "#/components/schemas/TemporaryGrantRequestStatus" + - description: Page size, from 1 to 100. + in: query + name: page[limit] + required: false + schema: + default: 50 + format: int64 + maximum: 100 + minimum: 1 + type: integer + - description: UUID cursor from meta.page.next_cursor. + in: query + name: page[cursor] + required: false + schema: + format: uuid + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + created_at: "2028-02-16T00:00:00Z" + entity_key: user_handle:jane@example.com + expires_at: "2028-03-01T00:00:00Z" + justification: Credits needed to finish the incident investigation. + quota_namespace: ai_credits + requested_by_user_id: 12345678-1234-1234-1234-123456789012 + status: pending + total: 200 + id: 34567890-3456-3456-3456-345678901234 + type: temporary_grant_requests + meta: + page: {} + schema: + $ref: "#/components/schemas/TemporaryGrantRequestListResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - assistant_access + - AuthZ: + - bits_dev_write + - AuthZ: + - bits_investigations_write + - AuthZ: + - bits_security_analyst_write + - AuthZ: + - agent_builder_run + - AuthZ: + - billing_edit + summary: List your temporary grant requests + tags: + - Usage Metering + x-pagination: + cursorParam: page[cursor] + cursorPath: meta.page.next_cursor + limitParam: page[limit] + resultsPath: data + x-permission: + operator: OR + permissions: + - assistant_access + - bits_dev_write + - bits_investigations_write + - bits_security_analyst_write + - agent_builder_run + - 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/). + post: + description: Request a temporary increase to your monthly AI credit limit. Set `total` to the new monthly limit you need, in whole credits, not the number of credits to add. Include a justification and, optionally, an expiry. If you omit the expiry, the grant ends at the next UTC month boundary. A user with the Billing Edit permission approves or denies the request. Requires an authenticated human user. Service-account credentials are unsupported. + operationId: CreateTemporaryGrantRequest + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + expires_at: "2028-03-01T00:00:00Z" + justification: Credits needed to finish the incident investigation. + total: 200 + type: temporary_grant_requests + schema: + $ref: "#/components/schemas/TemporaryGrantRequestCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2028-02-16T00:00:00Z" + entity_key: user_handle:jane@example.com + expires_at: "2028-03-01T00:00:00Z" + justification: Credits needed to finish the incident investigation. + quota_namespace: ai_credits + requested_by_user_id: 12345678-1234-1234-1234-123456789012 + status: pending + total: 200 + id: 34567890-3456-3456-3456-345678901234 + type: temporary_grant_requests + schema: + $ref: "#/components/schemas/TemporaryGrantRequestResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - assistant_access + - AuthZ: + - bits_dev_write + - AuthZ: + - bits_investigations_write + - AuthZ: + - bits_security_analyst_write + - AuthZ: + - agent_builder_run + - AuthZ: + - billing_edit + summary: Create a temporary grant request + tags: + - Usage Metering + x-permission: + operator: OR + permissions: + - assistant_access + - bits_dev_write + - bits_investigations_write + - bits_security_analyst_write + - agent_builder_run + - 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/temporary-grant-requests/{request_id}: + delete: + description: Cancel a pending request that you own. The request history is kept, and no grant is created or revoked. Requires an authenticated human user. Service-account credentials are unsupported. + operationId: DeleteTemporaryGrantRequest + parameters: + - description: The temporary grant request UUID. + in: path + name: request_id + required: true + schema: + description: The request UUID. + example: 12345678-1234-1234-1234-123456789012 + format: uuid + type: string + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - assistant_access + - AuthZ: + - bits_dev_write + - AuthZ: + - bits_investigations_write + - AuthZ: + - bits_security_analyst_write + - AuthZ: + - agent_builder_run + - AuthZ: + - billing_edit + summary: Cancel your temporary grant request + tags: + - Usage Metering + x-permission: + operator: OR + permissions: + - assistant_access + - bits_dev_write + - bits_investigations_write + - bits_security_analyst_write + - agent_builder_run + - 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/). + get: + description: Read an owned request, its decision, and its linked grant state. Requires an authenticated human user. Service-account credentials are unsupported. Request status remains approved after expiry, revocation, or replacement. + operationId: GetMyTemporaryGrantRequest + parameters: + - description: The temporary grant request UUID. + in: path + name: request_id + required: true + schema: + description: The request UUID. + example: 12345678-1234-1234-1234-123456789012 + format: uuid + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2028-02-16T00:00:00Z" + entity_key: user_handle:jane@example.com + expires_at: "2028-03-01T00:00:00Z" + justification: Credits needed to finish the incident investigation. + quota_namespace: ai_credits + requested_by_user_id: 12345678-1234-1234-1234-123456789012 + status: pending + total: 200 + id: 34567890-3456-3456-3456-345678901234 + type: temporary_grant_requests + schema: + $ref: "#/components/schemas/TemporaryGrantRequestResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - assistant_access + - AuthZ: + - bits_dev_write + - AuthZ: + - bits_investigations_write + - AuthZ: + - bits_security_analyst_write + - AuthZ: + - agent_builder_run + - AuthZ: + - billing_edit + summary: Get your temporary grant request + tags: + - Usage Metering + x-permission: + operator: OR + permissions: + - assistant_access + - bits_dev_write + - bits_investigations_write + - bits_security_analyst_write + - agent_builder_run + - 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/usage-attribution-types: get: description: |- diff --git a/examples/v2/usage-metering/CreateTemporaryGrantRequest.java b/examples/v2/usage-metering/CreateTemporaryGrantRequest.java new file mode 100644 index 00000000000..18038c5e0b5 --- /dev/null +++ b/examples/v2/usage-metering/CreateTemporaryGrantRequest.java @@ -0,0 +1,42 @@ +// Create a temporary grant request returns "Created" 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.TemporaryGrantRequestCreateAttributes; +import com.datadog.api.client.v2.model.TemporaryGrantRequestCreateData; +import com.datadog.api.client.v2.model.TemporaryGrantRequestCreateRequest; +import com.datadog.api.client.v2.model.TemporaryGrantRequestResponse; +import com.datadog.api.client.v2.model.TemporaryGrantRequestType; +import java.time.OffsetDateTime; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.createTemporaryGrantRequest", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + TemporaryGrantRequestCreateRequest body = + new TemporaryGrantRequestCreateRequest() + .data( + new TemporaryGrantRequestCreateData() + .attributes( + new TemporaryGrantRequestCreateAttributes() + .expiresAt(OffsetDateTime.parse("2028-02-16T00:00:00Z")) + .justification("Credits needed to finish the incident investigation.") + .total(200L)) + .type(TemporaryGrantRequestType.TEMPORARY_GRANT_REQUESTS)); + + try { + TemporaryGrantRequestResponse result = apiInstance.createTemporaryGrantRequest(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsageMeteringApi#createTemporaryGrantRequest"); + 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/DeleteRequestedTemporaryGrant.java b/examples/v2/usage-metering/DeleteRequestedTemporaryGrant.java new file mode 100644 index 00000000000..77d2c3d3943 --- /dev/null +++ b/examples/v2/usage-metering/DeleteRequestedTemporaryGrant.java @@ -0,0 +1,26 @@ +// Revoke a requested temporary grant returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.UsageMeteringApi; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.deleteRequestedTemporaryGrant", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + try { + apiInstance.deleteRequestedTemporaryGrant( + UUID.fromString("12345678-1234-1234-1234-123456789012")); + } catch (ApiException e) { + System.err.println("Exception when calling UsageMeteringApi#deleteRequestedTemporaryGrant"); + 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/DeleteTemporaryGrantRequest.java b/examples/v2/usage-metering/DeleteTemporaryGrantRequest.java new file mode 100644 index 00000000000..6ffdb662c81 --- /dev/null +++ b/examples/v2/usage-metering/DeleteTemporaryGrantRequest.java @@ -0,0 +1,26 @@ +// Cancel your temporary grant request returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.UsageMeteringApi; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.deleteTemporaryGrantRequest", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + try { + apiInstance.deleteTemporaryGrantRequest( + UUID.fromString("12345678-1234-1234-1234-123456789012")); + } catch (ApiException e) { + System.err.println("Exception when calling UsageMeteringApi#deleteTemporaryGrantRequest"); + 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/GetMyTemporaryGrantRequest.java b/examples/v2/usage-metering/GetMyTemporaryGrantRequest.java new file mode 100644 index 00000000000..6ce2560b0c1 --- /dev/null +++ b/examples/v2/usage-metering/GetMyTemporaryGrantRequest.java @@ -0,0 +1,37 @@ +// Get your temporary grant request 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.TemporaryGrantRequestResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getMyTemporaryGrantRequest", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + // there is a valid "temporary_grant_request" in the system + UUID TEMPORARY_GRANT_REQUEST_DATA_ID = null; + try { + TEMPORARY_GRANT_REQUEST_DATA_ID = + UUID.fromString(System.getenv("TEMPORARY_GRANT_REQUEST_DATA_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + + try { + TemporaryGrantRequestResponse result = + apiInstance.getMyTemporaryGrantRequest(TEMPORARY_GRANT_REQUEST_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsageMeteringApi#getMyTemporaryGrantRequest"); + 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/GetTemporaryGrantRequest.java b/examples/v2/usage-metering/GetTemporaryGrantRequest.java new file mode 100644 index 00000000000..bf65b8a2b89 --- /dev/null +++ b/examples/v2/usage-metering/GetTemporaryGrantRequest.java @@ -0,0 +1,37 @@ +// Get an organization temporary grant request 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.TemporaryGrantRequestResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.getTemporaryGrantRequest", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + // there is a valid "temporary_grant_request" in the system + UUID TEMPORARY_GRANT_REQUEST_DATA_ID = null; + try { + TEMPORARY_GRANT_REQUEST_DATA_ID = + UUID.fromString(System.getenv("TEMPORARY_GRANT_REQUEST_DATA_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + + try { + TemporaryGrantRequestResponse result = + apiInstance.getTemporaryGrantRequest(TEMPORARY_GRANT_REQUEST_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsageMeteringApi#getTemporaryGrantRequest"); + 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/ListMyTemporaryGrantRequests.java b/examples/v2/usage-metering/ListMyTemporaryGrantRequests.java new file mode 100644 index 00000000000..3b2ee20f1b4 --- /dev/null +++ b/examples/v2/usage-metering/ListMyTemporaryGrantRequests.java @@ -0,0 +1,26 @@ +// List your temporary grant requests 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.TemporaryGrantRequestListResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.listMyTemporaryGrantRequests", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + try { + TemporaryGrantRequestListResponse result = apiInstance.listMyTemporaryGrantRequests(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsageMeteringApi#listMyTemporaryGrantRequests"); + 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/ListMyTemporaryGrantRequests_3885243213.java b/examples/v2/usage-metering/ListMyTemporaryGrantRequests_3885243213.java new file mode 100644 index 00000000000..bc97f1d79a9 --- /dev/null +++ b/examples/v2/usage-metering/ListMyTemporaryGrantRequests_3885243213.java @@ -0,0 +1,29 @@ +// List your temporary grant requests 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.TemporaryGrantRequestData; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.listMyTemporaryGrantRequests", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + try { + PaginationIterable iterable = + apiInstance.listMyTemporaryGrantRequestsWithPagination(); + + for (TemporaryGrantRequestData item : iterable) { + System.out.println(item); + } + } catch (RuntimeException e) { + System.err.println( + "Exception when calling UsageMeteringApi#listMyTemporaryGrantRequestsWithPagination"); + System.err.println("Reason: " + e.getMessage()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/usage-metering/ListTemporaryGrantRequests.java b/examples/v2/usage-metering/ListTemporaryGrantRequests.java new file mode 100644 index 00000000000..52fd25af814 --- /dev/null +++ b/examples/v2/usage-metering/ListTemporaryGrantRequests.java @@ -0,0 +1,26 @@ +// List organization temporary grant requests 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.TemporaryGrantRequestListResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.listTemporaryGrantRequests", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + try { + TemporaryGrantRequestListResponse result = apiInstance.listTemporaryGrantRequests(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsageMeteringApi#listTemporaryGrantRequests"); + 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/ListTemporaryGrantRequests_3760725651.java b/examples/v2/usage-metering/ListTemporaryGrantRequests_3760725651.java new file mode 100644 index 00000000000..803061c7114 --- /dev/null +++ b/examples/v2/usage-metering/ListTemporaryGrantRequests_3760725651.java @@ -0,0 +1,29 @@ +// List organization temporary grant requests 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.TemporaryGrantRequestData; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.listTemporaryGrantRequests", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + try { + PaginationIterable iterable = + apiInstance.listTemporaryGrantRequestsWithPagination(); + + for (TemporaryGrantRequestData item : iterable) { + System.out.println(item); + } + } catch (RuntimeException e) { + System.err.println( + "Exception when calling UsageMeteringApi#listTemporaryGrantRequestsWithPagination"); + System.err.println("Reason: " + e.getMessage()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/usage-metering/UpdateTemporaryGrantRequest.java b/examples/v2/usage-metering/UpdateTemporaryGrantRequest.java new file mode 100644 index 00000000000..09a9de77469 --- /dev/null +++ b/examples/v2/usage-metering/UpdateTemporaryGrantRequest.java @@ -0,0 +1,52 @@ +// Decide a temporary grant request 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.TemporaryGrantRequestDecision; +import com.datadog.api.client.v2.model.TemporaryGrantRequestDecisionAttributes; +import com.datadog.api.client.v2.model.TemporaryGrantRequestDecisionData; +import com.datadog.api.client.v2.model.TemporaryGrantRequestDecisionRequest; +import com.datadog.api.client.v2.model.TemporaryGrantRequestResponse; +import com.datadog.api.client.v2.model.TemporaryGrantRequestType; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + defaultClient.setUnstableOperationEnabled("v2.updateTemporaryGrantRequest", true); + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + + // there is a valid "temporary_grant_request" in the system + UUID TEMPORARY_GRANT_REQUEST_DATA_ID = null; + try { + TEMPORARY_GRANT_REQUEST_DATA_ID = + UUID.fromString(System.getenv("TEMPORARY_GRANT_REQUEST_DATA_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + + TemporaryGrantRequestDecisionRequest body = + new TemporaryGrantRequestDecisionRequest() + .data( + new TemporaryGrantRequestDecisionData() + .attributes( + new TemporaryGrantRequestDecisionAttributes() + .decision(TemporaryGrantRequestDecision.DENIED)) + .id(TEMPORARY_GRANT_REQUEST_DATA_ID) + .type(TemporaryGrantRequestType.TEMPORARY_GRANT_REQUESTS)); + + try { + TemporaryGrantRequestResponse result = + apiInstance.updateTemporaryGrantRequest(TEMPORARY_GRANT_REQUEST_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsageMeteringApi#updateTemporaryGrantRequest"); + 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 cfe6a77ca07..134fa1d9883 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1297,10 +1297,18 @@ public class ApiClient { put("v2.searchCostRecommendations", false); put("v2.updateUnitCost", false); put("v2.createQuotas", false); + put("v2.createTemporaryGrantRequest", false); put("v2.deletePendingQuota", false); put("v2.deleteQuota", false); + put("v2.deleteRequestedTemporaryGrant", false); + put("v2.deleteTemporaryGrantRequest", false); + put("v2.getMyTemporaryGrantRequest", false); + put("v2.getTemporaryGrantRequest", false); + put("v2.listMyTemporaryGrantRequests", false); put("v2.listQuotas", false); + put("v2.listTemporaryGrantRequests", false); put("v2.updateQuota", false); + put("v2.updateTemporaryGrantRequest", 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 f87c37c010c..e341fe1820b 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 @@ -13,6 +13,12 @@ import com.datadog.api.client.v2.model.MonthlyCostAttributionResponse; import com.datadog.api.client.v2.model.ProjectedCostResponse; import com.datadog.api.client.v2.model.SortDirection; +import com.datadog.api.client.v2.model.TemporaryGrantRequestCreateRequest; +import com.datadog.api.client.v2.model.TemporaryGrantRequestData; +import com.datadog.api.client.v2.model.TemporaryGrantRequestDecisionRequest; +import com.datadog.api.client.v2.model.TemporaryGrantRequestListResponse; +import com.datadog.api.client.v2.model.TemporaryGrantRequestResponse; +import com.datadog.api.client.v2.model.TemporaryGrantRequestStatus; import com.datadog.api.client.v2.model.UsageApplicationSecurityMonitoringResponse; import com.datadog.api.client.v2.model.UsageAttributionTypesResponse; import com.datadog.api.client.v2.model.UsageLambdaTracedInvocationsResponse; @@ -32,6 +38,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.UUID; import java.util.concurrent.CompletableFuture; @jakarta.annotation.Generated( @@ -332,6 +339,167 @@ public CompletableFuture> createQuotasWithH new GenericType() {}); } + /** + * Create a temporary grant request. + * + *

See {@link #createTemporaryGrantRequestWithHttpInfo}. + * + * @param body (required) + * @return TemporaryGrantRequestResponse + * @throws ApiException if fails to make API call + */ + public TemporaryGrantRequestResponse createTemporaryGrantRequest( + TemporaryGrantRequestCreateRequest body) throws ApiException { + return createTemporaryGrantRequestWithHttpInfo(body).getData(); + } + + /** + * Create a temporary grant request. + * + *

See {@link #createTemporaryGrantRequestWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<TemporaryGrantRequestResponse> + */ + public CompletableFuture createTemporaryGrantRequestAsync( + TemporaryGrantRequestCreateRequest body) { + return createTemporaryGrantRequestWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Request a temporary increase to your monthly AI credit limit. Set total to the new + * monthly limit you need, in whole credits, not the number of credits to add. Include a + * justification and, optionally, an expiry. If you omit the expiry, the grant ends at the next + * UTC month boundary. A user with the Billing Edit permission approves or denies the request. + * Requires an authenticated human user. Service-account credentials are unsupported. + * + * @param body (required) + * @return ApiResponse<TemporaryGrantRequestResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse createTemporaryGrantRequestWithHttpInfo( + TemporaryGrantRequestCreateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createTemporaryGrantRequest"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createTemporaryGrantRequest"); + } + // create path and map variables + String localVarPath = "/api/v2/usage/temporary-grant-requests"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.createTemporaryGrantRequest", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a temporary grant request. + * + *

See {@link #createTemporaryGrantRequestWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<TemporaryGrantRequestResponse>> + */ + public CompletableFuture> + createTemporaryGrantRequestWithHttpInfoAsync(TemporaryGrantRequestCreateRequest body) { + // Check if unstable operation is enabled + String operationId = "createTemporaryGrantRequest"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling createTemporaryGrantRequest")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/usage/temporary-grant-requests"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.createTemporaryGrantRequest", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Cancel a scheduled usage quota limit. * @@ -708,26 +876,27 @@ public CompletableFuture> deleteQuotaWithHttpInfoAsync( } /** - * Get active billing dimensions for cost attribution. + * Revoke a requested temporary grant. * - *

See {@link #getActiveBillingDimensionsWithHttpInfo}. + *

See {@link #deleteRequestedTemporaryGrantWithHttpInfo}. * - * @return ActiveBillingDimensionsResponse + * @param requestId The temporary grant request UUID. (required) * @throws ApiException if fails to make API call */ - public ActiveBillingDimensionsResponse getActiveBillingDimensions() throws ApiException { - return getActiveBillingDimensionsWithHttpInfo().getData(); + public void deleteRequestedTemporaryGrant(UUID requestId) throws ApiException { + deleteRequestedTemporaryGrantWithHttpInfo(requestId); } /** - * Get active billing dimensions for cost attribution. + * Revoke a requested temporary grant. * - *

See {@link #getActiveBillingDimensionsWithHttpInfoAsync}. + *

See {@link #deleteRequestedTemporaryGrantWithHttpInfoAsync}. * - * @return CompletableFuture<ActiveBillingDimensionsResponse> + * @param requestId The temporary grant request UUID. (required) + * @return CompletableFuture */ - public CompletableFuture getActiveBillingDimensionsAsync() { - return getActiveBillingDimensionsWithHttpInfoAsync() + public CompletableFuture deleteRequestedTemporaryGrantAsync(UUID requestId) { + return deleteRequestedTemporaryGrantWithHttpInfoAsync(requestId) .thenApply( response -> { return response.getData(); @@ -735,61 +904,107 @@ public CompletableFuture getActiveBillingDimens } /** - * Get active billing dimensions for cost attribution. Cost data for a given month becomes - * available no later than the 19th of the following month. + * Revoke only the grant that's still associated with this approved request. The request and audit + * history remain. A stale request can't revoke a replacement grant. Requires the Billing Edit + * permission. Requires an authenticated human user. Service-account credentials aren't supported. + * Request status remains approved after the grant's expiry, revocation, or replacement. * - * @return ApiResponse<ActiveBillingDimensionsResponse> + * @param requestId The temporary grant request UUID. (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details * * * - * + * * - * + * + * + * + * * *
Response details
Status Code Description Response Headers
200 OK -
204 No Content -
400 Bad Request -
403 Forbidden - User is not authorized -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
*/ - public ApiResponse getActiveBillingDimensionsWithHttpInfo() + public ApiResponse deleteRequestedTemporaryGrantWithHttpInfo(UUID requestId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteRequestedTemporaryGrant"; + 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 'requestId' is set + if (requestId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'requestId' when calling deleteRequestedTemporaryGrant"); + } // create path and map variables - String localVarPath = "/api/v2/cost_by_tag/active_billing_dimensions"; + String localVarPath = + "/api/v2/usage/admin/temporary-grant-requests/{request_id}/grant" + .replaceAll("\\{" + "request_id" + "\\}", apiClient.escapeString(requestId.toString())); Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( - "v2.UsageMeteringApi.getActiveBillingDimensions", + "v2.UsageMeteringApi.deleteRequestedTemporaryGrant", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), - new String[] {"application/json;datetime-format=rfc3339"}, + new String[] {"*/*"}, new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); return apiClient.invokeAPI( - "GET", + "DELETE", builder, localVarHeaderParams, new String[] {}, localVarPostBody, new HashMap(), false, - new GenericType() {}); + null); } /** - * Get active billing dimensions for cost attribution. + * Revoke a requested temporary grant. * - *

See {@link #getActiveBillingDimensionsWithHttpInfo}. + *

See {@link #deleteRequestedTemporaryGrantWithHttpInfo}. * - * @return CompletableFuture<ApiResponse<ActiveBillingDimensionsResponse>> + * @param requestId The temporary grant request UUID. (required) + * @return CompletableFuture<ApiResponse<Void>> */ - public CompletableFuture> - getActiveBillingDimensionsWithHttpInfoAsync() { + public CompletableFuture> deleteRequestedTemporaryGrantWithHttpInfoAsync( + UUID requestId) { + // Check if unstable operation is enabled + String operationId = "deleteRequestedTemporaryGrant"; + 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 'requestId' is set + if (requestId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'requestId' when calling" + + " deleteRequestedTemporaryGrant")); + return result; + } // create path and map variables - String localVarPath = "/api/v2/cost_by_tag/active_billing_dimensions"; + String localVarPath = + "/api/v2/usage/admin/temporary-grant-requests/{request_id}/grant" + .replaceAll("\\{" + "request_id" + "\\}", apiClient.escapeString(requestId.toString())); Map localVarHeaderParams = new HashMap(); @@ -797,86 +1012,51 @@ public ApiResponse getActiveBillingDimensionsWi try { builder = apiClient.createBuilder( - "v2.UsageMeteringApi.getActiveBillingDimensions", + "v2.UsageMeteringApi.deleteRequestedTemporaryGrant", localVarPath, new ArrayList(), localVarHeaderParams, new HashMap(), - new String[] {"application/json;datetime-format=rfc3339"}, + new String[] {"*/*"}, new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { - CompletableFuture> result = - new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } return apiClient.invokeAPIAsync( - "GET", + "DELETE", builder, localVarHeaderParams, new String[] {}, localVarPostBody, new HashMap(), false, - new GenericType() {}); - } - - /** Manage optional parameters to getBillingDimensionMapping. */ - public static class GetBillingDimensionMappingOptionalParameters { - private OffsetDateTime filterMonth; - private String filterView; - - /** - * Set filterMonth. - * - * @param filterMonth Datetime in ISO-8601 format, UTC, and for mappings beginning this month. - * Defaults to the current month. (optional) - * @return GetBillingDimensionMappingOptionalParameters - */ - public GetBillingDimensionMappingOptionalParameters filterMonth(OffsetDateTime filterMonth) { - this.filterMonth = filterMonth; - return this; - } - - /** - * Set filterView. - * - * @param filterView String to specify whether to retrieve active billing dimension mappings for - * the contract or for all available mappings. Allowed views have the string active - * or all. Defaults to active. (optional, default to - * "active") - * @return GetBillingDimensionMappingOptionalParameters - */ - public GetBillingDimensionMappingOptionalParameters filterView(String filterView) { - this.filterView = filterView; - return this; - } + null); } /** - * Get billing dimension mapping for usage endpoints. + * Cancel your temporary grant request. * - *

See {@link #getBillingDimensionMappingWithHttpInfo}. + *

See {@link #deleteTemporaryGrantRequestWithHttpInfo}. * - * @return BillingDimensionsMappingResponse + * @param requestId The temporary grant request UUID. (required) * @throws ApiException if fails to make API call */ - public BillingDimensionsMappingResponse getBillingDimensionMapping() throws ApiException { - return getBillingDimensionMappingWithHttpInfo( - new GetBillingDimensionMappingOptionalParameters()) - .getData(); + public void deleteTemporaryGrantRequest(UUID requestId) throws ApiException { + deleteTemporaryGrantRequestWithHttpInfo(requestId); } /** - * Get billing dimension mapping for usage endpoints. + * Cancel your temporary grant request. * - *

See {@link #getBillingDimensionMappingWithHttpInfoAsync}. + *

See {@link #deleteTemporaryGrantRequestWithHttpInfoAsync}. * - * @return CompletableFuture<BillingDimensionsMappingResponse> + * @param requestId The temporary grant request UUID. (required) + * @return CompletableFuture */ - public CompletableFuture getBillingDimensionMappingAsync() { - return getBillingDimensionMappingWithHttpInfoAsync( - new GetBillingDimensionMappingOptionalParameters()) + public CompletableFuture deleteTemporaryGrantRequestAsync(UUID requestId) { + return deleteTemporaryGrantRequestWithHttpInfoAsync(requestId) .thenApply( response -> { return response.getData(); @@ -884,30 +1064,156 @@ public CompletableFuture getBillingDimensionMa } /** - * Get billing dimension mapping for usage endpoints. + * Cancel a pending request that you own. The request history is kept, and no grant is created or + * revoked. Requires an authenticated human user. Service-account credentials are unsupported. * - *

See {@link #getBillingDimensionMappingWithHttpInfo}. - * - * @param parameters Optional parameters for the request. - * @return BillingDimensionsMappingResponse + * @param requestId The temporary grant request UUID. (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 -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
*/ - public BillingDimensionsMappingResponse getBillingDimensionMapping( - GetBillingDimensionMappingOptionalParameters parameters) throws ApiException { - return getBillingDimensionMappingWithHttpInfo(parameters).getData(); - } - + public ApiResponse deleteTemporaryGrantRequestWithHttpInfo(UUID requestId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteTemporaryGrantRequest"; + 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 'requestId' is set + if (requestId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'requestId' when calling deleteTemporaryGrantRequest"); + } + // create path and map variables + String localVarPath = + "/api/v2/usage/temporary-grant-requests/{request_id}" + .replaceAll("\\{" + "request_id" + "\\}", apiClient.escapeString(requestId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.deleteTemporaryGrantRequest", + 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); + } + /** - * Get billing dimension mapping for usage endpoints. + * Cancel your temporary grant request. * - *

See {@link #getBillingDimensionMappingWithHttpInfoAsync}. + *

See {@link #deleteTemporaryGrantRequestWithHttpInfo}. * - * @param parameters Optional parameters for the request. - * @return CompletableFuture<BillingDimensionsMappingResponse> + * @param requestId The temporary grant request UUID. (required) + * @return CompletableFuture<ApiResponse<Void>> */ - public CompletableFuture getBillingDimensionMappingAsync( - GetBillingDimensionMappingOptionalParameters parameters) { - return getBillingDimensionMappingWithHttpInfoAsync(parameters) + public CompletableFuture> deleteTemporaryGrantRequestWithHttpInfoAsync( + UUID requestId) { + // Check if unstable operation is enabled + String operationId = "deleteTemporaryGrantRequest"; + 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 'requestId' is set + if (requestId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'requestId' when calling" + + " deleteTemporaryGrantRequest")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/usage/temporary-grant-requests/{request_id}" + .replaceAll("\\{" + "request_id" + "\\}", apiClient.escapeString(requestId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.deleteTemporaryGrantRequest", + 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. + * + *

See {@link #getActiveBillingDimensionsWithHttpInfo}. + * + * @return ActiveBillingDimensionsResponse + * @throws ApiException if fails to make API call + */ + public ActiveBillingDimensionsResponse getActiveBillingDimensions() throws ApiException { + return getActiveBillingDimensionsWithHttpInfo().getData(); + } + + /** + * Get active billing dimensions for cost attribution. + * + *

See {@link #getActiveBillingDimensionsWithHttpInfoAsync}. + * + * @return CompletableFuture<ActiveBillingDimensionsResponse> + */ + public CompletableFuture getActiveBillingDimensionsAsync() { + return getActiveBillingDimensionsWithHttpInfoAsync() .thenApply( response -> { return response.getData(); @@ -915,15 +1221,10 @@ public CompletableFuture getBillingDimensionMa } /** - * Get a mapping of billing dimensions to the corresponding keys for the supported usage metering - * public API endpoints. Mapping data is updated on a monthly cadence. - * - *

This endpoint is only accessible to parent-level - * organizations. + * Get active billing dimensions for cost attribution. Cost data for a given month becomes + * available no later than the 19th of the following month. * - * @param parameters Optional parameters for the request. - * @return ApiResponse<BillingDimensionsMappingResponse> + * @return ApiResponse<ActiveBillingDimensionsResponse> * @throws ApiException if fails to make API call * @http.response.details * @@ -935,25 +1236,19 @@ public CompletableFuture getBillingDimensionMa * *
429 Too many requests -
*/ - public ApiResponse getBillingDimensionMappingWithHttpInfo( - GetBillingDimensionMappingOptionalParameters parameters) throws ApiException { + public ApiResponse getActiveBillingDimensionsWithHttpInfo() + throws ApiException { Object localVarPostBody = null; - OffsetDateTime filterMonth = parameters.filterMonth; - String filterView = parameters.filterView; // create path and map variables - String localVarPath = "/api/v2/usage/billing_dimension_mapping"; + String localVarPath = "/api/v2/cost_by_tag/active_billing_dimensions"; - List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[month]", filterMonth)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[view]", filterView)); - Invocation.Builder builder = apiClient.createBuilder( - "v2.UsageMeteringApi.getBillingDimensionMapping", + "v2.UsageMeteringApi.getActiveBillingDimensions", localVarPath, - localVarQueryParams, + new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json;datetime-format=rfc3339"}, @@ -966,45 +1261,37 @@ public ApiResponse getBillingDimensionMappingW localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Get billing dimension mapping for usage endpoints. + * Get active billing dimensions for cost attribution. * - *

See {@link #getBillingDimensionMappingWithHttpInfo}. + *

See {@link #getActiveBillingDimensionsWithHttpInfo}. * - * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<BillingDimensionsMappingResponse>> + * @return CompletableFuture<ApiResponse<ActiveBillingDimensionsResponse>> */ - public CompletableFuture> - getBillingDimensionMappingWithHttpInfoAsync( - GetBillingDimensionMappingOptionalParameters parameters) { + public CompletableFuture> + getActiveBillingDimensionsWithHttpInfoAsync() { Object localVarPostBody = null; - OffsetDateTime filterMonth = parameters.filterMonth; - String filterView = parameters.filterView; // create path and map variables - String localVarPath = "/api/v2/usage/billing_dimension_mapping"; + String localVarPath = "/api/v2/cost_by_tag/active_billing_dimensions"; - List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[month]", filterMonth)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[view]", filterView)); - Invocation.Builder builder; try { builder = apiClient.createBuilder( - "v2.UsageMeteringApi.getBillingDimensionMapping", + "v2.UsageMeteringApi.getActiveBillingDimensions", localVarPath, - localVarQueryParams, + new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json;datetime-format=rfc3339"}, new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { - CompletableFuture> result = + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; @@ -1017,55 +1304,65 @@ public ApiResponse getBillingDimensionMappingW localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } - /** Manage optional parameters to getCostByOrg. */ - public static class GetCostByOrgOptionalParameters { - private OffsetDateTime endMonth; + /** Manage optional parameters to getBillingDimensionMapping. */ + public static class GetBillingDimensionMappingOptionalParameters { + private OffsetDateTime filterMonth; + private String filterView; /** - * Set endMonth. + * Set filterMonth. * - * @param endMonth Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] - * for cost ending this month. (optional) - * @return GetCostByOrgOptionalParameters + * @param filterMonth Datetime in ISO-8601 format, UTC, and for mappings beginning this month. + * Defaults to the current month. (optional) + * @return GetBillingDimensionMappingOptionalParameters */ - public GetCostByOrgOptionalParameters endMonth(OffsetDateTime endMonth) { - this.endMonth = endMonth; + public GetBillingDimensionMappingOptionalParameters filterMonth(OffsetDateTime filterMonth) { + this.filterMonth = filterMonth; + return this; + } + + /** + * Set filterView. + * + * @param filterView String to specify whether to retrieve active billing dimension mappings for + * the contract or for all available mappings. Allowed views have the string active + * or all. Defaults to active. (optional, default to + * "active") + * @return GetBillingDimensionMappingOptionalParameters + */ + public GetBillingDimensionMappingOptionalParameters filterView(String filterView) { + this.filterView = filterView; return this; } } /** - * Get cost across multi-org account. + * Get billing dimension mapping for usage endpoints. * - *

See {@link #getCostByOrgWithHttpInfo}. + *

See {@link #getBillingDimensionMappingWithHttpInfo}. * - * @param startMonth Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] - * for cost beginning this month. (required) - * @return CostByOrgResponse + * @return BillingDimensionsMappingResponse * @throws ApiException if fails to make API call - * @deprecated */ - @Deprecated - public CostByOrgResponse getCostByOrg(OffsetDateTime startMonth) throws ApiException { - return getCostByOrgWithHttpInfo(startMonth, new GetCostByOrgOptionalParameters()).getData(); + public BillingDimensionsMappingResponse getBillingDimensionMapping() throws ApiException { + return getBillingDimensionMappingWithHttpInfo( + new GetBillingDimensionMappingOptionalParameters()) + .getData(); } /** - * Get cost across multi-org account. + * Get billing dimension mapping for usage endpoints. * - *

See {@link #getCostByOrgWithHttpInfoAsync}. + *

See {@link #getBillingDimensionMappingWithHttpInfoAsync}. * - * @param startMonth Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] - * for cost beginning this month. (required) - * @return CompletableFuture<CostByOrgResponse> - * @deprecated + * @return CompletableFuture<BillingDimensionsMappingResponse> */ - @Deprecated - public CompletableFuture getCostByOrgAsync(OffsetDateTime startMonth) { - return getCostByOrgWithHttpInfoAsync(startMonth, new GetCostByOrgOptionalParameters()) + public CompletableFuture getBillingDimensionMappingAsync() { + return getBillingDimensionMappingWithHttpInfoAsync( + new GetBillingDimensionMappingOptionalParameters()) .thenApply( response -> { return response.getData(); @@ -1073,30 +1370,219 @@ public CompletableFuture getCostByOrgAsync(OffsetDateTime sta } /** - * Get cost across multi-org account. + * Get billing dimension mapping for usage endpoints. * - *

See {@link #getCostByOrgWithHttpInfo}. + *

See {@link #getBillingDimensionMappingWithHttpInfo}. * - * @param startMonth Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] - * for cost beginning this month. (required) * @param parameters Optional parameters for the request. - * @return CostByOrgResponse + * @return BillingDimensionsMappingResponse * @throws ApiException if fails to make API call - * @deprecated */ - @Deprecated - public CostByOrgResponse getCostByOrg( - OffsetDateTime startMonth, GetCostByOrgOptionalParameters parameters) throws ApiException { - return getCostByOrgWithHttpInfo(startMonth, parameters).getData(); + public BillingDimensionsMappingResponse getBillingDimensionMapping( + GetBillingDimensionMappingOptionalParameters parameters) throws ApiException { + return getBillingDimensionMappingWithHttpInfo(parameters).getData(); } /** - * Get cost across multi-org account. + * Get billing dimension mapping for usage endpoints. * - *

See {@link #getCostByOrgWithHttpInfoAsync}. + *

See {@link #getBillingDimensionMappingWithHttpInfoAsync}. * - * @param startMonth Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] - * for cost beginning this month. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<BillingDimensionsMappingResponse> + */ + public CompletableFuture getBillingDimensionMappingAsync( + GetBillingDimensionMappingOptionalParameters parameters) { + return getBillingDimensionMappingWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a mapping of billing dimensions to the corresponding keys for the supported usage metering + * public API endpoints. Mapping data is updated on a monthly cadence. + * + *

This endpoint is only accessible to parent-level + * organizations. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<BillingDimensionsMappingResponse> + * @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 - User is not authorized -
429 Too many requests -
+ */ + public ApiResponse getBillingDimensionMappingWithHttpInfo( + GetBillingDimensionMappingOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + OffsetDateTime filterMonth = parameters.filterMonth; + String filterView = parameters.filterView; + // create path and map variables + String localVarPath = "/api/v2/usage/billing_dimension_mapping"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[month]", filterMonth)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[view]", filterView)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.getBillingDimensionMapping", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json;datetime-format=rfc3339"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get billing dimension mapping for usage endpoints. + * + *

See {@link #getBillingDimensionMappingWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<BillingDimensionsMappingResponse>> + */ + public CompletableFuture> + getBillingDimensionMappingWithHttpInfoAsync( + GetBillingDimensionMappingOptionalParameters parameters) { + Object localVarPostBody = null; + OffsetDateTime filterMonth = parameters.filterMonth; + String filterView = parameters.filterView; + // create path and map variables + String localVarPath = "/api/v2/usage/billing_dimension_mapping"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[month]", filterMonth)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[view]", filterView)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.getBillingDimensionMapping", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json;datetime-format=rfc3339"}, + 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() {}); + } + + /** Manage optional parameters to getCostByOrg. */ + public static class GetCostByOrgOptionalParameters { + private OffsetDateTime endMonth; + + /** + * Set endMonth. + * + * @param endMonth Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] + * for cost ending this month. (optional) + * @return GetCostByOrgOptionalParameters + */ + public GetCostByOrgOptionalParameters endMonth(OffsetDateTime endMonth) { + this.endMonth = endMonth; + return this; + } + } + + /** + * Get cost across multi-org account. + * + *

See {@link #getCostByOrgWithHttpInfo}. + * + * @param startMonth Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] + * for cost beginning this month. (required) + * @return CostByOrgResponse + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public CostByOrgResponse getCostByOrg(OffsetDateTime startMonth) throws ApiException { + return getCostByOrgWithHttpInfo(startMonth, new GetCostByOrgOptionalParameters()).getData(); + } + + /** + * Get cost across multi-org account. + * + *

See {@link #getCostByOrgWithHttpInfoAsync}. + * + * @param startMonth Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] + * for cost beginning this month. (required) + * @return CompletableFuture<CostByOrgResponse> + * @deprecated + */ + @Deprecated + public CompletableFuture getCostByOrgAsync(OffsetDateTime startMonth) { + return getCostByOrgWithHttpInfoAsync(startMonth, new GetCostByOrgOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get cost across multi-org account. + * + *

See {@link #getCostByOrgWithHttpInfo}. + * + * @param startMonth Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] + * for cost beginning this month. (required) + * @param parameters Optional parameters for the request. + * @return CostByOrgResponse + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public CostByOrgResponse getCostByOrg( + OffsetDateTime startMonth, GetCostByOrgOptionalParameters parameters) throws ApiException { + return getCostByOrgWithHttpInfo(startMonth, parameters).getData(); + } + + /** + * Get cost across multi-org account. + * + *

See {@link #getCostByOrgWithHttpInfoAsync}. + * + * @param startMonth Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] + * for cost beginning this month. (required) * @param parameters Optional parameters for the request. * @return CompletableFuture<CostByOrgResponse> * @deprecated @@ -2676,60 +3162,31 @@ public ApiResponse getMonthlyCostAttributionWith new GenericType() {}); } - /** Manage optional parameters to getProjectedCost. */ - public static class GetProjectedCostOptionalParameters { - private String view; - private Boolean includeConnectedAccounts; - - /** - * Set view. - * - * @param view String to specify whether cost is broken down at a parent-org level or at the - * sub-org level. Available views are summary and sub-org. - * Defaults to summary. (optional) - * @return GetProjectedCostOptionalParameters - */ - public GetProjectedCostOptionalParameters view(String view) { - this.view = view; - return this; - } - - /** - * Set includeConnectedAccounts. - * - * @param includeConnectedAccounts Boolean to specify whether to include accounts connected to - * the current account as partner customers in the Datadog partner network program. Defaults - * to false. (optional, default to false) - * @return GetProjectedCostOptionalParameters - */ - public GetProjectedCostOptionalParameters includeConnectedAccounts( - Boolean includeConnectedAccounts) { - this.includeConnectedAccounts = includeConnectedAccounts; - return this; - } - } - /** - * Get projected cost across your account. + * Get your temporary grant request. * - *

See {@link #getProjectedCostWithHttpInfo}. + *

See {@link #getMyTemporaryGrantRequestWithHttpInfo}. * - * @return ProjectedCostResponse + * @param requestId The temporary grant request UUID. (required) + * @return TemporaryGrantRequestResponse * @throws ApiException if fails to make API call */ - public ProjectedCostResponse getProjectedCost() throws ApiException { - return getProjectedCostWithHttpInfo(new GetProjectedCostOptionalParameters()).getData(); + public TemporaryGrantRequestResponse getMyTemporaryGrantRequest(UUID requestId) + throws ApiException { + return getMyTemporaryGrantRequestWithHttpInfo(requestId).getData(); } /** - * Get projected cost across your account. + * Get your temporary grant request. * - *

See {@link #getProjectedCostWithHttpInfoAsync}. + *

See {@link #getMyTemporaryGrantRequestWithHttpInfoAsync}. * - * @return CompletableFuture<ProjectedCostResponse> + * @param requestId The temporary grant request UUID. (required) + * @return CompletableFuture<TemporaryGrantRequestResponse> */ - public CompletableFuture getProjectedCostAsync() { - return getProjectedCostWithHttpInfoAsync(new GetProjectedCostOptionalParameters()) + public CompletableFuture getMyTemporaryGrantRequestAsync( + UUID requestId) { + return getMyTemporaryGrantRequestWithHttpInfoAsync(requestId) .thenApply( response -> { return response.getData(); @@ -2737,16 +3194,210 @@ public CompletableFuture getProjectedCostAsync() { } /** - * Get projected cost across your account. + * Read an owned request, its decision, and its linked grant state. Requires an authenticated + * human user. Service-account credentials are unsupported. Request status remains approved after + * expiry, revocation, or replacement. * - *

See {@link #getProjectedCostWithHttpInfo}. - * - * @param parameters Optional parameters for the request. - * @return ProjectedCostResponse + * @param requestId The temporary grant request UUID. (required) + * @return ApiResponse<TemporaryGrantRequestResponse> * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
*/ - public ProjectedCostResponse getProjectedCost(GetProjectedCostOptionalParameters parameters) - throws ApiException { + public ApiResponse getMyTemporaryGrantRequestWithHttpInfo( + UUID requestId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getMyTemporaryGrantRequest"; + 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 'requestId' is set + if (requestId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'requestId' when calling getMyTemporaryGrantRequest"); + } + // create path and map variables + String localVarPath = + "/api/v2/usage/temporary-grant-requests/{request_id}" + .replaceAll("\\{" + "request_id" + "\\}", apiClient.escapeString(requestId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.getMyTemporaryGrantRequest", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get your temporary grant request. + * + *

See {@link #getMyTemporaryGrantRequestWithHttpInfo}. + * + * @param requestId The temporary grant request UUID. (required) + * @return CompletableFuture<ApiResponse<TemporaryGrantRequestResponse>> + */ + public CompletableFuture> + getMyTemporaryGrantRequestWithHttpInfoAsync(UUID requestId) { + // Check if unstable operation is enabled + String operationId = "getMyTemporaryGrantRequest"; + 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 'requestId' is set + if (requestId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'requestId' when calling" + + " getMyTemporaryGrantRequest")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/usage/temporary-grant-requests/{request_id}" + .replaceAll("\\{" + "request_id" + "\\}", apiClient.escapeString(requestId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.getMyTemporaryGrantRequest", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to getProjectedCost. */ + public static class GetProjectedCostOptionalParameters { + private String view; + private Boolean includeConnectedAccounts; + + /** + * Set view. + * + * @param view String to specify whether cost is broken down at a parent-org level or at the + * sub-org level. Available views are summary and sub-org. + * Defaults to summary. (optional) + * @return GetProjectedCostOptionalParameters + */ + public GetProjectedCostOptionalParameters view(String view) { + this.view = view; + return this; + } + + /** + * Set includeConnectedAccounts. + * + * @param includeConnectedAccounts Boolean to specify whether to include accounts connected to + * the current account as partner customers in the Datadog partner network program. Defaults + * to false. (optional, default to false) + * @return GetProjectedCostOptionalParameters + */ + public GetProjectedCostOptionalParameters includeConnectedAccounts( + Boolean includeConnectedAccounts) { + this.includeConnectedAccounts = includeConnectedAccounts; + return this; + } + } + + /** + * Get projected cost across your account. + * + *

See {@link #getProjectedCostWithHttpInfo}. + * + * @return ProjectedCostResponse + * @throws ApiException if fails to make API call + */ + public ProjectedCostResponse getProjectedCost() throws ApiException { + return getProjectedCostWithHttpInfo(new GetProjectedCostOptionalParameters()).getData(); + } + + /** + * Get projected cost across your account. + * + *

See {@link #getProjectedCostWithHttpInfoAsync}. + * + * @return CompletableFuture<ProjectedCostResponse> + */ + public CompletableFuture getProjectedCostAsync() { + return getProjectedCostWithHttpInfoAsync(new GetProjectedCostOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get projected cost across your account. + * + *

See {@link #getProjectedCostWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return ProjectedCostResponse + * @throws ApiException if fails to make API call + */ + public ProjectedCostResponse getProjectedCost(GetProjectedCostOptionalParameters parameters) + throws ApiException { return getProjectedCostWithHttpInfo(parameters).getData(); } @@ -2873,99 +3524,31 @@ public CompletableFuture> getProjectedCostWit new GenericType() {}); } - /** Manage optional parameters to getUsageApplicationSecurityMonitoring. */ - public static class GetUsageApplicationSecurityMonitoringOptionalParameters { - private OffsetDateTime endHr; - - /** - * Set endHr. - * - * @param endHr Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] - * for usage ending before this hour. (optional) - * @return GetUsageApplicationSecurityMonitoringOptionalParameters - */ - public GetUsageApplicationSecurityMonitoringOptionalParameters endHr(OffsetDateTime endHr) { - this.endHr = endHr; - return this; - } - } - - /** - * Get hourly usage for application security. - * - *

See {@link #getUsageApplicationSecurityMonitoringWithHttpInfo}. - * - * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] - * for usage beginning at this hour. (required) - * @return UsageApplicationSecurityMonitoringResponse - * @throws ApiException if fails to make API call - * @deprecated - */ - @Deprecated - public UsageApplicationSecurityMonitoringResponse getUsageApplicationSecurityMonitoring( - OffsetDateTime startHr) throws ApiException { - return getUsageApplicationSecurityMonitoringWithHttpInfo( - startHr, new GetUsageApplicationSecurityMonitoringOptionalParameters()) - .getData(); - } - /** - * Get hourly usage for application security. - * - *

See {@link #getUsageApplicationSecurityMonitoringWithHttpInfoAsync}. - * - * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] - * for usage beginning at this hour. (required) - * @return CompletableFuture<UsageApplicationSecurityMonitoringResponse> - * @deprecated - */ - @Deprecated - public CompletableFuture - getUsageApplicationSecurityMonitoringAsync(OffsetDateTime startHr) { - return getUsageApplicationSecurityMonitoringWithHttpInfoAsync( - startHr, new GetUsageApplicationSecurityMonitoringOptionalParameters()) - .thenApply( - response -> { - return response.getData(); - }); - } - - /** - * Get hourly usage for application security. + * Get an organization temporary grant request. * - *

See {@link #getUsageApplicationSecurityMonitoringWithHttpInfo}. + *

See {@link #getTemporaryGrantRequestWithHttpInfo}. * - * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] - * for usage beginning at this hour. (required) - * @param parameters Optional parameters for the request. - * @return UsageApplicationSecurityMonitoringResponse + * @param requestId The temporary grant request UUID. (required) + * @return TemporaryGrantRequestResponse * @throws ApiException if fails to make API call - * @deprecated */ - @Deprecated - public UsageApplicationSecurityMonitoringResponse getUsageApplicationSecurityMonitoring( - OffsetDateTime startHr, GetUsageApplicationSecurityMonitoringOptionalParameters parameters) + public TemporaryGrantRequestResponse getTemporaryGrantRequest(UUID requestId) throws ApiException { - return getUsageApplicationSecurityMonitoringWithHttpInfo(startHr, parameters).getData(); + return getTemporaryGrantRequestWithHttpInfo(requestId).getData(); } /** - * Get hourly usage for application security. + * Get an organization temporary grant request. * - *

See {@link #getUsageApplicationSecurityMonitoringWithHttpInfoAsync}. + *

See {@link #getTemporaryGrantRequestWithHttpInfoAsync}. * - * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] - * for usage beginning at this hour. (required) - * @param parameters Optional parameters for the request. - * @return CompletableFuture<UsageApplicationSecurityMonitoringResponse> - * @deprecated + * @param requestId The temporary grant request UUID. (required) + * @return CompletableFuture<TemporaryGrantRequestResponse> */ - @Deprecated - public CompletableFuture - getUsageApplicationSecurityMonitoringAsync( - OffsetDateTime startHr, - GetUsageApplicationSecurityMonitoringOptionalParameters parameters) { - return getUsageApplicationSecurityMonitoringWithHttpInfoAsync(startHr, parameters) + public CompletableFuture getTemporaryGrantRequestAsync( + UUID requestId) { + return getTemporaryGrantRequestWithHttpInfoAsync(requestId) .thenApply( response -> { return response.getData(); @@ -2973,15 +3556,12 @@ public UsageApplicationSecurityMonitoringResponse getUsageApplicationSecurityMon } /** - * Get hourly usage for application security . Note: This endpoint has been - * deprecated. Hourly usage data for all products is now available in the Get - * hourly usage by product family API + * Read an organization request, justification, decision, and linked grant state. Requires Billing + * Edit. Requires an authenticated human user. Service-account credentials are unsupported. + * Request status remains approved after expiry, revocation, or replacement. * - * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] - * for usage beginning at this hour. (required) - * @param parameters Optional parameters for the request. - * @return ApiResponse<UsageApplicationSecurityMonitoringResponse> + * @param requestId The temporary grant request UUID. (required) + * @return ApiResponse<TemporaryGrantRequestResponse> * @throws ApiException if fails to make API call * @http.response.details * @@ -2989,18 +3569,252 @@ public UsageApplicationSecurityMonitoringResponse getUsageApplicationSecurityMon * * * - * + * + * + * + * * *
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden - User is not authorized -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
- * - * @deprecated */ - @Deprecated - public ApiResponse - getUsageApplicationSecurityMonitoringWithHttpInfo( - OffsetDateTime startHr, - GetUsageApplicationSecurityMonitoringOptionalParameters parameters) - throws ApiException { + public ApiResponse getTemporaryGrantRequestWithHttpInfo( + UUID requestId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getTemporaryGrantRequest"; + 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 'requestId' is set + if (requestId == null) { + throw new ApiException( + 400, "Missing the required parameter 'requestId' when calling getTemporaryGrantRequest"); + } + // create path and map variables + String localVarPath = + "/api/v2/usage/admin/temporary-grant-requests/{request_id}" + .replaceAll("\\{" + "request_id" + "\\}", apiClient.escapeString(requestId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.getTemporaryGrantRequest", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get an organization temporary grant request. + * + *

See {@link #getTemporaryGrantRequestWithHttpInfo}. + * + * @param requestId The temporary grant request UUID. (required) + * @return CompletableFuture<ApiResponse<TemporaryGrantRequestResponse>> + */ + public CompletableFuture> + getTemporaryGrantRequestWithHttpInfoAsync(UUID requestId) { + // Check if unstable operation is enabled + String operationId = "getTemporaryGrantRequest"; + 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 'requestId' is set + if (requestId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'requestId' when calling getTemporaryGrantRequest")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/usage/admin/temporary-grant-requests/{request_id}" + .replaceAll("\\{" + "request_id" + "\\}", apiClient.escapeString(requestId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.getTemporaryGrantRequest", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to getUsageApplicationSecurityMonitoring. */ + public static class GetUsageApplicationSecurityMonitoringOptionalParameters { + private OffsetDateTime endHr; + + /** + * Set endHr. + * + * @param endHr Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] + * for usage ending before this hour. (optional) + * @return GetUsageApplicationSecurityMonitoringOptionalParameters + */ + public GetUsageApplicationSecurityMonitoringOptionalParameters endHr(OffsetDateTime endHr) { + this.endHr = endHr; + return this; + } + } + + /** + * Get hourly usage for application security. + * + *

See {@link #getUsageApplicationSecurityMonitoringWithHttpInfo}. + * + * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] + * for usage beginning at this hour. (required) + * @return UsageApplicationSecurityMonitoringResponse + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public UsageApplicationSecurityMonitoringResponse getUsageApplicationSecurityMonitoring( + OffsetDateTime startHr) throws ApiException { + return getUsageApplicationSecurityMonitoringWithHttpInfo( + startHr, new GetUsageApplicationSecurityMonitoringOptionalParameters()) + .getData(); + } + + /** + * Get hourly usage for application security. + * + *

See {@link #getUsageApplicationSecurityMonitoringWithHttpInfoAsync}. + * + * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] + * for usage beginning at this hour. (required) + * @return CompletableFuture<UsageApplicationSecurityMonitoringResponse> + * @deprecated + */ + @Deprecated + public CompletableFuture + getUsageApplicationSecurityMonitoringAsync(OffsetDateTime startHr) { + return getUsageApplicationSecurityMonitoringWithHttpInfoAsync( + startHr, new GetUsageApplicationSecurityMonitoringOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get hourly usage for application security. + * + *

See {@link #getUsageApplicationSecurityMonitoringWithHttpInfo}. + * + * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] + * for usage beginning at this hour. (required) + * @param parameters Optional parameters for the request. + * @return UsageApplicationSecurityMonitoringResponse + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public UsageApplicationSecurityMonitoringResponse getUsageApplicationSecurityMonitoring( + OffsetDateTime startHr, GetUsageApplicationSecurityMonitoringOptionalParameters parameters) + throws ApiException { + return getUsageApplicationSecurityMonitoringWithHttpInfo(startHr, parameters).getData(); + } + + /** + * Get hourly usage for application security. + * + *

See {@link #getUsageApplicationSecurityMonitoringWithHttpInfoAsync}. + * + * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] + * for usage beginning at this hour. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<UsageApplicationSecurityMonitoringResponse> + * @deprecated + */ + @Deprecated + public CompletableFuture + getUsageApplicationSecurityMonitoringAsync( + OffsetDateTime startHr, + GetUsageApplicationSecurityMonitoringOptionalParameters parameters) { + return getUsageApplicationSecurityMonitoringWithHttpInfoAsync(startHr, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get hourly usage for application security . Note: This endpoint has been + * deprecated. Hourly usage data for all products is now available in the Get + * hourly usage by product family API + * + * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] + * for usage beginning at this hour. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<UsageApplicationSecurityMonitoringResponse> + * @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 - User is not authorized -
429 Too many requests -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse + getUsageApplicationSecurityMonitoringWithHttpInfo( + OffsetDateTime startHr, + GetUsageApplicationSecurityMonitoringOptionalParameters parameters) + throws ApiException { Object localVarPostBody = null; // verify the required parameter 'startHr' is set @@ -3812,74 +4626,692 @@ public UsageSummaryAvailableFieldsResponse getUsageSummaryAvailableFields() thro new GenericType() {}); } - /** Manage optional parameters to listQuotas. */ - public static class ListQuotasOptionalParameters { - private Boolean includeDescendants; - private String pageCursor; + /** Manage optional parameters to listMyTemporaryGrantRequests. */ + public static class ListMyTemporaryGrantRequestsOptionalParameters { + private TemporaryGrantRequestStatus filterStatus; private Long pageLimit; + private UUID pageCursor; /** - * Set includeDescendants. + * Set filterStatus. * - * @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 + * @param filterStatus Optional status. Defaults to all statuses. (optional) + * @return ListMyTemporaryGrantRequestsOptionalParameters + */ + public ListMyTemporaryGrantRequestsOptionalParameters filterStatus( + TemporaryGrantRequestStatus filterStatus) { + this.filterStatus = filterStatus; + return this; + } + + /** + * Set pageLimit. + * + * @param pageLimit Page size, from 1 to 100. (optional, default to 50) + * @return ListMyTemporaryGrantRequestsOptionalParameters + */ + public ListMyTemporaryGrantRequestsOptionalParameters pageLimit(Long pageLimit) { + this.pageLimit = pageLimit; + return this; + } + + /** + * Set pageCursor. + * + * @param pageCursor UUID cursor from meta.page.next_cursor. (optional) + * @return ListMyTemporaryGrantRequestsOptionalParameters + */ + public ListMyTemporaryGrantRequestsOptionalParameters pageCursor(UUID pageCursor) { + this.pageCursor = pageCursor; + return this; + } + } + + /** + * List your temporary grant requests. + * + *

See {@link #listMyTemporaryGrantRequestsWithHttpInfo}. + * + * @return TemporaryGrantRequestListResponse + * @throws ApiException if fails to make API call + */ + public TemporaryGrantRequestListResponse listMyTemporaryGrantRequests() throws ApiException { + return listMyTemporaryGrantRequestsWithHttpInfo( + new ListMyTemporaryGrantRequestsOptionalParameters()) + .getData(); + } + + /** + * List your temporary grant requests. + * + *

See {@link #listMyTemporaryGrantRequestsWithHttpInfoAsync}. + * + * @return CompletableFuture<TemporaryGrantRequestListResponse> + */ + public CompletableFuture listMyTemporaryGrantRequestsAsync() { + return listMyTemporaryGrantRequestsWithHttpInfoAsync( + new ListMyTemporaryGrantRequestsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List your temporary grant requests. + * + *

See {@link #listMyTemporaryGrantRequestsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return TemporaryGrantRequestListResponse + * @throws ApiException if fails to make API call + */ + public TemporaryGrantRequestListResponse listMyTemporaryGrantRequests( + ListMyTemporaryGrantRequestsOptionalParameters parameters) throws ApiException { + return listMyTemporaryGrantRequestsWithHttpInfo(parameters).getData(); + } + + /** + * List your temporary grant requests. + * + *

See {@link #listMyTemporaryGrantRequestsWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<TemporaryGrantRequestListResponse> + */ + public CompletableFuture listMyTemporaryGrantRequestsAsync( + ListMyTemporaryGrantRequestsOptionalParameters parameters) { + return listMyTemporaryGrantRequestsWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List your temporary grant requests. + * + *

See {@link #listMyTemporaryGrantRequestsWithHttpInfo}. + * + * @return PaginationIterable<TemporaryGrantRequestData> + */ + public PaginationIterable + listMyTemporaryGrantRequestsWithPagination() { + ListMyTemporaryGrantRequestsOptionalParameters parameters = + new ListMyTemporaryGrantRequestsOptionalParameters(); + return listMyTemporaryGrantRequestsWithPagination(parameters); + } + + /** + * List your temporary grant requests. + * + *

See {@link #listMyTemporaryGrantRequestsWithHttpInfo}. + * + * @return TemporaryGrantRequestListResponse + */ + public PaginationIterable listMyTemporaryGrantRequestsWithPagination( + ListMyTemporaryGrantRequestsOptionalParameters parameters) { + String resultsPath = "getData"; + String valueGetterPath = "getMeta.getPage.getNextCursor"; + String valueSetterPath = "pageCursor"; + Boolean valueSetterParamOptional = true; + Long limit; + + if (parameters.pageLimit == null) { + limit = 50l; + parameters.pageLimit(limit); + } else { + limit = parameters.pageLimit; + } + + LinkedHashMap args = new LinkedHashMap(); + args.put("optionalParams", parameters); + + PaginationIterable iterator = + new PaginationIterable( + this, + "listMyTemporaryGrantRequests", + resultsPath, + valueGetterPath, + valueSetterPath, + valueSetterParamOptional, + true, + true, + limit, + args, + 0); + + return iterator; + } + + /** + * List the authenticated user's own requests, including decided requests. Other users' requests + * are never included. Requires an authenticated human user. Service-account credentials aren't + * supported. Request status remains approved after the grant's expiry, revocation, or + * replacement. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<TemporaryGrantRequestListResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse listMyTemporaryGrantRequestsWithHttpInfo( + ListMyTemporaryGrantRequestsOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listMyTemporaryGrantRequests"; + 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; + TemporaryGrantRequestStatus filterStatus = parameters.filterStatus; + Long pageLimit = parameters.pageLimit; + UUID pageCursor = parameters.pageCursor; + // create path and map variables + String localVarPath = "/api/v2/usage/temporary-grant-requests"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[status]", filterStatus)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[cursor]", pageCursor)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.listMyTemporaryGrantRequests", + 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 your temporary grant requests. + * + *

See {@link #listMyTemporaryGrantRequestsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<TemporaryGrantRequestListResponse>> + */ + public CompletableFuture> + listMyTemporaryGrantRequestsWithHttpInfoAsync( + ListMyTemporaryGrantRequestsOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listMyTemporaryGrantRequests"; + 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; + TemporaryGrantRequestStatus filterStatus = parameters.filterStatus; + Long pageLimit = parameters.pageLimit; + UUID pageCursor = parameters.pageCursor; + // create path and map variables + String localVarPath = "/api/v2/usage/temporary-grant-requests"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[status]", filterStatus)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[cursor]", pageCursor)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.listMyTemporaryGrantRequests", + 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() {}); + } + + /** 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 + * billing_read or billing_edit permission. + * + * @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() {}); + } + + /** Manage optional parameters to listTemporaryGrantRequests. */ + public static class ListTemporaryGrantRequestsOptionalParameters { + private TemporaryGrantRequestStatus filterStatus; + private Long pageLimit; + private UUID pageCursor; + private UUID filterRequestedByUserId; + + /** + * Set filterStatus. + * + * @param filterStatus Optional status. Defaults to all statuses. (optional) + * @return ListTemporaryGrantRequestsOptionalParameters + */ + public ListTemporaryGrantRequestsOptionalParameters filterStatus( + TemporaryGrantRequestStatus filterStatus) { + this.filterStatus = filterStatus; + return this; + } + + /** + * Set pageLimit. + * + * @param pageLimit Page size, from 1 to 100. (optional, default to 50) + * @return ListTemporaryGrantRequestsOptionalParameters */ - public ListQuotasOptionalParameters includeDescendants(Boolean includeDescendants) { - this.includeDescendants = includeDescendants; + public ListTemporaryGrantRequestsOptionalParameters pageLimit(Long pageLimit) { + this.pageLimit = pageLimit; 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 + * @param pageCursor UUID cursor from meta.page.next_cursor. (optional) + * @return ListTemporaryGrantRequestsOptionalParameters */ - public ListQuotasOptionalParameters pageCursor(String pageCursor) { + public ListTemporaryGrantRequestsOptionalParameters pageCursor(UUID pageCursor) { this.pageCursor = pageCursor; return this; } /** - * Set pageLimit. + * Set filterRequestedByUserId. * - * @param pageLimit The number of usage quotas to return per page. (optional, default to 100) - * @return ListQuotasOptionalParameters + * @param filterRequestedByUserId Filter by requester UUID within the authenticated + * organization. (optional) + * @return ListTemporaryGrantRequestsOptionalParameters */ - public ListQuotasOptionalParameters pageLimit(Long pageLimit) { - this.pageLimit = pageLimit; + public ListTemporaryGrantRequestsOptionalParameters filterRequestedByUserId( + UUID filterRequestedByUserId) { + this.filterRequestedByUserId = filterRequestedByUserId; return this; } } /** - * List usage quotas. + * List organization temporary grant requests. * - *

See {@link #listQuotasWithHttpInfo}. + *

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

See {@link #listQuotasWithHttpInfoAsync}. + *

See {@link #listTemporaryGrantRequestsWithHttpInfoAsync}. * - * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. - * (required) - * @return CompletableFuture<UsageQuotasListResponse> + * @return CompletableFuture<TemporaryGrantRequestListResponse> */ - public CompletableFuture listQuotasAsync(String quotaNamespace) { - return listQuotasWithHttpInfoAsync(quotaNamespace, new ListQuotasOptionalParameters()) + public CompletableFuture listTemporaryGrantRequestsAsync() { + return listTemporaryGrantRequestsWithHttpInfoAsync( + new ListTemporaryGrantRequestsOptionalParameters()) .thenApply( response -> { return response.getData(); @@ -3887,34 +5319,30 @@ public CompletableFuture listQuotasAsync(String quotaNa } /** - * List usage quotas. + * List organization temporary grant requests. * - *

See {@link #listQuotasWithHttpInfo}. + *

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

See {@link #listQuotasWithHttpInfoAsync}. + *

See {@link #listTemporaryGrantRequestsWithHttpInfoAsync}. * - * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. - * (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<UsageQuotasListResponse> + * @return CompletableFuture<TemporaryGrantRequestListResponse> */ - public CompletableFuture listQuotasAsync( - String quotaNamespace, ListQuotasOptionalParameters parameters) { - return listQuotasWithHttpInfoAsync(quotaNamespace, parameters) + public CompletableFuture listTemporaryGrantRequestsAsync( + ListTemporaryGrantRequestsOptionalParameters parameters) { + return listTemporaryGrantRequestsWithHttpInfoAsync(parameters) .thenApply( response -> { return response.getData(); @@ -3922,31 +5350,27 @@ public CompletableFuture listQuotasAsync( } /** - * List usage quotas. + * List organization temporary grant requests. * - *

See {@link #listQuotasWithHttpInfo}. + *

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

See {@link #listQuotasWithHttpInfo}. + *

See {@link #listTemporaryGrantRequestsWithHttpInfo}. * - * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. - * (required) - * @return UsageQuotasListResponse + * @return TemporaryGrantRequestListResponse */ - public PaginationIterable listQuotasWithPagination( - String quotaNamespace, ListQuotasOptionalParameters parameters) { + public PaginationIterable listTemporaryGrantRequestsWithPagination( + ListTemporaryGrantRequestsOptionalParameters parameters) { String resultsPath = "getData"; String valueGetterPath = "getMeta.getPage.getNextCursor"; String valueSetterPath = "pageCursor"; @@ -3954,20 +5378,19 @@ public PaginationIterable listQuotasWithPagination( Long limit; if (parameters.pageLimit == null) { - limit = 100l; + limit = 50l; 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", + "listTemporaryGrantRequests", resultsPath, valueGetterPath, valueSetterPath, @@ -3982,14 +5405,13 @@ public PaginationIterable listQuotasWithPagination( } /** - * 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 - * billing_read or billing_edit permission. + * List all request statuses within the authenticated organization. Filter by pending status for + * the review queue. Requires Billing Edit, including for reads. Requires an authenticated human + * user. Service-account credentials are unsupported. Request status remains approved after + * expiry, revocation, or replacement. * - * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. - * (required) * @param parameters Optional parameters for the request. - * @return ApiResponse<UsageQuotasListResponse> + * @return ApiResponse<TemporaryGrantRequestListResponse> * @throws ApiException if fails to make API call * @http.response.details * @@ -3997,47 +5419,42 @@ public PaginationIterable listQuotasWithPagination( * * * + * * + * + * * *
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
*/ - public ApiResponse listQuotasWithHttpInfo( - String quotaNamespace, ListQuotasOptionalParameters parameters) throws ApiException { + public ApiResponse listTemporaryGrantRequestsWithHttpInfo( + ListTemporaryGrantRequestsOptionalParameters parameters) throws ApiException { // Check if unstable operation is enabled - String operationId = "listQuotas"; + String operationId = "listTemporaryGrantRequests"; 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; + TemporaryGrantRequestStatus filterStatus = parameters.filterStatus; Long pageLimit = parameters.pageLimit; + UUID pageCursor = parameters.pageCursor; + UUID filterRequestedByUserId = parameters.filterRequestedByUserId; // create path and map variables - String localVarPath = - "/api/v2/usage/quotas/{quota_namespace}" - .replaceAll( - "\\{" + "quota_namespace" + "\\}", - apiClient.escapeString(quotaNamespace.toString())); + String localVarPath = "/api/v2/usage/admin/temporary-grant-requests"; 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("", "filter[status]", filterStatus)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[cursor]", pageCursor)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[requested_by_user_id]", filterRequestedByUserId)); Invocation.Builder builder = apiClient.createBuilder( - "v2.UsageMeteringApi.listQuotas", + "v2.UsageMeteringApi.listTemporaryGrantRequests", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -4052,64 +5469,53 @@ public ApiResponse listQuotasWithHttpInfo( localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * List usage quotas. + * List organization temporary grant requests. * - *

See {@link #listQuotasWithHttpInfo}. + *

See {@link #listTemporaryGrantRequestsWithHttpInfo}. * - * @param quotaNamespace The product-specific namespace whose usage quotas are being managed. - * (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<UsageQuotasListResponse>> + * @return CompletableFuture<ApiResponse<TemporaryGrantRequestListResponse>> */ - public CompletableFuture> listQuotasWithHttpInfoAsync( - String quotaNamespace, ListQuotasOptionalParameters parameters) { + public CompletableFuture> + listTemporaryGrantRequestsWithHttpInfoAsync( + ListTemporaryGrantRequestsOptionalParameters parameters) { // Check if unstable operation is enabled - String operationId = "listQuotas"; + String operationId = "listTemporaryGrantRequests"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = new CompletableFuture<>(); + 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; + TemporaryGrantRequestStatus filterStatus = parameters.filterStatus; Long pageLimit = parameters.pageLimit; + UUID pageCursor = parameters.pageCursor; + UUID filterRequestedByUserId = parameters.filterRequestedByUserId; // create path and map variables - String localVarPath = - "/api/v2/usage/quotas/{quota_namespace}" - .replaceAll( - "\\{" + "quota_namespace" + "\\}", - apiClient.escapeString(quotaNamespace.toString())); + String localVarPath = "/api/v2/usage/admin/temporary-grant-requests"; 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("", "filter[status]", filterStatus)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[cursor]", pageCursor)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[requested_by_user_id]", filterRequestedByUserId)); Invocation.Builder builder; try { builder = apiClient.createBuilder( - "v2.UsageMeteringApi.listQuotas", + "v2.UsageMeteringApi.listTemporaryGrantRequests", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -4117,7 +5523,8 @@ public CompletableFuture> listQuotasWithHtt new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = + new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -4129,7 +5536,7 @@ public CompletableFuture> listQuotasWithHtt localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** @@ -4342,4 +5749,193 @@ public CompletableFuture> updateQuotaWithHttpInf false, new GenericType() {}); } + + /** + * Decide a temporary grant request. + * + *

See {@link #updateTemporaryGrantRequestWithHttpInfo}. + * + * @param requestId The temporary grant request UUID. (required) + * @param body (required) + * @return TemporaryGrantRequestResponse + * @throws ApiException if fails to make API call + */ + public TemporaryGrantRequestResponse updateTemporaryGrantRequest( + UUID requestId, TemporaryGrantRequestDecisionRequest body) throws ApiException { + return updateTemporaryGrantRequestWithHttpInfo(requestId, body).getData(); + } + + /** + * Decide a temporary grant request. + * + *

See {@link #updateTemporaryGrantRequestWithHttpInfoAsync}. + * + * @param requestId The temporary grant request UUID. (required) + * @param body (required) + * @return CompletableFuture<TemporaryGrantRequestResponse> + */ + public CompletableFuture updateTemporaryGrantRequestAsync( + UUID requestId, TemporaryGrantRequestDecisionRequest body) { + return updateTemporaryGrantRequestWithHttpInfoAsync(requestId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Approve or deny the submitted terms, which are immutable. Approval atomically writes the grant, + * audit record, and request decision. An expired request can't be approved. Requires the Billing + * Edit permission. Requires an authenticated human user. Service-account credentials aren't + * supported. Request status remains approved after the grant's expiry, revocation, or + * replacement. + * + * @param requestId The temporary grant request UUID. (required) + * @param body (required) + * @return ApiResponse<TemporaryGrantRequestResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse updateTemporaryGrantRequestWithHttpInfo( + UUID requestId, TemporaryGrantRequestDecisionRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateTemporaryGrantRequest"; + 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 'requestId' is set + if (requestId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'requestId' when calling updateTemporaryGrantRequest"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateTemporaryGrantRequest"); + } + // create path and map variables + String localVarPath = + "/api/v2/usage/admin/temporary-grant-requests/{request_id}/decision" + .replaceAll("\\{" + "request_id" + "\\}", apiClient.escapeString(requestId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.updateTemporaryGrantRequest", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Decide a temporary grant request. + * + *

See {@link #updateTemporaryGrantRequestWithHttpInfo}. + * + * @param requestId The temporary grant request UUID. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<TemporaryGrantRequestResponse>> + */ + public CompletableFuture> + updateTemporaryGrantRequestWithHttpInfoAsync( + UUID requestId, TemporaryGrantRequestDecisionRequest body) { + // Check if unstable operation is enabled + String operationId = "updateTemporaryGrantRequest"; + 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 'requestId' is set + if (requestId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'requestId' when calling" + + " updateTemporaryGrantRequest")); + 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 updateTemporaryGrantRequest")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/usage/admin/temporary-grant-requests/{request_id}/decision" + .replaceAll("\\{" + "request_id" + "\\}", apiClient.escapeString(requestId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.UsageMeteringApi.updateTemporaryGrantRequest", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestAttributes.java new file mode 100644 index 00000000000..67b0bc1e348 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestAttributes.java @@ -0,0 +1,456 @@ +/* + * 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.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** + * Request history and the linked grant state. List and detail reads include grant_state for + * approved requests. Decision responses record the decision. Read the request for current grant + * state. + */ +@JsonPropertyOrder({ + TemporaryGrantRequestAttributes.JSON_PROPERTY_CREATED_AT, + TemporaryGrantRequestAttributes.JSON_PROPERTY_DECIDED_AT, + TemporaryGrantRequestAttributes.JSON_PROPERTY_DECIDED_BY_USER_ID, + TemporaryGrantRequestAttributes.JSON_PROPERTY_ENTITY_KEY, + TemporaryGrantRequestAttributes.JSON_PROPERTY_EXPIRES_AT, + TemporaryGrantRequestAttributes.JSON_PROPERTY_GRANT_STATE, + TemporaryGrantRequestAttributes.JSON_PROPERTY_JUSTIFICATION, + TemporaryGrantRequestAttributes.JSON_PROPERTY_QUOTA_NAMESPACE, + TemporaryGrantRequestAttributes.JSON_PROPERTY_REQUESTED_BY_USER_ID, + TemporaryGrantRequestAttributes.JSON_PROPERTY_STATUS, + TemporaryGrantRequestAttributes.JSON_PROPERTY_TOTAL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TemporaryGrantRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_DECIDED_AT = "decided_at"; + private OffsetDateTime decidedAt; + + public static final String JSON_PROPERTY_DECIDED_BY_USER_ID = "decided_by_user_id"; + private UUID decidedByUserId; + + public static final String JSON_PROPERTY_ENTITY_KEY = "entity_key"; + private String entityKey; + + public static final String JSON_PROPERTY_EXPIRES_AT = "expires_at"; + private OffsetDateTime expiresAt; + + public static final String JSON_PROPERTY_GRANT_STATE = "grant_state"; + private TemporaryGrantRequestGrantState grantState; + + public static final String JSON_PROPERTY_JUSTIFICATION = "justification"; + private String justification; + + public static final String JSON_PROPERTY_QUOTA_NAMESPACE = "quota_namespace"; + private String quotaNamespace; + + public static final String JSON_PROPERTY_REQUESTED_BY_USER_ID = "requested_by_user_id"; + private UUID requestedByUserId; + + public static final String JSON_PROPERTY_STATUS = "status"; + private TemporaryGrantRequestStatus status; + + public static final String JSON_PROPERTY_TOTAL = "total"; + private Long total; + + public TemporaryGrantRequestAttributes() {} + + @JsonCreator + public TemporaryGrantRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_ENTITY_KEY) String entityKey, + @JsonProperty(required = true, value = JSON_PROPERTY_EXPIRES_AT) OffsetDateTime expiresAt, + @JsonProperty(required = true, value = JSON_PROPERTY_JUSTIFICATION) String justification, + @JsonProperty(required = true, value = JSON_PROPERTY_QUOTA_NAMESPACE) String quotaNamespace, + @JsonProperty(required = true, value = JSON_PROPERTY_REQUESTED_BY_USER_ID) + UUID requestedByUserId, + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) + TemporaryGrantRequestStatus status, + @JsonProperty(required = true, value = JSON_PROPERTY_TOTAL) Long total) { + this.createdAt = createdAt; + this.entityKey = entityKey; + this.expiresAt = expiresAt; + this.justification = justification; + this.quotaNamespace = quotaNamespace; + this.requestedByUserId = requestedByUserId; + this.status = status; + this.unparsed |= !status.isValid(); + this.total = total; + } + + public TemporaryGrantRequestAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When the request was submitted. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public TemporaryGrantRequestAttributes decidedAt(OffsetDateTime decidedAt) { + this.decidedAt = decidedAt; + return this; + } + + /** + * When the decision or cancellation was recorded. + * + * @return decidedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DECIDED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getDecidedAt() { + return decidedAt; + } + + public void setDecidedAt(OffsetDateTime decidedAt) { + this.decidedAt = decidedAt; + } + + public TemporaryGrantRequestAttributes decidedByUserId(UUID decidedByUserId) { + this.decidedByUserId = decidedByUserId; + return this; + } + + /** + * UUID of the reviewer, or of the requester if the request was canceled. + * + * @return decidedByUserId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DECIDED_BY_USER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getDecidedByUserId() { + return decidedByUserId; + } + + public void setDecidedByUserId(UUID decidedByUserId) { + this.decidedByUserId = decidedByUserId; + } + + public TemporaryGrantRequestAttributes entityKey(String entityKey) { + this.entityKey = entityKey; + return this; + } + + /** + * The requester identity resolved by the server. + * + * @return entityKey + */ + @JsonProperty(JSON_PROPERTY_ENTITY_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getEntityKey() { + return entityKey; + } + + public void setEntityKey(String entityKey) { + this.entityKey = entityKey; + } + + public TemporaryGrantRequestAttributes expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + * Immutable exclusive expiry, normalized to UTC microsecond precision. + * + * @return expiresAt + */ + @JsonProperty(JSON_PROPERTY_EXPIRES_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + public void setExpiresAt(OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + public TemporaryGrantRequestAttributes grantState(TemporaryGrantRequestGrantState grantState) { + this.grantState = grantState; + this.unparsed |= !grantState.isValid(); + return this; + } + + /** + * Current state of the grant associated with an approved request. Replaced means a newer grant + * superseded this grant. The newer grant might no longer be active. This field is absent for + * requests that weren't approved. + * + * @return grantState + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GRANT_STATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TemporaryGrantRequestGrantState getGrantState() { + return grantState; + } + + public void setGrantState(TemporaryGrantRequestGrantState grantState) { + if (!grantState.isValid()) { + this.unparsed = true; + } + this.grantState = grantState; + } + + public TemporaryGrantRequestAttributes justification(String justification) { + this.justification = justification; + return this; + } + + /** + * Reason for requesting temporary credits. Trimmed and limited to 4096 UTF-8 bytes. + * + * @return justification + */ + @JsonProperty(JSON_PROPERTY_JUSTIFICATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getJustification() { + return justification; + } + + public void setJustification(String justification) { + this.justification = justification; + } + + public TemporaryGrantRequestAttributes quotaNamespace(String quotaNamespace) { + this.quotaNamespace = quotaNamespace; + return this; + } + + /** + * The quota namespace. Only AI credits are supported. + * + * @return quotaNamespace + */ + @JsonProperty(JSON_PROPERTY_QUOTA_NAMESPACE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getQuotaNamespace() { + return quotaNamespace; + } + + public void setQuotaNamespace(String quotaNamespace) { + this.quotaNamespace = quotaNamespace; + } + + public TemporaryGrantRequestAttributes requestedByUserId(UUID requestedByUserId) { + this.requestedByUserId = requestedByUserId; + return this; + } + + /** + * UUID of the authenticated requester. + * + * @return requestedByUserId + */ + @JsonProperty(JSON_PROPERTY_REQUESTED_BY_USER_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getRequestedByUserId() { + return requestedByUserId; + } + + public void setRequestedByUserId(UUID requestedByUserId) { + this.requestedByUserId = requestedByUserId; + } + + public TemporaryGrantRequestAttributes status(TemporaryGrantRequestStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + return this; + } + + /** + * The durable request decision, independent of whether its grant is still active. + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TemporaryGrantRequestStatus getStatus() { + return status; + } + + public void setStatus(TemporaryGrantRequestStatus status) { + if (!status.isValid()) { + this.unparsed = true; + } + this.status = status; + } + + public TemporaryGrantRequestAttributes total(Long total) { + this.total = total; + return this; + } + + /** + * Target monthly AI credit limit in positive whole credits, not additional credits. Fractional + * credits are not accepted. minimum: 1 maximum: 9223372036854 + * + * @return total + */ + @JsonProperty(JSON_PROPERTY_TOTAL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + + /** + * 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 TemporaryGrantRequestAttributes + */ + @JsonAnySetter + public TemporaryGrantRequestAttributes 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 TemporaryGrantRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemporaryGrantRequestAttributes temporaryGrantRequestAttributes = + (TemporaryGrantRequestAttributes) o; + return Objects.equals(this.createdAt, temporaryGrantRequestAttributes.createdAt) + && Objects.equals(this.decidedAt, temporaryGrantRequestAttributes.decidedAt) + && Objects.equals(this.decidedByUserId, temporaryGrantRequestAttributes.decidedByUserId) + && Objects.equals(this.entityKey, temporaryGrantRequestAttributes.entityKey) + && Objects.equals(this.expiresAt, temporaryGrantRequestAttributes.expiresAt) + && Objects.equals(this.grantState, temporaryGrantRequestAttributes.grantState) + && Objects.equals(this.justification, temporaryGrantRequestAttributes.justification) + && Objects.equals(this.quotaNamespace, temporaryGrantRequestAttributes.quotaNamespace) + && Objects.equals(this.requestedByUserId, temporaryGrantRequestAttributes.requestedByUserId) + && Objects.equals(this.status, temporaryGrantRequestAttributes.status) + && Objects.equals(this.total, temporaryGrantRequestAttributes.total) + && Objects.equals( + this.additionalProperties, temporaryGrantRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + decidedAt, + decidedByUserId, + entityKey, + expiresAt, + grantState, + justification, + quotaNamespace, + requestedByUserId, + status, + total, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemporaryGrantRequestAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" decidedAt: ").append(toIndentedString(decidedAt)).append("\n"); + sb.append(" decidedByUserId: ").append(toIndentedString(decidedByUserId)).append("\n"); + sb.append(" entityKey: ").append(toIndentedString(entityKey)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" grantState: ").append(toIndentedString(grantState)).append("\n"); + sb.append(" justification: ").append(toIndentedString(justification)).append("\n"); + sb.append(" quotaNamespace: ").append(toIndentedString(quotaNamespace)).append("\n"); + sb.append(" requestedByUserId: ").append(toIndentedString(requestedByUserId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).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/TemporaryGrantRequestCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestCreateAttributes.java new file mode 100644 index 00000000000..26372ccca60 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestCreateAttributes.java @@ -0,0 +1,162 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.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.time.OffsetDateTime; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Immutable terms and justification for a temporary grant request. */ +@JsonPropertyOrder({ + TemporaryGrantRequestCreateAttributes.JSON_PROPERTY_EXPIRES_AT, + TemporaryGrantRequestCreateAttributes.JSON_PROPERTY_JUSTIFICATION, + TemporaryGrantRequestCreateAttributes.JSON_PROPERTY_TOTAL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TemporaryGrantRequestCreateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EXPIRES_AT = "expires_at"; + private JsonNullable expiresAt = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_JUSTIFICATION = "justification"; + private String justification; + + public static final String JSON_PROPERTY_TOTAL = "total"; + private Long total; + + public TemporaryGrantRequestCreateAttributes() {} + + @JsonCreator + public TemporaryGrantRequestCreateAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_JUSTIFICATION) String justification, + @JsonProperty(required = true, value = JSON_PROPERTY_TOTAL) Long total) { + this.justification = justification; + this.total = total; + } + + public TemporaryGrantRequestCreateAttributes expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = JsonNullable.of(expiresAt); + return this; + } + + /** + * Exclusive expiry. Must be a future timestamp with a timezone. Date-only values are rejected. If + * omitted or null, defaults to the next UTC month boundary. Approval accepts this deadline + * unchanged. + * + * @return expiresAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getExpiresAt() { + return expiresAt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EXPIRES_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getExpiresAt_JsonNullable() { + return expiresAt; + } + + @JsonProperty(JSON_PROPERTY_EXPIRES_AT) + public void setExpiresAt_JsonNullable(JsonNullable expiresAt) { + this.expiresAt = expiresAt; + } + + public void setExpiresAt(OffsetDateTime expiresAt) { + this.expiresAt = JsonNullable.of(expiresAt); + } + + public TemporaryGrantRequestCreateAttributes justification(String justification) { + this.justification = justification; + return this; + } + + /** + * Reason for requesting temporary credits. Trimmed and limited to 4096 UTF-8 bytes. + * + * @return justification + */ + @JsonProperty(JSON_PROPERTY_JUSTIFICATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getJustification() { + return justification; + } + + public void setJustification(String justification) { + this.justification = justification; + } + + public TemporaryGrantRequestCreateAttributes total(Long total) { + this.total = total; + return this; + } + + /** + * Target monthly AI credit limit in positive whole credits, not additional credits. Fractional + * credits are not accepted. minimum: 1 maximum: 9223372036854 + * + * @return total + */ + @JsonProperty(JSON_PROPERTY_TOTAL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + + /** Return true if this TemporaryGrantRequestCreateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemporaryGrantRequestCreateAttributes temporaryGrantRequestCreateAttributes = + (TemporaryGrantRequestCreateAttributes) o; + return Objects.equals(this.expiresAt, temporaryGrantRequestCreateAttributes.expiresAt) + && Objects.equals(this.justification, temporaryGrantRequestCreateAttributes.justification) + && Objects.equals(this.total, temporaryGrantRequestCreateAttributes.total); + } + + @Override + public int hashCode() { + return Objects.hash(expiresAt, justification, total); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemporaryGrantRequestCreateAttributes {\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" justification: ").append(toIndentedString(justification)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).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/TemporaryGrantRequestCreateData.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestCreateData.java new file mode 100644 index 00000000000..2a5f287e5a6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestCreateData.java @@ -0,0 +1,187 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The request resource to create. The server generates its ID. */ +@JsonPropertyOrder({ + TemporaryGrantRequestCreateData.JSON_PROPERTY_ATTRIBUTES, + TemporaryGrantRequestCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TemporaryGrantRequestCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TemporaryGrantRequestCreateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TemporaryGrantRequestType type = TemporaryGrantRequestType.TEMPORARY_GRANT_REQUESTS; + + public TemporaryGrantRequestCreateData() {} + + @JsonCreator + public TemporaryGrantRequestCreateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + TemporaryGrantRequestCreateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TemporaryGrantRequestType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TemporaryGrantRequestCreateData attributes( + TemporaryGrantRequestCreateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Immutable terms and justification for a temporary grant request. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TemporaryGrantRequestCreateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(TemporaryGrantRequestCreateAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public TemporaryGrantRequestCreateData type(TemporaryGrantRequestType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The temporary grant request resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TemporaryGrantRequestType getType() { + return type; + } + + public void setType(TemporaryGrantRequestType 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 TemporaryGrantRequestCreateData + */ + @JsonAnySetter + public TemporaryGrantRequestCreateData 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 TemporaryGrantRequestCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemporaryGrantRequestCreateData temporaryGrantRequestCreateData = + (TemporaryGrantRequestCreateData) o; + return Objects.equals(this.attributes, temporaryGrantRequestCreateData.attributes) + && Objects.equals(this.type, temporaryGrantRequestCreateData.type) + && Objects.equals( + this.additionalProperties, temporaryGrantRequestCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemporaryGrantRequestCreateData {\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/TemporaryGrantRequestCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestCreateRequest.java new file mode 100644 index 00000000000..00ab5e4d6cc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestCreateRequest.java @@ -0,0 +1,151 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Create a request for the authenticated human user. */ +@JsonPropertyOrder({TemporaryGrantRequestCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TemporaryGrantRequestCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TemporaryGrantRequestCreateData data; + + public TemporaryGrantRequestCreateRequest() {} + + @JsonCreator + public TemporaryGrantRequestCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + TemporaryGrantRequestCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public TemporaryGrantRequestCreateRequest data(TemporaryGrantRequestCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The request resource to create. The server generates its ID. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TemporaryGrantRequestCreateData getData() { + return data; + } + + public void setData(TemporaryGrantRequestCreateData 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 TemporaryGrantRequestCreateRequest + */ + @JsonAnySetter + public TemporaryGrantRequestCreateRequest 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 TemporaryGrantRequestCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemporaryGrantRequestCreateRequest temporaryGrantRequestCreateRequest = + (TemporaryGrantRequestCreateRequest) o; + return Objects.equals(this.data, temporaryGrantRequestCreateRequest.data) + && Objects.equals( + this.additionalProperties, temporaryGrantRequestCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemporaryGrantRequestCreateRequest {\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/TemporaryGrantRequestData.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestData.java new file mode 100644 index 00000000000..56427325481 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestData.java @@ -0,0 +1,216 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** A temporary grant request resource. */ +@JsonPropertyOrder({ + TemporaryGrantRequestData.JSON_PROPERTY_ATTRIBUTES, + TemporaryGrantRequestData.JSON_PROPERTY_ID, + TemporaryGrantRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TemporaryGrantRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TemporaryGrantRequestAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TemporaryGrantRequestType type = TemporaryGrantRequestType.TEMPORARY_GRANT_REQUESTS; + + public TemporaryGrantRequestData() {} + + @JsonCreator + public TemporaryGrantRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + TemporaryGrantRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TemporaryGrantRequestType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TemporaryGrantRequestData attributes(TemporaryGrantRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Request history and the linked grant state. List and detail reads include grant_state for + * approved requests. Decision responses record the decision. Read the request for current grant + * state. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TemporaryGrantRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(TemporaryGrantRequestAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public TemporaryGrantRequestData id(UUID id) { + this.id = id; + return this; + } + + /** + * Server-generated request UUID. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public TemporaryGrantRequestData type(TemporaryGrantRequestType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The temporary grant request resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TemporaryGrantRequestType getType() { + return type; + } + + public void setType(TemporaryGrantRequestType 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 TemporaryGrantRequestData + */ + @JsonAnySetter + public TemporaryGrantRequestData 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 TemporaryGrantRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemporaryGrantRequestData temporaryGrantRequestData = (TemporaryGrantRequestData) o; + return Objects.equals(this.attributes, temporaryGrantRequestData.attributes) + && Objects.equals(this.id, temporaryGrantRequestData.id) + && Objects.equals(this.type, temporaryGrantRequestData.type) + && Objects.equals( + this.additionalProperties, temporaryGrantRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemporaryGrantRequestData {\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/TemporaryGrantRequestDecision.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestDecision.java new file mode 100644 index 00000000000..9c6a0c2ace2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestDecision.java @@ -0,0 +1,59 @@ +/* + * 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; + +/** Approve the exact submitted total and expiry, or deny the request. */ +@JsonSerialize(using = TemporaryGrantRequestDecision.TemporaryGrantRequestDecisionSerializer.class) +public class TemporaryGrantRequestDecision extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("approved", "denied")); + + public static final TemporaryGrantRequestDecision APPROVED = + new TemporaryGrantRequestDecision("approved"); + public static final TemporaryGrantRequestDecision DENIED = + new TemporaryGrantRequestDecision("denied"); + + TemporaryGrantRequestDecision(String value) { + super(value, allowedValues); + } + + public static class TemporaryGrantRequestDecisionSerializer + extends StdSerializer { + public TemporaryGrantRequestDecisionSerializer(Class t) { + super(t); + } + + public TemporaryGrantRequestDecisionSerializer() { + this(null); + } + + @Override + public void serialize( + TemporaryGrantRequestDecision value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TemporaryGrantRequestDecision fromValue(String value) { + return new TemporaryGrantRequestDecision(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestDecisionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestDecisionAttributes.java new file mode 100644 index 00000000000..8ae671e5054 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestDecisionAttributes.java @@ -0,0 +1,99 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** + * Binary decision. Overrides, reason fields, and unknown attributes are rejected, including null + * values. + */ +@JsonPropertyOrder({TemporaryGrantRequestDecisionAttributes.JSON_PROPERTY_DECISION}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TemporaryGrantRequestDecisionAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DECISION = "decision"; + private TemporaryGrantRequestDecision decision; + + public TemporaryGrantRequestDecisionAttributes() {} + + @JsonCreator + public TemporaryGrantRequestDecisionAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_DECISION) + TemporaryGrantRequestDecision decision) { + this.decision = decision; + this.unparsed |= !decision.isValid(); + } + + public TemporaryGrantRequestDecisionAttributes decision(TemporaryGrantRequestDecision decision) { + this.decision = decision; + this.unparsed |= !decision.isValid(); + return this; + } + + /** + * Approve the exact submitted total and expiry, or deny the request. + * + * @return decision + */ + @JsonProperty(JSON_PROPERTY_DECISION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TemporaryGrantRequestDecision getDecision() { + return decision; + } + + public void setDecision(TemporaryGrantRequestDecision decision) { + if (!decision.isValid()) { + this.unparsed = true; + } + this.decision = decision; + } + + /** Return true if this TemporaryGrantRequestDecisionAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemporaryGrantRequestDecisionAttributes temporaryGrantRequestDecisionAttributes = + (TemporaryGrantRequestDecisionAttributes) o; + return Objects.equals(this.decision, temporaryGrantRequestDecisionAttributes.decision); + } + + @Override + public int hashCode() { + return Objects.hash(decision); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemporaryGrantRequestDecisionAttributes {\n"); + sb.append(" decision: ").append(toIndentedString(decision)).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/TemporaryGrantRequestDecisionData.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestDecisionData.java new file mode 100644 index 00000000000..6d8ff6a594b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestDecisionData.java @@ -0,0 +1,218 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** A decision on a pending request. */ +@JsonPropertyOrder({ + TemporaryGrantRequestDecisionData.JSON_PROPERTY_ATTRIBUTES, + TemporaryGrantRequestDecisionData.JSON_PROPERTY_ID, + TemporaryGrantRequestDecisionData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TemporaryGrantRequestDecisionData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TemporaryGrantRequestDecisionAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TemporaryGrantRequestType type = TemporaryGrantRequestType.TEMPORARY_GRANT_REQUESTS; + + public TemporaryGrantRequestDecisionData() {} + + @JsonCreator + public TemporaryGrantRequestDecisionData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + TemporaryGrantRequestDecisionAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TemporaryGrantRequestType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TemporaryGrantRequestDecisionData attributes( + TemporaryGrantRequestDecisionAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Binary decision. Overrides, reason fields, and unknown attributes are rejected, including null + * values. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TemporaryGrantRequestDecisionAttributes getAttributes() { + return attributes; + } + + public void setAttributes(TemporaryGrantRequestDecisionAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public TemporaryGrantRequestDecisionData id(UUID id) { + this.id = id; + return this; + } + + /** + * Request UUID. Must match request_id in the path. Missing or mismatched IDs return 400 Bad + * Request. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public TemporaryGrantRequestDecisionData type(TemporaryGrantRequestType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The temporary grant request resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TemporaryGrantRequestType getType() { + return type; + } + + public void setType(TemporaryGrantRequestType 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 TemporaryGrantRequestDecisionData + */ + @JsonAnySetter + public TemporaryGrantRequestDecisionData 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 TemporaryGrantRequestDecisionData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemporaryGrantRequestDecisionData temporaryGrantRequestDecisionData = + (TemporaryGrantRequestDecisionData) o; + return Objects.equals(this.attributes, temporaryGrantRequestDecisionData.attributes) + && Objects.equals(this.id, temporaryGrantRequestDecisionData.id) + && Objects.equals(this.type, temporaryGrantRequestDecisionData.type) + && Objects.equals( + this.additionalProperties, temporaryGrantRequestDecisionData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemporaryGrantRequestDecisionData {\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/TemporaryGrantRequestDecisionRequest.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestDecisionRequest.java new file mode 100644 index 00000000000..2b61cbcd444 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestDecisionRequest.java @@ -0,0 +1,151 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Approve or deny a pending request. */ +@JsonPropertyOrder({TemporaryGrantRequestDecisionRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TemporaryGrantRequestDecisionRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TemporaryGrantRequestDecisionData data; + + public TemporaryGrantRequestDecisionRequest() {} + + @JsonCreator + public TemporaryGrantRequestDecisionRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + TemporaryGrantRequestDecisionData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public TemporaryGrantRequestDecisionRequest data(TemporaryGrantRequestDecisionData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A decision on a pending request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TemporaryGrantRequestDecisionData getData() { + return data; + } + + public void setData(TemporaryGrantRequestDecisionData 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 TemporaryGrantRequestDecisionRequest + */ + @JsonAnySetter + public TemporaryGrantRequestDecisionRequest 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 TemporaryGrantRequestDecisionRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemporaryGrantRequestDecisionRequest temporaryGrantRequestDecisionRequest = + (TemporaryGrantRequestDecisionRequest) o; + return Objects.equals(this.data, temporaryGrantRequestDecisionRequest.data) + && Objects.equals( + this.additionalProperties, temporaryGrantRequestDecisionRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemporaryGrantRequestDecisionRequest {\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/TemporaryGrantRequestGrantState.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestGrantState.java new file mode 100644 index 00000000000..60e7fb86400 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestGrantState.java @@ -0,0 +1,68 @@ +/* + * 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; + +/** + * Current state of the grant associated with an approved request. Replaced means a newer grant + * superseded this grant. The newer grant might no longer be active. This field is absent for + * requests that weren't approved. + */ +@JsonSerialize( + using = TemporaryGrantRequestGrantState.TemporaryGrantRequestGrantStateSerializer.class) +public class TemporaryGrantRequestGrantState extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("active", "expired", "revoked", "replaced")); + + public static final TemporaryGrantRequestGrantState ACTIVE = + new TemporaryGrantRequestGrantState("active"); + public static final TemporaryGrantRequestGrantState EXPIRED = + new TemporaryGrantRequestGrantState("expired"); + public static final TemporaryGrantRequestGrantState REVOKED = + new TemporaryGrantRequestGrantState("revoked"); + public static final TemporaryGrantRequestGrantState REPLACED = + new TemporaryGrantRequestGrantState("replaced"); + + TemporaryGrantRequestGrantState(String value) { + super(value, allowedValues); + } + + public static class TemporaryGrantRequestGrantStateSerializer + extends StdSerializer { + public TemporaryGrantRequestGrantStateSerializer(Class t) { + super(t); + } + + public TemporaryGrantRequestGrantStateSerializer() { + this(null); + } + + @Override + public void serialize( + TemporaryGrantRequestGrantState value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TemporaryGrantRequestGrantState fromValue(String value) { + return new TemporaryGrantRequestGrantState(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestListMeta.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestListMeta.java new file mode 100644 index 00000000000..df8bcbff12c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestListMeta.java @@ -0,0 +1,149 @@ +/* + * 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. */ +@JsonPropertyOrder({TemporaryGrantRequestListMeta.JSON_PROPERTY_PAGE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TemporaryGrantRequestListMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PAGE = "page"; + private TemporaryGrantRequestPage page; + + public TemporaryGrantRequestListMeta() {} + + @JsonCreator + public TemporaryGrantRequestListMeta( + @JsonProperty(required = true, value = JSON_PROPERTY_PAGE) TemporaryGrantRequestPage page) { + this.page = page; + this.unparsed |= page.unparsed; + } + + public TemporaryGrantRequestListMeta page(TemporaryGrantRequestPage page) { + this.page = page; + this.unparsed |= page.unparsed; + return this; + } + + /** + * UUID cursor pagination. A full final page can return a cursor followed by an empty page. + * + * @return page + */ + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TemporaryGrantRequestPage getPage() { + return page; + } + + public void setPage(TemporaryGrantRequestPage 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 TemporaryGrantRequestListMeta + */ + @JsonAnySetter + public TemporaryGrantRequestListMeta 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 TemporaryGrantRequestListMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemporaryGrantRequestListMeta temporaryGrantRequestListMeta = (TemporaryGrantRequestListMeta) o; + return Objects.equals(this.page, temporaryGrantRequestListMeta.page) + && Objects.equals( + this.additionalProperties, temporaryGrantRequestListMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(page, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemporaryGrantRequestListMeta {\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/TemporaryGrantRequestListResponse.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestListResponse.java new file mode 100644 index 00000000000..a8c30aff9fe --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestListResponse.java @@ -0,0 +1,201 @@ +/* + * 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 page of temporary grant requests, ordered by UUID rather than creation time. */ +@JsonPropertyOrder({ + TemporaryGrantRequestListResponse.JSON_PROPERTY_DATA, + TemporaryGrantRequestListResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TemporaryGrantRequestListResponse { + @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 TemporaryGrantRequestListMeta meta; + + public TemporaryGrantRequestListResponse() {} + + @JsonCreator + public TemporaryGrantRequestListResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data, + @JsonProperty(required = true, value = JSON_PROPERTY_META) + TemporaryGrantRequestListMeta meta) { + this.data = data; + for (TemporaryGrantRequestData item : data) { + this.unparsed |= item.unparsed; + } + this.meta = meta; + this.unparsed |= meta.unparsed; + } + + public TemporaryGrantRequestListResponse data(List data) { + this.data = data; + for (TemporaryGrantRequestData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TemporaryGrantRequestListResponse addDataItem(TemporaryGrantRequestData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Requests visible to the authenticated caller. + * + * @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 (TemporaryGrantRequestData item : data) { + this.unparsed |= item.unparsed; + } + } + } + + public TemporaryGrantRequestListResponse meta(TemporaryGrantRequestListMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Pagination metadata. + * + * @return meta + */ + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TemporaryGrantRequestListMeta getMeta() { + return meta; + } + + public void setMeta(TemporaryGrantRequestListMeta 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 TemporaryGrantRequestListResponse + */ + @JsonAnySetter + public TemporaryGrantRequestListResponse 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 TemporaryGrantRequestListResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemporaryGrantRequestListResponse temporaryGrantRequestListResponse = + (TemporaryGrantRequestListResponse) o; + return Objects.equals(this.data, temporaryGrantRequestListResponse.data) + && Objects.equals(this.meta, temporaryGrantRequestListResponse.meta) + && Objects.equals( + this.additionalProperties, temporaryGrantRequestListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemporaryGrantRequestListResponse {\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/TemporaryGrantRequestPage.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestPage.java new file mode 100644 index 00000000000..20f831e174e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestPage.java @@ -0,0 +1,137 @@ +/* + * 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 java.util.UUID; + +/** UUID cursor pagination. A full final page can return a cursor followed by an empty page. */ +@JsonPropertyOrder({TemporaryGrantRequestPage.JSON_PROPERTY_NEXT_CURSOR}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TemporaryGrantRequestPage { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NEXT_CURSOR = "next_cursor"; + private UUID nextCursor; + + public TemporaryGrantRequestPage nextCursor(UUID nextCursor) { + this.nextCursor = nextCursor; + return this; + } + + /** + * Use this UUID as page[cursor] to retrieve the next page. Omitted when the page is not full. + * + * @return nextCursor + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NEXT_CURSOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getNextCursor() { + return nextCursor; + } + + public void setNextCursor(UUID 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 TemporaryGrantRequestPage + */ + @JsonAnySetter + public TemporaryGrantRequestPage 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 TemporaryGrantRequestPage object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemporaryGrantRequestPage temporaryGrantRequestPage = (TemporaryGrantRequestPage) o; + return Objects.equals(this.nextCursor, temporaryGrantRequestPage.nextCursor) + && Objects.equals( + this.additionalProperties, temporaryGrantRequestPage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(nextCursor, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemporaryGrantRequestPage {\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/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestResponse.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestResponse.java new file mode 100644 index 00000000000..4567ce968a8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestResponse.java @@ -0,0 +1,149 @@ +/* + * 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 single temporary grant request. */ +@JsonPropertyOrder({TemporaryGrantRequestResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TemporaryGrantRequestResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TemporaryGrantRequestData data; + + public TemporaryGrantRequestResponse() {} + + @JsonCreator + public TemporaryGrantRequestResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) TemporaryGrantRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public TemporaryGrantRequestResponse data(TemporaryGrantRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A temporary grant request resource. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TemporaryGrantRequestData getData() { + return data; + } + + public void setData(TemporaryGrantRequestData 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 TemporaryGrantRequestResponse + */ + @JsonAnySetter + public TemporaryGrantRequestResponse 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 TemporaryGrantRequestResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemporaryGrantRequestResponse temporaryGrantRequestResponse = (TemporaryGrantRequestResponse) o; + return Objects.equals(this.data, temporaryGrantRequestResponse.data) + && Objects.equals( + this.additionalProperties, temporaryGrantRequestResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemporaryGrantRequestResponse {\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/TemporaryGrantRequestStatus.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestStatus.java new file mode 100644 index 00000000000..c2a93950760 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestStatus.java @@ -0,0 +1,63 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The durable request decision, independent of whether its grant is still active. */ +@JsonSerialize(using = TemporaryGrantRequestStatus.TemporaryGrantRequestStatusSerializer.class) +public class TemporaryGrantRequestStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("pending", "approved", "denied", "cancelled")); + + public static final TemporaryGrantRequestStatus PENDING = + new TemporaryGrantRequestStatus("pending"); + public static final TemporaryGrantRequestStatus APPROVED = + new TemporaryGrantRequestStatus("approved"); + public static final TemporaryGrantRequestStatus DENIED = + new TemporaryGrantRequestStatus("denied"); + public static final TemporaryGrantRequestStatus CANCELLED = + new TemporaryGrantRequestStatus("cancelled"); + + TemporaryGrantRequestStatus(String value) { + super(value, allowedValues); + } + + public static class TemporaryGrantRequestStatusSerializer + extends StdSerializer { + public TemporaryGrantRequestStatusSerializer(Class t) { + super(t); + } + + public TemporaryGrantRequestStatusSerializer() { + this(null); + } + + @Override + public void serialize( + TemporaryGrantRequestStatus value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TemporaryGrantRequestStatus fromValue(String value) { + return new TemporaryGrantRequestStatus(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestType.java b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestType.java new file mode 100644 index 00000000000..672e79b15af --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TemporaryGrantRequestType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The temporary grant request resource type. */ +@JsonSerialize(using = TemporaryGrantRequestType.TemporaryGrantRequestTypeSerializer.class) +public class TemporaryGrantRequestType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("temporary_grant_requests")); + + public static final TemporaryGrantRequestType TEMPORARY_GRANT_REQUESTS = + new TemporaryGrantRequestType("temporary_grant_requests"); + + TemporaryGrantRequestType(String value) { + super(value, allowedValues); + } + + public static class TemporaryGrantRequestTypeSerializer + extends StdSerializer { + public TemporaryGrantRequestTypeSerializer(Class t) { + super(t); + } + + public TemporaryGrantRequestTypeSerializer() { + this(null); + } + + @Override + public void serialize( + TemporaryGrantRequestType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TemporaryGrantRequestType fromValue(String value) { + return new TemporaryGrantRequestType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 133777e08d8..05c5655fc6c 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/given.json @@ -2126,6 +2126,18 @@ "tag": "Teams", "operationId": "CreateTeamNotificationRule" }, + { + "parameters": [ + { + "name": "body", + "value": "{\"data\": {\"type\": \"temporary_grant_requests\", \"attributes\": {\"total\": 200, \"justification\": \"Credits needed for {{ unique }}.\"}}}" + } + ], + "step": "there is a valid \"temporary_grant_request\" in the system", + "key": "temporary_grant_request", + "tag": "Usage Metering", + "operationId": "CreateTemporaryGrantRequest" + }, { "parameters": [ { diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 45b82eb3cd7..e3fceb02026 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 @@ -11150,6 +11150,30 @@ "type": "safe" } }, + "ListTemporaryGrantRequests": { + "tag": "Usage Metering", + "undo": { + "type": "safe" + } + }, + "GetTemporaryGrantRequest": { + "tag": "Usage Metering", + "undo": { + "type": "safe" + } + }, + "UpdateTemporaryGrantRequest": { + "tag": "Usage Metering", + "undo": { + "type": "idempotent" + } + }, + "DeleteRequestedTemporaryGrant": { + "tag": "Usage Metering", + "undo": { + "type": "idempotent" + } + }, "GetUsageApplicationSecurityMonitoring": { "tag": "Usage Metering", "undo": { @@ -11240,6 +11264,37 @@ "type": "safe" } }, + "ListMyTemporaryGrantRequests": { + "tag": "Usage Metering", + "undo": { + "type": "safe" + } + }, + "CreateTemporaryGrantRequest": { + "tag": "Usage Metering", + "undo": { + "operationId": "DeleteTemporaryGrantRequest", + "parameters": [ + { + "name": "request_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteTemporaryGrantRequest": { + "tag": "Usage Metering", + "undo": { + "type": "idempotent" + } + }, + "GetMyTemporaryGrantRequest": { + "tag": "Usage Metering", + "undo": { + "type": "safe" + } + }, "GetUsageAttributionTypes": { "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 9fd783ecd66..3e420970e74 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 @@ -41,6 +41,70 @@ Feature: Usage Metering When the request is sent Then the response status is 404 Not Found + @generated @skip @team:ddoghq/billing-hub + Scenario: Cancel your temporary grant request returns "Bad Request" response + Given operation "DeleteTemporaryGrantRequest" enabled + And new "DeleteTemporaryGrantRequest" request + And request contains "request_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/billing-hub + Scenario: Cancel your temporary grant request returns "Conflict" response + Given operation "DeleteTemporaryGrantRequest" enabled + And new "DeleteTemporaryGrantRequest" request + And request contains "request_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:ddoghq/billing-hub + Scenario: Cancel your temporary grant request returns "No Content" response + Given operation "DeleteTemporaryGrantRequest" enabled + And new "DeleteTemporaryGrantRequest" request + And request contains "request_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 your temporary grant request returns "Not Found" response + Given operation "DeleteTemporaryGrantRequest" enabled + And new "DeleteTemporaryGrantRequest" request + And request contains "request_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 a temporary grant request returns "Bad Request" response + Given operation "CreateTemporaryGrantRequest" enabled + And new "CreateTemporaryGrantRequest" request + And body with value {"data": {"attributes": {"expires_at": "2028-02-16T00:00:00Z", "justification": "Credits needed to finish the incident investigation.", "total": 200}, "type": "temporary_grant_requests"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/billing-hub + Scenario: Create a temporary grant request returns "Conflict" response + Given operation "CreateTemporaryGrantRequest" enabled + And new "CreateTemporaryGrantRequest" request + And body with value {"data": {"attributes": {"expires_at": "2028-02-16T00:00:00Z", "justification": "Credits needed to finish the incident investigation.", "total": 200}, "type": "temporary_grant_requests"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:ddoghq/billing-hub + Scenario: Create a temporary grant request returns "Created" response + Given operation "CreateTemporaryGrantRequest" enabled + And new "CreateTemporaryGrantRequest" request + And body with value {"data": {"attributes": {"expires_at": "2028-02-16T00:00:00Z", "justification": "Credits needed to finish the incident investigation.", "total": 200}, "type": "temporary_grant_requests"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:ddoghq/billing-hub + Scenario: Create a temporary grant request returns "Not Found" response + Given operation "CreateTemporaryGrantRequest" enabled + And new "CreateTemporaryGrantRequest" request + And body with value {"data": {"attributes": {"expires_at": "2028-02-16T00:00:00Z", "justification": "Credits needed to finish the incident investigation.", "total": 200}, "type": "temporary_grant_requests"}} + 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 @@ -59,6 +123,44 @@ Feature: Usage Metering 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. + @generated @skip @team:ddoghq/billing-hub + Scenario: Decide a temporary grant request returns "Bad Request" response + Given operation "UpdateTemporaryGrantRequest" enabled + And new "UpdateTemporaryGrantRequest" request + And request contains "request_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"decision": "approved"}, "id": "12345678-1234-1234-1234-123456789012", "type": "temporary_grant_requests"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/billing-hub + Scenario: Decide a temporary grant request returns "Conflict" response + Given operation "UpdateTemporaryGrantRequest" enabled + And new "UpdateTemporaryGrantRequest" request + And request contains "request_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"decision": "approved"}, "id": "12345678-1234-1234-1234-123456789012", "type": "temporary_grant_requests"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:ddoghq/billing-hub + Scenario: Decide a temporary grant request returns "Not Found" response + Given operation "UpdateTemporaryGrantRequest" enabled + And new "UpdateTemporaryGrantRequest" request + And request contains "request_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"decision": "approved"}, "id": "12345678-1234-1234-1234-123456789012", "type": "temporary_grant_requests"}} + When the request is sent + Then the response status is 404 Not Found + + @team:ddoghq/billing-hub + Scenario: Decide a temporary grant request returns "OK" response + Given operation "UpdateTemporaryGrantRequest" enabled + And there is a valid "temporary_grant_request" in the system + And new "UpdateTemporaryGrantRequest" request + And request contains "request_id" parameter from "temporary_grant_request.data.id" + And body with value {"data": {"attributes": {"decision": "denied"}, "id": "{{ temporary_grant_request.data.id }}", "type": "temporary_grant_requests"}} + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "temporary_grant_request.data.id" + @generated @skip @team:ddoghq/billing-hub Scenario: Delete a usage quota returns "No Content" response Given operation "DeleteQuota" enabled @@ -107,6 +209,40 @@ Feature: Usage Metering When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/billing-hub + Scenario: Get an organization temporary grant request returns "Bad Request" response + Given operation "GetTemporaryGrantRequest" enabled + And new "GetTemporaryGrantRequest" request + And request contains "request_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/billing-hub + Scenario: Get an organization temporary grant request returns "Conflict" response + Given operation "GetTemporaryGrantRequest" enabled + And new "GetTemporaryGrantRequest" request + And request contains "request_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:ddoghq/billing-hub + Scenario: Get an organization temporary grant request returns "Not Found" response + Given operation "GetTemporaryGrantRequest" enabled + And new "GetTemporaryGrantRequest" request + And request contains "request_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:ddoghq/billing-hub + Scenario: Get an organization temporary grant request returns "OK" response + Given operation "GetTemporaryGrantRequest" enabled + And there is a valid "temporary_grant_request" in the system + And new "GetTemporaryGrantRequest" request + And request contains "request_id" parameter from "temporary_grant_request.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "temporary_grant_request.data.id" + @team:ddoghq/billing-hub Scenario: Get available fields for usage summary returns "Bad Request" response Given new "GetUsageSummaryAvailableFields" request @@ -289,6 +425,40 @@ Feature: Usage Metering When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/billing-hub + Scenario: Get your temporary grant request returns "Bad Request" response + Given operation "GetMyTemporaryGrantRequest" enabled + And new "GetMyTemporaryGrantRequest" request + And request contains "request_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/billing-hub + Scenario: Get your temporary grant request returns "Conflict" response + Given operation "GetMyTemporaryGrantRequest" enabled + And new "GetMyTemporaryGrantRequest" request + And request contains "request_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:ddoghq/billing-hub + Scenario: Get your temporary grant request returns "Not Found" response + Given operation "GetMyTemporaryGrantRequest" enabled + And new "GetMyTemporaryGrantRequest" request + And request contains "request_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:ddoghq/billing-hub + Scenario: Get your temporary grant request returns "OK" response + Given operation "GetMyTemporaryGrantRequest" enabled + And there is a valid "temporary_grant_request" in the system + And new "GetMyTemporaryGrantRequest" request + And request contains "request_id" parameter from "temporary_grant_request.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" has the same value as "temporary_grant_request.data.id" + @team:ddoghq/billing-hub Scenario: GetEstimatedCostByOrg with both start_month and start_date returns "Bad Request" response Given new "GetEstimatedCostByOrg" request @@ -306,6 +476,41 @@ Feature: Usage Metering When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/billing-hub + Scenario: List organization temporary grant requests returns "Bad Request" response + Given operation "ListTemporaryGrantRequests" enabled + And new "ListTemporaryGrantRequests" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/billing-hub + Scenario: List organization temporary grant requests returns "Conflict" response + Given operation "ListTemporaryGrantRequests" enabled + And new "ListTemporaryGrantRequests" request + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:ddoghq/billing-hub + Scenario: List organization temporary grant requests returns "Not Found" response + Given operation "ListTemporaryGrantRequests" enabled + And new "ListTemporaryGrantRequests" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/billing-hub + Scenario: List organization temporary grant requests returns "OK" response + Given operation "ListTemporaryGrantRequests" enabled + And new "ListTemporaryGrantRequests" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/billing-hub @with-pagination + Scenario: List organization temporary grant requests returns "OK" response with pagination + Given operation "ListTemporaryGrantRequests" enabled + And new "ListTemporaryGrantRequests" request + When the request with pagination is sent + Then the response status is 200 OK + @generated @skip @team:ddoghq/billing-hub Scenario: List usage quotas returns "Bad Request" response Given operation "ListQuotas" enabled @@ -330,6 +535,73 @@ Feature: Usage Metering When the request with pagination is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/billing-hub + Scenario: List your temporary grant requests returns "Bad Request" response + Given operation "ListMyTemporaryGrantRequests" enabled + And new "ListMyTemporaryGrantRequests" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/billing-hub + Scenario: List your temporary grant requests returns "Conflict" response + Given operation "ListMyTemporaryGrantRequests" enabled + And new "ListMyTemporaryGrantRequests" request + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:ddoghq/billing-hub + Scenario: List your temporary grant requests returns "Not Found" response + Given operation "ListMyTemporaryGrantRequests" enabled + And new "ListMyTemporaryGrantRequests" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/billing-hub + Scenario: List your temporary grant requests returns "OK" response + Given operation "ListMyTemporaryGrantRequests" enabled + And new "ListMyTemporaryGrantRequests" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/billing-hub @with-pagination + Scenario: List your temporary grant requests returns "OK" response with pagination + Given operation "ListMyTemporaryGrantRequests" enabled + And new "ListMyTemporaryGrantRequests" request + When the request with pagination is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/billing-hub + Scenario: Revoke a requested temporary grant returns "Bad Request" response + Given operation "DeleteRequestedTemporaryGrant" enabled + And new "DeleteRequestedTemporaryGrant" request + And request contains "request_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/billing-hub + Scenario: Revoke a requested temporary grant returns "Conflict" response + Given operation "DeleteRequestedTemporaryGrant" enabled + And new "DeleteRequestedTemporaryGrant" request + And request contains "request_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:ddoghq/billing-hub + Scenario: Revoke a requested temporary grant returns "No Content" response + Given operation "DeleteRequestedTemporaryGrant" enabled + And new "DeleteRequestedTemporaryGrant" request + And request contains "request_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: Revoke a requested temporary grant returns "Not Found" response + Given operation "DeleteRequestedTemporaryGrant" enabled + And new "DeleteRequestedTemporaryGrant" request + And request contains "request_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: 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 diff --git a/src/test/resources/generated-test/test-runner-data/manifest.json b/src/test/resources/generated-test/test-runner-data/manifest.json index 49d84fde6c0..e38d4aaeee5 100644 --- a/src/test/resources/generated-test/test-runner-data/manifest.json +++ b/src/test/resources/generated-test/test-runner-data/manifest.json @@ -12754,6 +12754,13 @@ "scenario": "Ingest STIX threat intelligence returns \"OK\" response", "version": "v2" }, + { + "feature": "Usage Metering", + "feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature", + "file": "v2/usage-metering/decide-a-temporary-grant-request-returns-ok-response.json", + "scenario": "Decide a temporary grant request returns \"OK\" response", + "version": "v2" + }, { "feature": "Usage Metering", "feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature", @@ -12775,6 +12782,13 @@ "scenario": "Get active billing dimensions for cost attribution returns \"OK\" response", "version": "v2" }, + { + "feature": "Usage Metering", + "feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature", + "file": "v2/usage-metering/get-an-organization-temporary-grant-request-returns-ok-response.json", + "scenario": "Get an organization temporary grant request returns \"OK\" response", + "version": "v2" + }, { "feature": "Usage Metering", "feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature", @@ -12817,6 +12831,13 @@ "scenario": "Get projected cost across your account returns \"OK\" response", "version": "v2" }, + { + "feature": "Usage Metering", + "feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature", + "file": "v2/usage-metering/get-your-temporary-grant-request-returns-ok-response.json", + "scenario": "Get your temporary grant request returns \"OK\" response", + "version": "v2" + }, { "feature": "Usage Metering", "feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature", diff --git a/src/test/resources/generated-test/test-runner-data/v2/usage-metering/decide-a-temporary-grant-request-returns-ok-response.json b/src/test/resources/generated-test/test-runner-data/v2/usage-metering/decide-a-temporary-grant-request-returns-ok-response.json new file mode 100644 index 00000000000..a5002c9959f --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/usage-metering/decide-a-temporary-grant-request-returns-ok-response.json @@ -0,0 +1,51 @@ +{ + "api": "UsageMetering", + "expected_status": 200, + "feature": "Usage Metering", + "id": "v2/Usage Metering/Decide a temporary grant request returns \"OK\" response", + "operation_id": "UpdateTemporaryGrantRequest", + "request": { + "body": { + "schema": { + "format": null, + "ref": "TemporaryGrantRequestDecisionRequest", + "type": "object" + }, + "source": "inline", + "value": { + "data": { + "attributes": { + "decision": "denied" + }, + "id": "{{ temporary_grant_request.data.id }}", + "type": "temporary_grant_requests" + } + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "request_id", + "required": true, + "schema": { + "format": "uuid", + "ref": null, + "type": "string" + }, + "source": { + "path": "temporary_grant_request.data.id", + "type": "fixture" + }, + "style": null + } + ], + "path": "/api/v2/usage/admin/temporary-grant-requests/{request_id}/decision" + }, + "scenario": "Decide a temporary grant request returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-runner-data/v2/usage-metering/get-an-organization-temporary-grant-request-returns-ok-response.json b/src/test/resources/generated-test/test-runner-data/v2/usage-metering/get-an-organization-temporary-grant-request-returns-ok-response.json new file mode 100644 index 00000000000..95dcebda93d --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/usage-metering/get-an-organization-temporary-grant-request-returns-ok-response.json @@ -0,0 +1,35 @@ +{ + "api": "UsageMetering", + "expected_status": 200, + "feature": "Usage Metering", + "id": "v2/Usage Metering/Get an organization temporary grant request returns \"OK\" response", + "operation_id": "GetTemporaryGrantRequest", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "request_id", + "required": true, + "schema": { + "format": "uuid", + "ref": null, + "type": "string" + }, + "source": { + "path": "temporary_grant_request.data.id", + "type": "fixture" + }, + "style": null + } + ], + "path": "/api/v2/usage/admin/temporary-grant-requests/{request_id}" + }, + "scenario": "Get an organization temporary grant request returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-runner-data/v2/usage-metering/get-your-temporary-grant-request-returns-ok-response.json b/src/test/resources/generated-test/test-runner-data/v2/usage-metering/get-your-temporary-grant-request-returns-ok-response.json new file mode 100644 index 00000000000..b59d5ef7046 --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/usage-metering/get-your-temporary-grant-request-returns-ok-response.json @@ -0,0 +1,35 @@ +{ + "api": "UsageMetering", + "expected_status": 200, + "feature": "Usage Metering", + "id": "v2/Usage Metering/Get your temporary grant request returns \"OK\" response", + "operation_id": "GetMyTemporaryGrantRequest", + "request": { + "body": null, + "content_type": null, + "method": "GET", + "pagination": false, + "parameters": [ + { + "explode": null, + "in": "path", + "name": "request_id", + "required": true, + "schema": { + "format": "uuid", + "ref": null, + "type": "string" + }, + "source": { + "path": "temporary_grant_request.data.id", + "type": "fixture" + }, + "style": null + } + ], + "path": "/api/v2/usage/temporary-grant-requests/{request_id}" + }, + "scenario": "Get your temporary grant request returns \"OK\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-server-data/v2/usage-metering.json b/src/test/resources/generated-test/test-server-data/v2/usage-metering.json index 9a9927ae5c5..e8634f9d060 100644 --- a/src/test/resources/generated-test/test-server-data/v2/usage-metering.json +++ b/src/test/resources/generated-test/test-server-data/v2/usage-metering.json @@ -1,6 +1,99 @@ { "feature": "Usage Metering", "recordings": [ + { + "feature": "Usage Metering", + "frozen_at": "2026-10-29T18:06:54.122Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "justification": "Credits needed for Test-Decide_a_temporary_grant_request_returns_OK_response-1793297214.", + "total": 200 + }, + "type": "temporary_grant_requests" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/usage/temporary-grant-requests", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"5c05597a-04d0-4b95-969e-6bad0108f4e1\",\"type\":\"temporary_grant_requests\",\"attributes\":{\"created_at\":\"2026-10-29T18:06:56.353756Z\",\"entity_key\":\"user_handle:cedric.vanrompay@datadoghq.com\",\"expires_at\":\"2026-11-01T00:00:00Z\",\"justification\":\"Credits needed for Test-Decide_a_temporary_grant_request_returns_OK_response-1793297214.\",\"quota_namespace\":\"ai_credits\",\"requested_by_user_id\":\"028000b7-d90f-4d20-b4a9-6ff4a83b7950\",\"status\":\"pending\",\"total\":200}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Created", + "status": 201 + } + }, + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "decision": "denied" + }, + "id": "5c05597a-04d0-4b95-969e-6bad0108f4e1", + "type": "temporary_grant_requests" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/usage/admin/temporary-grant-requests/5c05597a-04d0-4b95-969e-6bad0108f4e1/decision", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"5c05597a-04d0-4b95-969e-6bad0108f4e1\",\"type\":\"temporary_grant_requests\",\"attributes\":{\"created_at\":\"2026-10-29T18:06:56.353756Z\",\"decided_at\":\"2026-10-29T18:06:56.430411Z\",\"decided_by_user_id\":\"028000b7-d90f-4d20-b4a9-6ff4a83b7950\",\"entity_key\":\"user_handle:cedric.vanrompay@datadoghq.com\",\"expires_at\":\"2026-11-01T00:00:00Z\",\"justification\":\"Credits needed for Test-Decide_a_temporary_grant_request_returns_OK_response-1793297214.\",\"quota_namespace\":\"ai_credits\",\"requested_by_user_id\":\"028000b7-d90f-4d20-b4a9-6ff4a83b7950\",\"status\":\"denied\",\"total\":200}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/usage/temporary-grant-requests/5c05597a-04d0-4b95-969e-6bad0108f4e1", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"temporary grant request is no longer pending or has expired\"}]}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Conflict", + "status": 409 + } + } + ], + "scenario": "Decide a temporary grant request returns \"OK\" response", + "version": "v2" + }, { "feature": "Usage Metering", "frozen_at": "2023-11-16T19:41:02.013Z", @@ -120,6 +213,89 @@ "scenario": "Get active billing dimensions for cost attribution returns \"OK\" response", "version": "v2" }, + { + "feature": "Usage Metering", + "frozen_at": "2026-10-29T18:06:56.505Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "justification": "Credits needed for Test-Get_an_organization_temporary_grant_request_returns_OK_response-1793297216.", + "total": 200 + }, + "type": "temporary_grant_requests" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/usage/temporary-grant-requests", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"5c0e85a8-8def-4a55-ba83-17b30be04b21\",\"type\":\"temporary_grant_requests\",\"attributes\":{\"created_at\":\"2026-10-29T18:06:56.559013Z\",\"entity_key\":\"user_handle:cedric.vanrompay@datadoghq.com\",\"expires_at\":\"2026-11-01T00:00:00Z\",\"justification\":\"Credits needed for Test-Get_an_organization_temporary_grant_request_returns_OK_response-1793297216.\",\"quota_namespace\":\"ai_credits\",\"requested_by_user_id\":\"028000b7-d90f-4d20-b4a9-6ff4a83b7950\",\"status\":\"pending\",\"total\":200}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Created", + "status": 201 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/usage/admin/temporary-grant-requests/5c0e85a8-8def-4a55-ba83-17b30be04b21", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"5c0e85a8-8def-4a55-ba83-17b30be04b21\",\"type\":\"temporary_grant_requests\",\"attributes\":{\"created_at\":\"2026-10-29T18:06:56.559013Z\",\"entity_key\":\"user_handle:cedric.vanrompay@datadoghq.com\",\"expires_at\":\"2026-11-01T00:00:00Z\",\"justification\":\"Credits needed for Test-Get_an_organization_temporary_grant_request_returns_OK_response-1793297216.\",\"quota_namespace\":\"ai_credits\",\"requested_by_user_id\":\"028000b7-d90f-4d20-b4a9-6ff4a83b7950\",\"status\":\"pending\",\"total\":200}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/usage/temporary-grant-requests/5c0e85a8-8def-4a55-ba83-17b30be04b21", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": {}, + "reason": "No Content", + "status": 204 + } + } + ], + "scenario": "Get an organization temporary grant request returns \"OK\" response", + "version": "v2" + }, { "feature": "Usage Metering", "frozen_at": "2026-06-02T19:26:31.725Z", @@ -698,6 +874,89 @@ "scenario": "Get projected cost across your account returns \"OK\" response", "version": "v2" }, + { + "feature": "Usage Metering", + "frozen_at": "2026-10-29T18:06:56.719Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "justification": "Credits needed for Test-Get_your_temporary_grant_request_returns_OK_response-1793297216.", + "total": 200 + }, + "type": "temporary_grant_requests" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/usage/temporary-grant-requests", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"7b02f423-50da-4694-a06f-fc850bed6e79\",\"type\":\"temporary_grant_requests\",\"attributes\":{\"created_at\":\"2026-10-29T18:06:56.825991Z\",\"entity_key\":\"user_handle:cedric.vanrompay@datadoghq.com\",\"expires_at\":\"2026-11-01T00:00:00Z\",\"justification\":\"Credits needed for Test-Get_your_temporary_grant_request_returns_OK_response-1793297216.\",\"quota_namespace\":\"ai_credits\",\"requested_by_user_id\":\"028000b7-d90f-4d20-b4a9-6ff4a83b7950\",\"status\":\"pending\",\"total\":200}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "Created", + "status": 201 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "GET", + "path": "/api/v2/usage/temporary-grant-requests/7b02f423-50da-4694-a06f-fc850bed6e79", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"id\":\"7b02f423-50da-4694-a06f-fc850bed6e79\",\"type\":\"temporary_grant_requests\",\"attributes\":{\"created_at\":\"2026-10-29T18:06:56.825991Z\",\"entity_key\":\"user_handle:cedric.vanrompay@datadoghq.com\",\"expires_at\":\"2026-11-01T00:00:00Z\",\"justification\":\"Credits needed for Test-Get_your_temporary_grant_request_returns_OK_response-1793297216.\",\"quota_namespace\":\"ai_credits\",\"requested_by_user_id\":\"028000b7-d90f-4d20-b4a9-6ff4a83b7950\",\"status\":\"pending\",\"total\":200}}}" + }, + "headers": { + "content-type": "application/vnd.api+json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/usage/temporary-grant-requests/7b02f423-50da-4694-a06f-fc850bed6e79", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": {}, + "reason": "No Content", + "status": 204 + } + } + ], + "scenario": "Get your temporary grant request returns \"OK\" response", + "version": "v2" + }, { "feature": "Usage Metering", "frozen_at": "2022-11-03T21:08:41.229Z",