From 8f237ec6aa83f6e61938bc211543aac05eb7ead5 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 29 Oct 2026 20:05:39 +0000 Subject: [PATCH] Regenerate client from commit 222b428 of spec repo --- .generator/schemas/v2/openapi.yaml | 1000 +++++++++++++++++ .../CreateTemporaryGrantRequest.rb | 20 + .../DeleteRequestedTemporaryGrant.rb | 9 + .../DeleteTemporaryGrantRequest.rb | 9 + .../GetMyTemporaryGrantRequest.rb | 12 + .../GetTemporaryGrantRequest.rb | 12 + .../ListMyTemporaryGrantRequests.rb | 9 + ...ListMyTemporaryGrantRequests_3885243213.rb | 9 + .../ListTemporaryGrantRequests.rb | 9 + .../ListTemporaryGrantRequests_3760725651.rb | 9 + .../UpdateTemporaryGrantRequest.rb | 22 + features/scenarios_model_mapping.rb | 30 + features/v2/given.json | 12 + features/v2/undo.json | 55 + features/v2/usage_metering.feature | 272 +++++ generated-test/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 +++++ lib/datadog_api_client/configuration.rb | 8 + lib/datadog_api_client/inflector.rb | 16 + lib/datadog_api_client/v1/model_base.rb | 2 +- .../v2/api/usage_metering_api.rb | 643 +++++++++++ lib/datadog_api_client/v2/model_base.rb | 2 +- .../temporary_grant_request_attributes.rb | 316 ++++++ ...mporary_grant_request_create_attributes.rb | 153 +++ .../temporary_grant_request_create_data.rb | 144 +++ .../temporary_grant_request_create_request.rb | 123 ++ .../v2/models/temporary_grant_request_data.rb | 165 +++ .../temporary_grant_request_decision.rb | 27 + ...orary_grant_request_decision_attributes.rb | 98 ++ .../temporary_grant_request_decision_data.rb | 165 +++ ...emporary_grant_request_decision_request.rb | 123 ++ .../temporary_grant_request_grant_state.rb | 29 + .../temporary_grant_request_list_meta.rb | 123 ++ .../temporary_grant_request_list_response.rb | 146 +++ .../v2/models/temporary_grant_request_page.rb | 105 ++ .../temporary_grant_request_response.rb | 123 ++ .../models/temporary_grant_request_status.rb | 29 + .../v2/models/temporary_grant_request_type.rb | 26 + 41 files changed, 4454 insertions(+), 2 deletions(-) create mode 100644 examples/v2/usage-metering/CreateTemporaryGrantRequest.rb create mode 100644 examples/v2/usage-metering/DeleteRequestedTemporaryGrant.rb create mode 100644 examples/v2/usage-metering/DeleteTemporaryGrantRequest.rb create mode 100644 examples/v2/usage-metering/GetMyTemporaryGrantRequest.rb create mode 100644 examples/v2/usage-metering/GetTemporaryGrantRequest.rb create mode 100644 examples/v2/usage-metering/ListMyTemporaryGrantRequests.rb create mode 100644 examples/v2/usage-metering/ListMyTemporaryGrantRequests_3885243213.rb create mode 100644 examples/v2/usage-metering/ListTemporaryGrantRequests.rb create mode 100644 examples/v2/usage-metering/ListTemporaryGrantRequests_3760725651.rb create mode 100644 examples/v2/usage-metering/UpdateTemporaryGrantRequest.rb create mode 100644 generated-test/test-runner-data/v2/usage-metering/decide-a-temporary-grant-request-returns-ok-response.json create mode 100644 generated-test/test-runner-data/v2/usage-metering/get-an-organization-temporary-grant-request-returns-ok-response.json create mode 100644 generated-test/test-runner-data/v2/usage-metering/get-your-temporary-grant-request-returns-ok-response.json create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_create_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_create_data.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_decision.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_decision_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_decision_data.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_decision_request.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_grant_state.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_list_meta.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_list_response.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_page.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_response.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_status.rb create mode 100644 lib/datadog_api_client/v2/models/temporary_grant_request_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index dbd876c34d7b..b0a2f61cc8bc 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.rb b/examples/v2/usage-metering/CreateTemporaryGrantRequest.rb new file mode 100644 index 000000000000..ee5aca19b8dc --- /dev/null +++ b/examples/v2/usage-metering/CreateTemporaryGrantRequest.rb @@ -0,0 +1,20 @@ +# Create a temporary grant request returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.create_temporary_grant_request".to_sym] = true +end +api_instance = DatadogAPIClient::V2::UsageMeteringAPI.new + +body = DatadogAPIClient::V2::TemporaryGrantRequestCreateRequest.new({ + data: DatadogAPIClient::V2::TemporaryGrantRequestCreateData.new({ + attributes: DatadogAPIClient::V2::TemporaryGrantRequestCreateAttributes.new({ + expires_at: "2028-02-16T00:00:00Z", + justification: "Credits needed to finish the incident investigation.", + total: 200, + }), + type: DatadogAPIClient::V2::TemporaryGrantRequestType::TEMPORARY_GRANT_REQUESTS, + }), +}) +p api_instance.create_temporary_grant_request(body) diff --git a/examples/v2/usage-metering/DeleteRequestedTemporaryGrant.rb b/examples/v2/usage-metering/DeleteRequestedTemporaryGrant.rb new file mode 100644 index 000000000000..8102b08bd153 --- /dev/null +++ b/examples/v2/usage-metering/DeleteRequestedTemporaryGrant.rb @@ -0,0 +1,9 @@ +# Revoke a requested temporary grant returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.delete_requested_temporary_grant".to_sym] = true +end +api_instance = DatadogAPIClient::V2::UsageMeteringAPI.new +api_instance.delete_requested_temporary_grant("12345678-1234-1234-1234-123456789012") diff --git a/examples/v2/usage-metering/DeleteTemporaryGrantRequest.rb b/examples/v2/usage-metering/DeleteTemporaryGrantRequest.rb new file mode 100644 index 000000000000..6f0a223302ab --- /dev/null +++ b/examples/v2/usage-metering/DeleteTemporaryGrantRequest.rb @@ -0,0 +1,9 @@ +# Cancel your temporary grant request returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.delete_temporary_grant_request".to_sym] = true +end +api_instance = DatadogAPIClient::V2::UsageMeteringAPI.new +api_instance.delete_temporary_grant_request("12345678-1234-1234-1234-123456789012") diff --git a/examples/v2/usage-metering/GetMyTemporaryGrantRequest.rb b/examples/v2/usage-metering/GetMyTemporaryGrantRequest.rb new file mode 100644 index 000000000000..f67527234361 --- /dev/null +++ b/examples/v2/usage-metering/GetMyTemporaryGrantRequest.rb @@ -0,0 +1,12 @@ +# Get your temporary grant request returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.get_my_temporary_grant_request".to_sym] = true +end +api_instance = DatadogAPIClient::V2::UsageMeteringAPI.new + +# there is a valid "temporary_grant_request" in the system +TEMPORARY_GRANT_REQUEST_DATA_ID = ENV["TEMPORARY_GRANT_REQUEST_DATA_ID"] +p api_instance.get_my_temporary_grant_request(TEMPORARY_GRANT_REQUEST_DATA_ID) diff --git a/examples/v2/usage-metering/GetTemporaryGrantRequest.rb b/examples/v2/usage-metering/GetTemporaryGrantRequest.rb new file mode 100644 index 000000000000..c1b89e4cdb98 --- /dev/null +++ b/examples/v2/usage-metering/GetTemporaryGrantRequest.rb @@ -0,0 +1,12 @@ +# Get an organization temporary grant request returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.get_temporary_grant_request".to_sym] = true +end +api_instance = DatadogAPIClient::V2::UsageMeteringAPI.new + +# there is a valid "temporary_grant_request" in the system +TEMPORARY_GRANT_REQUEST_DATA_ID = ENV["TEMPORARY_GRANT_REQUEST_DATA_ID"] +p api_instance.get_temporary_grant_request(TEMPORARY_GRANT_REQUEST_DATA_ID) diff --git a/examples/v2/usage-metering/ListMyTemporaryGrantRequests.rb b/examples/v2/usage-metering/ListMyTemporaryGrantRequests.rb new file mode 100644 index 000000000000..dff268128f36 --- /dev/null +++ b/examples/v2/usage-metering/ListMyTemporaryGrantRequests.rb @@ -0,0 +1,9 @@ +# List your temporary grant requests returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.list_my_temporary_grant_requests".to_sym] = true +end +api_instance = DatadogAPIClient::V2::UsageMeteringAPI.new +p api_instance.list_my_temporary_grant_requests() diff --git a/examples/v2/usage-metering/ListMyTemporaryGrantRequests_3885243213.rb b/examples/v2/usage-metering/ListMyTemporaryGrantRequests_3885243213.rb new file mode 100644 index 000000000000..f74c5127ffbf --- /dev/null +++ b/examples/v2/usage-metering/ListMyTemporaryGrantRequests_3885243213.rb @@ -0,0 +1,9 @@ +# List your temporary grant requests returns "OK" response with pagination + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.list_my_temporary_grant_requests".to_sym] = true +end +api_instance = DatadogAPIClient::V2::UsageMeteringAPI.new +api_instance.list_my_temporary_grant_requests_with_pagination() { |item| puts item } diff --git a/examples/v2/usage-metering/ListTemporaryGrantRequests.rb b/examples/v2/usage-metering/ListTemporaryGrantRequests.rb new file mode 100644 index 000000000000..ff3680fc4214 --- /dev/null +++ b/examples/v2/usage-metering/ListTemporaryGrantRequests.rb @@ -0,0 +1,9 @@ +# List organization temporary grant requests returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.list_temporary_grant_requests".to_sym] = true +end +api_instance = DatadogAPIClient::V2::UsageMeteringAPI.new +p api_instance.list_temporary_grant_requests() diff --git a/examples/v2/usage-metering/ListTemporaryGrantRequests_3760725651.rb b/examples/v2/usage-metering/ListTemporaryGrantRequests_3760725651.rb new file mode 100644 index 000000000000..5f130fe56835 --- /dev/null +++ b/examples/v2/usage-metering/ListTemporaryGrantRequests_3760725651.rb @@ -0,0 +1,9 @@ +# List organization temporary grant requests returns "OK" response with pagination + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.list_temporary_grant_requests".to_sym] = true +end +api_instance = DatadogAPIClient::V2::UsageMeteringAPI.new +api_instance.list_temporary_grant_requests_with_pagination() { |item| puts item } diff --git a/examples/v2/usage-metering/UpdateTemporaryGrantRequest.rb b/examples/v2/usage-metering/UpdateTemporaryGrantRequest.rb new file mode 100644 index 000000000000..b205500665cd --- /dev/null +++ b/examples/v2/usage-metering/UpdateTemporaryGrantRequest.rb @@ -0,0 +1,22 @@ +# Decide a temporary grant request returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.access_token = ENV["DD_BEARER_TOKEN"] + config.unstable_operations["v2.update_temporary_grant_request".to_sym] = true +end +api_instance = DatadogAPIClient::V2::UsageMeteringAPI.new + +# there is a valid "temporary_grant_request" in the system +TEMPORARY_GRANT_REQUEST_DATA_ID = ENV["TEMPORARY_GRANT_REQUEST_DATA_ID"] + +body = DatadogAPIClient::V2::TemporaryGrantRequestDecisionRequest.new({ + data: DatadogAPIClient::V2::TemporaryGrantRequestDecisionData.new({ + attributes: DatadogAPIClient::V2::TemporaryGrantRequestDecisionAttributes.new({ + decision: DatadogAPIClient::V2::TemporaryGrantRequestDecision::DENIED, + }), + id: TEMPORARY_GRANT_REQUEST_DATA_ID, + type: DatadogAPIClient::V2::TemporaryGrantRequestType::TEMPORARY_GRANT_REQUESTS, + }), +}) +p api_instance.update_temporary_grant_request(TEMPORARY_GRANT_REQUEST_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index a4fb7ff0dd4f..49b17e5427ea 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3177,6 +3177,22 @@ "next_record_id" => "String", "include_descendants" => "Boolean", }, + "v2.ListTemporaryGrantRequests" => { + "filter_status" => "TemporaryGrantRequestStatus", + "page_limit" => "Integer", + "page_cursor" => "UUID", + "filter_requested_by_user_id" => "UUID", + }, + "v2.GetTemporaryGrantRequest" => { + "request_id" => "UUID", + }, + "v2.UpdateTemporaryGrantRequest" => { + "request_id" => "UUID", + "body" => "TemporaryGrantRequestDecisionRequest", + }, + "v2.DeleteRequestedTemporaryGrant" => { + "request_id" => "UUID", + }, "v2.GetUsageApplicationSecurityMonitoring" => { "start_hr" => "Time", "end_hr" => "Time", @@ -3251,6 +3267,20 @@ "quota_namespace" => "String", "id" => "String", }, + "v2.ListMyTemporaryGrantRequests" => { + "filter_status" => "TemporaryGrantRequestStatus", + "page_limit" => "Integer", + "page_cursor" => "UUID", + }, + "v2.CreateTemporaryGrantRequest" => { + "body" => "TemporaryGrantRequestCreateRequest", + }, + "v2.DeleteTemporaryGrantRequest" => { + "request_id" => "UUID", + }, + "v2.GetMyTemporaryGrantRequest" => { + "request_id" => "UUID", + }, "v2.ListAllCSMAgents" => { "page" => "Integer", "size" => "Integer", diff --git a/features/v2/given.json b/features/v2/given.json index 133777e08d81..05c5655fc6c2 100644 --- a/features/v2/given.json +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index 45b82eb3cd77..e3fceb020268 100644 --- a/features/v2/undo.json +++ b/features/v2/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/features/v2/usage_metering.feature b/features/v2/usage_metering.feature index 9fd783ecd662..3e420970e74b 100644 --- a/features/v2/usage_metering.feature +++ b/features/v2/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/generated-test/test-runner-data/manifest.json b/generated-test/test-runner-data/manifest.json index c050f4092502..7d14f0e1eeb4 100644 --- a/generated-test/test-runner-data/manifest.json +++ b/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": "../../features/v2/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": "../../features/v2/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": "../../features/v2/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": "../../features/v2/usage_metering.feature", @@ -12817,6 +12831,13 @@ "scenario": "Get projected cost across your account returns \"OK\" response", "version": "v2" }, + { + "feature": "Usage Metering", + "feature_file": "../../features/v2/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": "../../features/v2/usage_metering.feature", diff --git a/generated-test/test-runner-data/v2/usage-metering/decide-a-temporary-grant-request-returns-ok-response.json b/generated-test/test-runner-data/v2/usage-metering/decide-a-temporary-grant-request-returns-ok-response.json new file mode 100644 index 000000000000..a5002c9959f9 --- /dev/null +++ b/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/generated-test/test-runner-data/v2/usage-metering/get-an-organization-temporary-grant-request-returns-ok-response.json b/generated-test/test-runner-data/v2/usage-metering/get-an-organization-temporary-grant-request-returns-ok-response.json new file mode 100644 index 000000000000..95dcebda93d0 --- /dev/null +++ b/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/generated-test/test-runner-data/v2/usage-metering/get-your-temporary-grant-request-returns-ok-response.json b/generated-test/test-runner-data/v2/usage-metering/get-your-temporary-grant-request-returns-ok-response.json new file mode 100644 index 000000000000..b59d5ef7046b --- /dev/null +++ b/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/generated-test/test-server-data/v2/usage-metering.json b/generated-test/test-server-data/v2/usage-metering.json index 9a9927ae5c56..e8634f9d0602 100644 --- a/generated-test/test-server-data/v2/usage-metering.json +++ b/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", diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index b6c563db6935..b51ead736870 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -434,10 +434,18 @@ def initialize "v2.search_cost_recommendations": false, "v2.update_unit_cost": false, "v2.create_quotas": false, + "v2.create_temporary_grant_request": false, "v2.delete_pending_quota": false, "v2.delete_quota": false, + "v2.delete_requested_temporary_grant": false, + "v2.delete_temporary_grant_request": false, + "v2.get_my_temporary_grant_request": false, + "v2.get_temporary_grant_request": false, + "v2.list_my_temporary_grant_requests": false, "v2.list_quotas": false, + "v2.list_temporary_grant_requests": false, "v2.update_quota": false, + "v2.update_temporary_grant_request": false, "v2.create_ownership_feedback": false, "v2.get_ownership_evidence": false, "v2.get_ownership_inference": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index b475d0ed8b5b..13cc039dbfd9 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -9262,6 +9262,22 @@ def overrides "v2.team_update_attributes" => "TeamUpdateAttributes", "v2.team_update_relationships" => "TeamUpdateRelationships", "v2.team_update_request" => "TeamUpdateRequest", + "v2.temporary_grant_request_attributes" => "TemporaryGrantRequestAttributes", + "v2.temporary_grant_request_create_attributes" => "TemporaryGrantRequestCreateAttributes", + "v2.temporary_grant_request_create_data" => "TemporaryGrantRequestCreateData", + "v2.temporary_grant_request_create_request" => "TemporaryGrantRequestCreateRequest", + "v2.temporary_grant_request_data" => "TemporaryGrantRequestData", + "v2.temporary_grant_request_decision" => "TemporaryGrantRequestDecision", + "v2.temporary_grant_request_decision_attributes" => "TemporaryGrantRequestDecisionAttributes", + "v2.temporary_grant_request_decision_data" => "TemporaryGrantRequestDecisionData", + "v2.temporary_grant_request_decision_request" => "TemporaryGrantRequestDecisionRequest", + "v2.temporary_grant_request_grant_state" => "TemporaryGrantRequestGrantState", + "v2.temporary_grant_request_list_meta" => "TemporaryGrantRequestListMeta", + "v2.temporary_grant_request_list_response" => "TemporaryGrantRequestListResponse", + "v2.temporary_grant_request_page" => "TemporaryGrantRequestPage", + "v2.temporary_grant_request_response" => "TemporaryGrantRequestResponse", + "v2.temporary_grant_request_status" => "TemporaryGrantRequestStatus", + "v2.temporary_grant_request_type" => "TemporaryGrantRequestType", "v2.tenancy_config" => "TenancyConfig", "v2.tenancy_config_data" => "TenancyConfigData", "v2.tenancy_config_data_attributes" => "TenancyConfigDataAttributes", diff --git a/lib/datadog_api_client/v1/model_base.rb b/lib/datadog_api_client/v1/model_base.rb index 203568f08509..47dac17dd5ae 100644 --- a/lib/datadog_api_client/v1/model_base.rb +++ b/lib/datadog_api_client/v1/model_base.rb @@ -185,7 +185,7 @@ def to_hash # @!visibility private def _to_hash(value) if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } + value.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } diff --git a/lib/datadog_api_client/v2/api/usage_metering_api.rb b/lib/datadog_api_client/v2/api/usage_metering_api.rb index dee74b7f0b66..2fa99b0bb893 100644 --- a/lib/datadog_api_client/v2/api/usage_metering_api.rb +++ b/lib/datadog_api_client/v2/api/usage_metering_api.rb @@ -107,6 +107,79 @@ def create_quotas_with_http_info(quota_namespace, body, opts = {}) return data, status_code, headers end + # Create a temporary grant request. + # + # @see #create_temporary_grant_request_with_http_info + def create_temporary_grant_request(body, opts = {}) + data, _status_code, _headers = create_temporary_grant_request_with_http_info(body, opts) + data + end + + # Create a temporary grant request. + # + # 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 [TemporaryGrantRequestCreateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(TemporaryGrantRequestResponse, Integer, Hash)>] TemporaryGrantRequestResponse data, response status code and response headers + def create_temporary_grant_request_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_temporary_grant_request".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_temporary_grant_request") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_temporary_grant_request")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.create_temporary_grant_request ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling UsageMeteringAPI.create_temporary_grant_request" + end + # resource path + local_var_path = '/api/v2/usage/temporary-grant-requests' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'TemporaryGrantRequestResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_temporary_grant_request, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: UsageMeteringAPI#create_temporary_grant_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Cancel a scheduled usage quota limit. # # @see #delete_pending_quota_with_http_info @@ -259,6 +332,148 @@ def delete_quota_with_http_info(quota_namespace, id, opts = {}) return data, status_code, headers end + # Revoke a requested temporary grant. + # + # @see #delete_requested_temporary_grant_with_http_info + def delete_requested_temporary_grant(request_id, opts = {}) + delete_requested_temporary_grant_with_http_info(request_id, opts) + nil + end + + # Revoke a requested temporary grant. + # + # 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. + # + # @param request_id [UUID] The temporary grant request UUID. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_requested_temporary_grant_with_http_info(request_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_requested_temporary_grant".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_requested_temporary_grant") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_requested_temporary_grant")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.delete_requested_temporary_grant ...' + end + # verify the required parameter 'request_id' is set + if @api_client.config.client_side_validation && request_id.nil? + fail ArgumentError, "Missing the required parameter 'request_id' when calling UsageMeteringAPI.delete_requested_temporary_grant" + end + # resource path + local_var_path = '/api/v2/usage/admin/temporary-grant-requests/{request_id}/grant'.sub('{request_id}', CGI.escape(request_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_requested_temporary_grant, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: UsageMeteringAPI#delete_requested_temporary_grant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Cancel your temporary grant request. + # + # @see #delete_temporary_grant_request_with_http_info + def delete_temporary_grant_request(request_id, opts = {}) + delete_temporary_grant_request_with_http_info(request_id, opts) + nil + end + + # Cancel your temporary grant request. + # + # 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. + # + # @param request_id [UUID] The temporary grant request UUID. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_temporary_grant_request_with_http_info(request_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_temporary_grant_request".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_temporary_grant_request") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_temporary_grant_request")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.delete_temporary_grant_request ...' + end + # verify the required parameter 'request_id' is set + if @api_client.config.client_side_validation && request_id.nil? + fail ArgumentError, "Missing the required parameter 'request_id' when calling UsageMeteringAPI.delete_temporary_grant_request" + end + # resource path + local_var_path = '/api/v2/usage/temporary-grant-requests/{request_id}'.sub('{request_id}', CGI.escape(request_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_temporary_grant_request, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: UsageMeteringAPI#delete_temporary_grant_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get active billing dimensions for cost attribution. # # @see #get_active_billing_dimensions_with_http_info @@ -816,6 +1031,77 @@ def get_monthly_cost_attribution_with_http_info(start_month, fields, opts = {}) return data, status_code, headers end + # Get your temporary grant request. + # + # @see #get_my_temporary_grant_request_with_http_info + def get_my_temporary_grant_request(request_id, opts = {}) + data, _status_code, _headers = get_my_temporary_grant_request_with_http_info(request_id, opts) + data + end + + # Get your temporary grant request. + # + # 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. + # + # @param request_id [UUID] The temporary grant request UUID. + # @param opts [Hash] the optional parameters + # @return [Array<(TemporaryGrantRequestResponse, Integer, Hash)>] TemporaryGrantRequestResponse data, response status code and response headers + def get_my_temporary_grant_request_with_http_info(request_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_my_temporary_grant_request".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_my_temporary_grant_request") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_my_temporary_grant_request")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_my_temporary_grant_request ...' + end + # verify the required parameter 'request_id' is set + if @api_client.config.client_side_validation && request_id.nil? + fail ArgumentError, "Missing the required parameter 'request_id' when calling UsageMeteringAPI.get_my_temporary_grant_request" + end + # resource path + local_var_path = '/api/v2/usage/temporary-grant-requests/{request_id}'.sub('{request_id}', CGI.escape(request_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'TemporaryGrantRequestResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_my_temporary_grant_request, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: UsageMeteringAPI#get_my_temporary_grant_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get projected cost across your account. # # @see #get_projected_cost_with_http_info @@ -883,6 +1169,77 @@ def get_projected_cost_with_http_info(opts = {}) return data, status_code, headers end + # Get an organization temporary grant request. + # + # @see #get_temporary_grant_request_with_http_info + def get_temporary_grant_request(request_id, opts = {}) + data, _status_code, _headers = get_temporary_grant_request_with_http_info(request_id, opts) + data + end + + # Get an organization temporary grant request. + # + # 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 request_id [UUID] The temporary grant request UUID. + # @param opts [Hash] the optional parameters + # @return [Array<(TemporaryGrantRequestResponse, Integer, Hash)>] TemporaryGrantRequestResponse data, response status code and response headers + def get_temporary_grant_request_with_http_info(request_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_temporary_grant_request".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_temporary_grant_request") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_temporary_grant_request")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_temporary_grant_request ...' + end + # verify the required parameter 'request_id' is set + if @api_client.config.client_side_validation && request_id.nil? + fail ArgumentError, "Missing the required parameter 'request_id' when calling UsageMeteringAPI.get_temporary_grant_request" + end + # resource path + local_var_path = '/api/v2/usage/admin/temporary-grant-requests/{request_id}'.sub('{request_id}', CGI.escape(request_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'TemporaryGrantRequestResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_temporary_grant_request, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: UsageMeteringAPI#get_temporary_grant_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get hourly usage for application security. # # @see #get_usage_application_security_monitoring_with_http_info @@ -1256,6 +1613,109 @@ def get_usage_summary_available_fields_with_http_info(opts = {}) return data, status_code, headers end + # List your temporary grant requests. + # + # @see #list_my_temporary_grant_requests_with_http_info + def list_my_temporary_grant_requests(opts = {}) + data, _status_code, _headers = list_my_temporary_grant_requests_with_http_info(opts) + data + end + + # List your temporary grant requests. + # + # 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 opts [Hash] the optional parameters + # @option opts [TemporaryGrantRequestStatus] :filter_status Optional status. Defaults to all statuses. + # @option opts [Integer] :page_limit Page size, from 1 to 100. + # @option opts [UUID] :page_cursor UUID cursor from meta.page.next_cursor. + # @return [Array<(TemporaryGrantRequestListResponse, Integer, Hash)>] TemporaryGrantRequestListResponse data, response status code and response headers + def list_my_temporary_grant_requests_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_my_temporary_grant_requests".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_my_temporary_grant_requests") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_my_temporary_grant_requests")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.list_my_temporary_grant_requests ...' + end + allowable_values = ['pending', 'approved', 'denied', 'cancelled'] + if @api_client.config.client_side_validation && opts[:'filter_status'] && !allowable_values.include?(opts[:'filter_status']) + fail ArgumentError, "invalid value for \"filter_status\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 100 + fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling UsageMeteringAPI.list_my_temporary_grant_requests, must be smaller than or equal to 100.' + end + if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling UsageMeteringAPI.list_my_temporary_grant_requests, must be greater than or equal to 1.' + end + # resource path + local_var_path = '/api/v2/usage/temporary-grant-requests' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'filter[status]'] = opts[:'filter_status'] if !opts[:'filter_status'].nil? + query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil? + query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'TemporaryGrantRequestListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_my_temporary_grant_requests, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: UsageMeteringAPI#list_my_temporary_grant_requests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List your temporary grant requests. + # + # Provide a paginated version of {#list_my_temporary_grant_requests}, returning all items. + # + # To use it you need to use a block: list_my_temporary_grant_requests_with_pagination { |item| p item } + # + # @yield [TemporaryGrantRequestData] Paginated items + def list_my_temporary_grant_requests_with_pagination(opts = {}) + api_version = "V2" + page_size = @api_client.get_attribute_from_path(opts, "page_limit", 50) + @api_client.set_attribute_from_path(api_version, opts, "page_limit", Integer, page_size) + while true do + response = list_my_temporary_grant_requests(opts) + @api_client.get_attribute_from_path(response, "data").each { |item| yield(item) } + if @api_client.get_attribute_from_path(response, "data").length == 0 + break + end + @api_client.set_attribute_from_path(api_version, opts, "page_cursor", UUID, @api_client.get_attribute_from_path(response, "meta.page.next_cursor")) + end + end + # List usage quotas. # # @see #list_quotas_with_http_info @@ -1362,6 +1822,111 @@ def list_quotas_with_pagination(quota_namespace, opts = {}) end end + # List organization temporary grant requests. + # + # @see #list_temporary_grant_requests_with_http_info + def list_temporary_grant_requests(opts = {}) + data, _status_code, _headers = list_temporary_grant_requests_with_http_info(opts) + data + end + + # List organization temporary grant requests. + # + # 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 opts [Hash] the optional parameters + # @option opts [TemporaryGrantRequestStatus] :filter_status Optional status. Defaults to all statuses. + # @option opts [Integer] :page_limit Page size, from 1 to 100. + # @option opts [UUID] :page_cursor UUID cursor from meta.page.next_cursor. + # @option opts [UUID] :filter_requested_by_user_id Filter by requester UUID within the authenticated organization. + # @return [Array<(TemporaryGrantRequestListResponse, Integer, Hash)>] TemporaryGrantRequestListResponse data, response status code and response headers + def list_temporary_grant_requests_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_temporary_grant_requests".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_temporary_grant_requests") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_temporary_grant_requests")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.list_temporary_grant_requests ...' + end + allowable_values = ['pending', 'approved', 'denied', 'cancelled'] + if @api_client.config.client_side_validation && opts[:'filter_status'] && !allowable_values.include?(opts[:'filter_status']) + fail ArgumentError, "invalid value for \"filter_status\", must be one of #{allowable_values}" + end + if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 100 + fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling UsageMeteringAPI.list_temporary_grant_requests, must be smaller than or equal to 100.' + end + if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling UsageMeteringAPI.list_temporary_grant_requests, must be greater than or equal to 1.' + end + # resource path + local_var_path = '/api/v2/usage/admin/temporary-grant-requests' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'filter[status]'] = opts[:'filter_status'] if !opts[:'filter_status'].nil? + query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil? + query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? + query_params[:'filter[requested_by_user_id]'] = opts[:'filter_requested_by_user_id'] if !opts[:'filter_requested_by_user_id'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'TemporaryGrantRequestListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_temporary_grant_requests, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: UsageMeteringAPI#list_temporary_grant_requests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List organization temporary grant requests. + # + # Provide a paginated version of {#list_temporary_grant_requests}, returning all items. + # + # To use it you need to use a block: list_temporary_grant_requests_with_pagination { |item| p item } + # + # @yield [TemporaryGrantRequestData] Paginated items + def list_temporary_grant_requests_with_pagination(opts = {}) + api_version = "V2" + page_size = @api_client.get_attribute_from_path(opts, "page_limit", 50) + @api_client.set_attribute_from_path(api_version, opts, "page_limit", Integer, page_size) + while true do + response = list_temporary_grant_requests(opts) + @api_client.get_attribute_from_path(response, "data").each { |item| yield(item) } + if @api_client.get_attribute_from_path(response, "data").length == 0 + break + end + @api_client.set_attribute_from_path(api_version, opts, "page_cursor", UUID, @api_client.get_attribute_from_path(response, "meta.page.next_cursor")) + end + end + # Update a usage quota. # # @see #update_quota_with_http_info @@ -1444,5 +2009,83 @@ def update_quota_with_http_info(quota_namespace, id, body, opts = {}) end return data, status_code, headers end + + # Decide a temporary grant request. + # + # @see #update_temporary_grant_request_with_http_info + def update_temporary_grant_request(request_id, body, opts = {}) + data, _status_code, _headers = update_temporary_grant_request_with_http_info(request_id, body, opts) + data + end + + # Decide a temporary grant request. + # + # 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 request_id [UUID] The temporary grant request UUID. + # @param body [TemporaryGrantRequestDecisionRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(TemporaryGrantRequestResponse, Integer, Hash)>] TemporaryGrantRequestResponse data, response status code and response headers + def update_temporary_grant_request_with_http_info(request_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_temporary_grant_request".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_temporary_grant_request") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_temporary_grant_request")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.update_temporary_grant_request ...' + end + # verify the required parameter 'request_id' is set + if @api_client.config.client_side_validation && request_id.nil? + fail ArgumentError, "Missing the required parameter 'request_id' when calling UsageMeteringAPI.update_temporary_grant_request" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling UsageMeteringAPI.update_temporary_grant_request" + end + # resource path + local_var_path = '/api/v2/usage/admin/temporary-grant-requests/{request_id}/decision'.sub('{request_id}', CGI.escape(request_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'TemporaryGrantRequestResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_temporary_grant_request, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: UsageMeteringAPI#update_temporary_grant_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/model_base.rb b/lib/datadog_api_client/v2/model_base.rb index 7bdfde0c6bcd..31cfac41fc01 100644 --- a/lib/datadog_api_client/v2/model_base.rb +++ b/lib/datadog_api_client/v2/model_base.rb @@ -185,7 +185,7 @@ def to_hash # @!visibility private def _to_hash(value) if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } + value.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_attributes.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_attributes.rb new file mode 100644 index 000000000000..9f71a640679d --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_attributes.rb @@ -0,0 +1,316 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # 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. + class TemporaryGrantRequestAttributes + include BaseGenericModel + + # When the request was submitted. + attr_reader :created_at + + # When the decision or cancellation was recorded. + attr_accessor :decided_at + + # UUID of the reviewer, or of the requester if the request was canceled. + attr_accessor :decided_by_user_id + + # The requester identity resolved by the server. + attr_reader :entity_key + + # Immutable exclusive expiry, normalized to UTC microsecond precision. + attr_reader :expires_at + + # 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. + attr_accessor :grant_state + + # Reason for requesting temporary credits. Trimmed and limited to 4096 UTF-8 bytes. + attr_reader :justification + + # The quota namespace. Only AI credits are supported. + attr_reader :quota_namespace + + # UUID of the authenticated requester. + attr_reader :requested_by_user_id + + # The durable request decision, independent of whether its grant is still active. + attr_reader :status + + # Target monthly AI credit limit in positive whole credits, not additional credits. Fractional credits are not accepted. + attr_reader :total + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at' => :'created_at', + :'decided_at' => :'decided_at', + :'decided_by_user_id' => :'decided_by_user_id', + :'entity_key' => :'entity_key', + :'expires_at' => :'expires_at', + :'grant_state' => :'grant_state', + :'justification' => :'justification', + :'quota_namespace' => :'quota_namespace', + :'requested_by_user_id' => :'requested_by_user_id', + :'status' => :'status', + :'total' => :'total' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at' => :'Time', + :'decided_at' => :'Time', + :'decided_by_user_id' => :'UUID', + :'entity_key' => :'String', + :'expires_at' => :'Time', + :'grant_state' => :'TemporaryGrantRequestGrantState', + :'justification' => :'String', + :'quota_namespace' => :'String', + :'requested_by_user_id' => :'UUID', + :'status' => :'TemporaryGrantRequestStatus', + :'total' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TemporaryGrantRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'decided_at') + self.decided_at = attributes[:'decided_at'] + end + + if attributes.key?(:'decided_by_user_id') + self.decided_by_user_id = attributes[:'decided_by_user_id'] + end + + if attributes.key?(:'entity_key') + self.entity_key = attributes[:'entity_key'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'grant_state') + self.grant_state = attributes[:'grant_state'] + end + + if attributes.key?(:'justification') + self.justification = attributes[:'justification'] + end + + if attributes.key?(:'quota_namespace') + self.quota_namespace = attributes[:'quota_namespace'] + end + + if attributes.key?(:'requested_by_user_id') + self.requested_by_user_id = attributes[:'requested_by_user_id'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @created_at.nil? + return false if @entity_key.nil? + return false if @expires_at.nil? + return false if @justification.nil? + return false if @justification.to_s.length > 4096 + return false if @justification.to_s.length < 1 + return false if @quota_namespace.nil? + return false if @requested_by_user_id.nil? + return false if @status.nil? + return false if @total.nil? + return false if @total > 9223372036854 + return false if @total < 1 + true + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param entity_key [Object] Object to be assigned + # @!visibility private + def entity_key=(entity_key) + if entity_key.nil? + fail ArgumentError, 'invalid value for "entity_key", entity_key cannot be nil.' + end + @entity_key = entity_key + end + + # Custom attribute writer method with validation + # @param expires_at [Object] Object to be assigned + # @!visibility private + def expires_at=(expires_at) + if expires_at.nil? + fail ArgumentError, 'invalid value for "expires_at", expires_at cannot be nil.' + end + @expires_at = expires_at + end + + # Custom attribute writer method with validation + # @param justification [Object] Object to be assigned + # @!visibility private + def justification=(justification) + if justification.nil? + fail ArgumentError, 'invalid value for "justification", justification cannot be nil.' + end + if justification.to_s.length > 4096 + fail ArgumentError, 'invalid value for "justification", the character length must be smaller than or equal to 4096.' + end + if justification.to_s.length < 1 + fail ArgumentError, 'invalid value for "justification", the character length must be great than or equal to 1.' + end + @justification = justification + end + + # Custom attribute writer method with validation + # @param quota_namespace [Object] Object to be assigned + # @!visibility private + def quota_namespace=(quota_namespace) + if quota_namespace.nil? + fail ArgumentError, 'invalid value for "quota_namespace", quota_namespace cannot be nil.' + end + @quota_namespace = quota_namespace + end + + # Custom attribute writer method with validation + # @param requested_by_user_id [Object] Object to be assigned + # @!visibility private + def requested_by_user_id=(requested_by_user_id) + if requested_by_user_id.nil? + fail ArgumentError, 'invalid value for "requested_by_user_id", requested_by_user_id cannot be nil.' + end + @requested_by_user_id = requested_by_user_id + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Custom attribute writer method with validation + # @param total [Object] Object to be assigned + # @!visibility private + def total=(total) + if total.nil? + fail ArgumentError, 'invalid value for "total", total cannot be nil.' + end + if total > 9223372036854 + fail ArgumentError, 'invalid value for "total", must be smaller than or equal to 9223372036854.' + end + if total < 1 + fail ArgumentError, 'invalid value for "total", must be greater than or equal to 1.' + end + @total = total + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_at == o.created_at && + decided_at == o.decided_at && + decided_by_user_id == o.decided_by_user_id && + entity_key == o.entity_key && + expires_at == o.expires_at && + grant_state == o.grant_state && + justification == o.justification && + quota_namespace == o.quota_namespace && + requested_by_user_id == o.requested_by_user_id && + status == o.status && + total == o.total && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at, decided_at, decided_by_user_id, entity_key, expires_at, grant_state, justification, quota_namespace, requested_by_user_id, status, total, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_create_attributes.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_create_attributes.rb new file mode 100644 index 000000000000..430629d250a1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_create_attributes.rb @@ -0,0 +1,153 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Immutable terms and justification for a temporary grant request. + class TemporaryGrantRequestCreateAttributes + include BaseGenericModel + + # 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. + attr_accessor :expires_at + + # Reason for requesting temporary credits. Trimmed and limited to 4096 UTF-8 bytes. + attr_reader :justification + + # Target monthly AI credit limit in positive whole credits, not additional credits. Fractional credits are not accepted. + attr_reader :total + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'expires_at' => :'expires_at', + :'justification' => :'justification', + :'total' => :'total' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'expires_at' => :'Time', + :'justification' => :'String', + :'total' => :'Integer' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'expires_at', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TemporaryGrantRequestCreateAttributes` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::TemporaryGrantRequestCreateAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'justification') + self.justification = attributes[:'justification'] + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @justification.nil? + return false if @justification.to_s.length > 4096 + return false if @justification.to_s.length < 1 + return false if @total.nil? + return false if @total > 9223372036854 + return false if @total < 1 + true + end + + # Custom attribute writer method with validation + # @param justification [Object] Object to be assigned + # @!visibility private + def justification=(justification) + if justification.nil? + fail ArgumentError, 'invalid value for "justification", justification cannot be nil.' + end + if justification.to_s.length > 4096 + fail ArgumentError, 'invalid value for "justification", the character length must be smaller than or equal to 4096.' + end + if justification.to_s.length < 1 + fail ArgumentError, 'invalid value for "justification", the character length must be great than or equal to 1.' + end + @justification = justification + end + + # Custom attribute writer method with validation + # @param total [Object] Object to be assigned + # @!visibility private + def total=(total) + if total.nil? + fail ArgumentError, 'invalid value for "total", total cannot be nil.' + end + if total > 9223372036854 + fail ArgumentError, 'invalid value for "total", must be smaller than or equal to 9223372036854.' + end + if total < 1 + fail ArgumentError, 'invalid value for "total", must be greater than or equal to 1.' + end + @total = total + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + expires_at == o.expires_at && + justification == o.justification && + total == o.total + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [expires_at, justification, total].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_create_data.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_create_data.rb new file mode 100644 index 000000000000..26dfcf7328fa --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_create_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The request resource to create. The server generates its ID. + class TemporaryGrantRequestCreateData + include BaseGenericModel + + # Immutable terms and justification for a temporary grant request. + attr_reader :attributes + + # The temporary grant request resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TemporaryGrantRequestCreateAttributes', + :'type' => :'TemporaryGrantRequestType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TemporaryGrantRequestCreateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_create_request.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_create_request.rb new file mode 100644 index 000000000000..61ae82f633bd --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Create a request for the authenticated human user. + class TemporaryGrantRequestCreateRequest + include BaseGenericModel + + # The request resource to create. The server generates its ID. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TemporaryGrantRequestCreateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TemporaryGrantRequestCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_data.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_data.rb new file mode 100644 index 000000000000..a79155b3bf9f --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A temporary grant request resource. + class TemporaryGrantRequestData + include BaseGenericModel + + # 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. + attr_reader :attributes + + # Server-generated request UUID. + attr_reader :id + + # The temporary grant request resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TemporaryGrantRequestAttributes', + :'id' => :'UUID', + :'type' => :'TemporaryGrantRequestType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TemporaryGrantRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_decision.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_decision.rb new file mode 100644 index 000000000000..85edfa2bcfa0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_decision.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Approve the exact submitted total and expiry, or deny the request. + class TemporaryGrantRequestDecision + include BaseEnumModel + + APPROVED = "approved".freeze + DENIED = "denied".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_decision_attributes.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_decision_attributes.rb new file mode 100644 index 000000000000..671b938aab69 --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_decision_attributes.rb @@ -0,0 +1,98 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Binary decision. Overrides, reason fields, and unknown attributes are rejected, including null values. + class TemporaryGrantRequestDecisionAttributes + include BaseGenericModel + + # Approve the exact submitted total and expiry, or deny the request. + attr_reader :decision + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'decision' => :'decision' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'decision' => :'TemporaryGrantRequestDecision' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TemporaryGrantRequestDecisionAttributes` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::TemporaryGrantRequestDecisionAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'decision') + self.decision = attributes[:'decision'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @decision.nil? + true + end + + # Custom attribute writer method with validation + # @param decision [Object] Object to be assigned + # @!visibility private + def decision=(decision) + if decision.nil? + fail ArgumentError, 'invalid value for "decision", decision cannot be nil.' + end + @decision = decision + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + decision == o.decision + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [decision].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_decision_data.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_decision_data.rb new file mode 100644 index 000000000000..17b10761c6fb --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_decision_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A decision on a pending request. + class TemporaryGrantRequestDecisionData + include BaseGenericModel + + # Binary decision. Overrides, reason fields, and unknown attributes are rejected, including null values. + attr_reader :attributes + + # Request UUID. Must match request_id in the path. Missing or mismatched IDs return 400 Bad Request. + attr_reader :id + + # The temporary grant request resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TemporaryGrantRequestDecisionAttributes', + :'id' => :'UUID', + :'type' => :'TemporaryGrantRequestType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TemporaryGrantRequestDecisionData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_decision_request.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_decision_request.rb new file mode 100644 index 000000000000..988dbb0785b3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_decision_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Approve or deny a pending request. + class TemporaryGrantRequestDecisionRequest + include BaseGenericModel + + # A decision on a pending request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TemporaryGrantRequestDecisionData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TemporaryGrantRequestDecisionRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_grant_state.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_grant_state.rb new file mode 100644 index 000000000000..baf03c3523e1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_grant_state.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # 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. + class TemporaryGrantRequestGrantState + include BaseEnumModel + + ACTIVE = "active".freeze + EXPIRED = "expired".freeze + REVOKED = "revoked".freeze + REPLACED = "replaced".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_list_meta.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_list_meta.rb new file mode 100644 index 000000000000..27f1d3fe9c61 --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_list_meta.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Pagination metadata. + class TemporaryGrantRequestListMeta + include BaseGenericModel + + # UUID cursor pagination. A full final page can return a cursor followed by an empty page. + attr_reader :page + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'page' => :'page' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'page' => :'TemporaryGrantRequestPage' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TemporaryGrantRequestListMeta` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'page') + self.page = attributes[:'page'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @page.nil? + true + end + + # Custom attribute writer method with validation + # @param page [Object] Object to be assigned + # @!visibility private + def page=(page) + if page.nil? + fail ArgumentError, 'invalid value for "page", page cannot be nil.' + end + @page = page + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + page == o.page && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [page, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_list_response.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_list_response.rb new file mode 100644 index 000000000000..b8872f2d5797 --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_list_response.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A page of temporary grant requests, ordered by UUID rather than creation time. + class TemporaryGrantRequestListResponse + include BaseGenericModel + + # Requests visible to the authenticated caller. + attr_reader :data + + # Pagination metadata. + attr_reader :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'meta' => :'TemporaryGrantRequestListMeta' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TemporaryGrantRequestListResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + return false if @meta.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Custom attribute writer method with validation + # @param meta [Object] Object to be assigned + # @!visibility private + def meta=(meta) + if meta.nil? + fail ArgumentError, 'invalid value for "meta", meta cannot be nil.' + end + @meta = meta + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + meta == o.meta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_page.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_page.rb new file mode 100644 index 000000000000..766358ac7389 --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_page.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # UUID cursor pagination. A full final page can return a cursor followed by an empty page. + class TemporaryGrantRequestPage + include BaseGenericModel + + # Use this UUID as page[cursor] to retrieve the next page. Omitted when the page is not full. + attr_accessor :next_cursor + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'next_cursor' => :'next_cursor' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'next_cursor' => :'UUID' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TemporaryGrantRequestPage` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'next_cursor') + self.next_cursor = attributes[:'next_cursor'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + next_cursor == o.next_cursor && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [next_cursor, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_response.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_response.rb new file mode 100644 index 000000000000..f4d3e670d2c7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A single temporary grant request. + class TemporaryGrantRequestResponse + include BaseGenericModel + + # A temporary grant request resource. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TemporaryGrantRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TemporaryGrantRequestResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_status.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_status.rb new file mode 100644 index 000000000000..9c20029ceaf6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_status.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The durable request decision, independent of whether its grant is still active. + class TemporaryGrantRequestStatus + include BaseEnumModel + + PENDING = "pending".freeze + APPROVED = "approved".freeze + DENIED = "denied".freeze + CANCELLED = "cancelled".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/temporary_grant_request_type.rb b/lib/datadog_api_client/v2/models/temporary_grant_request_type.rb new file mode 100644 index 000000000000..beac5f8850a8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/temporary_grant_request_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The temporary grant request resource type. + class TemporaryGrantRequestType + include BaseEnumModel + + TEMPORARY_GRANT_REQUESTS = "temporary_grant_requests".freeze + end +end