From 838e9251c8229ccce380ca4aa6c03c910e782806 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 27 May 2026 18:26:12 +0000 Subject: [PATCH] Regenerate client from commit 1e9d9ba of spec repo --- .generator/schemas/v2/openapi.yaml | 632 +++++++++++++++--- docs/datadog_api_client.v2.api.rst | 7 + docs/datadog_api_client.v2.model.rst | 126 +++- .../ListCostTagMetadataMonths.py | 16 - .../DeleteScopesRestriction.py | 15 + .../GetScopesRestriction.py | 17 + .../RegisterOAuthClient.py | 38 ++ .../UpsertScopesRestriction.py | 40 ++ src/datadog_api_client/configuration.py | 5 +- .../v2/api/cloud_cost_management_api.py | 45 -- .../v2/api/o_auth2_client_public_api.py | 191 ++++++ src/datadog_api_client/v2/apis/__init__.py | 2 + .../v2/model/cost_tag_metadata_month.py | 46 -- .../cost_tag_metadata_months_response.py | 40 -- .../model/o_auth_client_registration_error.py | 39 ++ .../o_auth_client_registration_grant_type.py | 38 ++ .../o_auth_client_registration_request.py | 157 +++++ .../o_auth_client_registration_response.py | 84 +++ ...auth_client_registration_response_type.py} | 12 +- .../v2/model/o_auth_oidc_scope.py | 44 ++ .../v2/model/o_auth_scopes_restriction.py | 48 ++ .../o_auth_scopes_restriction_response.py | 42 ++ ..._scopes_restriction_response_attributes.py | 53 ++ ...o_auth_scopes_restriction_response_data.py | 65 ++ .../model/o_auth_scopes_restriction_type.py | 35 + .../upsert_o_auth_scopes_restriction_data.py | 60 ++ ...auth_scopes_restriction_data_attributes.py | 55 ++ ...psert_o_auth_scopes_restriction_request.py | 40 ++ .../upsert_o_auth_scopes_restriction_type.py | 37 + src/datadog_api_client/v2/models/__init__.py | 40 +- .../v2/features/cloud_cost_management.feature | 16 - .../v2/features/oauth2_client_public.feature | 100 +++ tests/v2/features/undo.json | 30 +- 33 files changed, 1911 insertions(+), 304 deletions(-) delete mode 100644 examples/v2/cloud-cost-management/ListCostTagMetadataMonths.py create mode 100644 examples/v2/oauth2-client-public/DeleteScopesRestriction.py create mode 100644 examples/v2/oauth2-client-public/GetScopesRestriction.py create mode 100644 examples/v2/oauth2-client-public/RegisterOAuthClient.py create mode 100644 examples/v2/oauth2-client-public/UpsertScopesRestriction.py create mode 100644 src/datadog_api_client/v2/api/o_auth2_client_public_api.py delete mode 100644 src/datadog_api_client/v2/model/cost_tag_metadata_month.py delete mode 100644 src/datadog_api_client/v2/model/cost_tag_metadata_months_response.py create mode 100644 src/datadog_api_client/v2/model/o_auth_client_registration_error.py create mode 100644 src/datadog_api_client/v2/model/o_auth_client_registration_grant_type.py create mode 100644 src/datadog_api_client/v2/model/o_auth_client_registration_request.py create mode 100644 src/datadog_api_client/v2/model/o_auth_client_registration_response.py rename src/datadog_api_client/v2/model/{cost_tag_metadata_month_type.py => o_auth_client_registration_response_type.py} (56%) create mode 100644 src/datadog_api_client/v2/model/o_auth_oidc_scope.py create mode 100644 src/datadog_api_client/v2/model/o_auth_scopes_restriction.py create mode 100644 src/datadog_api_client/v2/model/o_auth_scopes_restriction_response.py create mode 100644 src/datadog_api_client/v2/model/o_auth_scopes_restriction_response_attributes.py create mode 100644 src/datadog_api_client/v2/model/o_auth_scopes_restriction_response_data.py create mode 100644 src/datadog_api_client/v2/model/o_auth_scopes_restriction_type.py create mode 100644 src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_data.py create mode 100644 src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_data_attributes.py create mode 100644 src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_request.py create mode 100644 src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_type.py create mode 100644 tests/v2/features/oauth2_client_public.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 795f35ac35..453a74bab7 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1026,6 +1026,15 @@ components: required: true schema: type: string + OAuthClientUUIDPathParameter: + description: UUID of the OAuth2 client. + in: path + name: client_uuid + required: true + schema: + example: fafa8e1c-36a5-11f0-a83d-da7ad0900001 + format: uuid + type: string OnDemandTaskId: description: The UUID of the task. example: "6d09294c-9ad9-42fd-a759-a0c1599b4828" @@ -19897,45 +19906,6 @@ components: x-enum-varnames: - "TRUE" - "FALSE" - CostTagMetadataMonth: - description: A month that has Cloud Cost Management tag metadata available for a given provider. - properties: - id: - description: The month, in `YYYY-MM` format. - example: "2026-04" - type: string - type: - $ref: "#/components/schemas/CostTagMetadataMonthType" - required: - - id - - type - type: object - CostTagMetadataMonthType: - default: cost_tag_metadata_month - description: Type of the Cloud Cost Management tag metadata month resource. - enum: - - cost_tag_metadata_month - example: cost_tag_metadata_month - type: string - x-enum-varnames: - - COST_TAG_METADATA_MONTH - CostTagMetadataMonthsResponse: - description: List of months that have Cloud Cost Management tag metadata for the requested provider, ordered most-recent first and capped at 36 months. - example: - data: - - id: "2026-04" - type: cost_tag_metadata_month - - id: "2026-03" - type: cost_tag_metadata_month - properties: - data: - description: List of months that have tag metadata available. - items: - $ref: "#/components/schemas/CostTagMetadataMonth" - type: array - required: - - data - type: object CostTagType: default: cost_tag description: Type of the Cloud Cost Management tag resource. @@ -54635,6 +54605,256 @@ components: - id - type type: object + OAuthClientRegistrationError: + description: Error payload returned by OAuth2 dynamic client registration as defined by RFC 7591. + properties: + error: + description: Single ASCII error code per RFC 7591, such as `invalid_request` or `invalid_client_metadata`. + example: invalid_client_metadata + type: string + error_description: + description: Human-readable description of the error. + example: redirect URI is not well-formed + type: string + required: + - error + - error_description + type: object + OAuthClientRegistrationGrantType: + description: OAuth 2.0 grant type that a registered client may use. + enum: + - authorization_code + - refresh_token + example: authorization_code + type: string + x-enum-varnames: + - AUTHORIZATION_CODE + - REFRESH_TOKEN + OAuthClientRegistrationRequest: + description: Request payload for OAuth2 dynamic client registration as defined by RFC 7591. + properties: + client_name: + description: Human-readable name of the client. Control characters are rejected. + example: Example MCP Client + maxLength: 1000 + type: string + client_uri: + description: URL of the home page of the client. + example: https://example.com + maxLength: 1000 + type: string + grant_types: + description: |- + OAuth 2.0 grant types the client may use. + Defaults to `authorization_code` and `refresh_token` when omitted. + example: + - authorization_code + - refresh_token + items: + $ref: "#/components/schemas/OAuthClientRegistrationGrantType" + type: array + jwks_uri: + description: URL referencing the client's JSON Web Key Set. + example: https://example.com/.well-known/jwks.json + maxLength: 1000 + type: string + logo_uri: + description: URL referencing a logo for the client. + example: https://example.com/logo.png + maxLength: 1000 + type: string + policy_uri: + description: URL pointing to the client's privacy policy. + example: https://example.com/privacy + maxLength: 1000 + type: string + redirect_uris: + description: Array of redirection URI strings used by the client in redirect-based flows. + example: + - https://example.com/oauth/callback + items: + description: Redirection URI registered for the client. + example: https://example.com/oauth/callback + maxLength: 1000 + type: string + type: array + response_types: + description: OAuth 2.0 response types the client may use. Only `code` is supported. + example: + - code + items: + $ref: "#/components/schemas/OAuthClientRegistrationResponseType" + type: array + scope: + description: Space-separated list of scope values the client may request. + example: openid profile + maxLength: 1000 + type: string + token_endpoint_auth_method: + description: Requested authentication method for the token endpoint. Only `none` is supported. + example: none + maxLength: 20 + type: string + tos_uri: + description: URL pointing to the client's terms of service. + example: https://example.com/tos + maxLength: 1000 + type: string + required: + - client_name + - redirect_uris + type: object + OAuthClientRegistrationResponse: + description: Response payload for a successful OAuth2 dynamic client registration as defined by RFC 7591. + properties: + client_id: + description: Unique identifier assigned to the registered client. + example: 72b68208-36a6-11f0-b21b-da7ad0900002 + format: uuid + type: string + client_name: + description: Human-readable name of the client. + example: Example MCP Client + type: string + grant_types: + description: OAuth 2.0 grant types registered for the client. + example: + - authorization_code + - refresh_token + items: + $ref: "#/components/schemas/OAuthClientRegistrationGrantType" + type: array + redirect_uris: + description: Redirection URIs registered for the client. + example: + - https://example.com/oauth/callback + items: + description: Redirection URI registered for the client. + example: https://example.com/oauth/callback + type: string + type: array + response_types: + description: OAuth 2.0 response types registered for the client. + example: + - code + items: + $ref: "#/components/schemas/OAuthClientRegistrationResponseType" + type: array + token_endpoint_auth_method: + description: Authentication method registered for the token endpoint. Always `none`. + example: none + type: string + required: + - client_id + - client_name + - redirect_uris + - token_endpoint_auth_method + - grant_types + - response_types + type: object + OAuthClientRegistrationResponseType: + description: OAuth 2.0 response type that a registered client may use. + enum: + - code + example: code + type: string + x-enum-varnames: + - CODE + OAuthOidcScope: + description: OIDC scope a client may be restricted to. + enum: + - openid + - profile + - email + - offline_access + example: openid + type: string + x-enum-varnames: + - OPENID + - PROFILE + - EMAIL + - OFFLINE_ACCESS + OAuthScopesRestriction: + description: Allowlist of OIDC and permission scopes enforced for the OAuth2 client. + nullable: true + properties: + oidc_scopes: + description: OIDC scopes the client is restricted to. + example: + - openid + - email + items: + $ref: "#/components/schemas/OAuthOidcScope" + type: array + permission_scopes: + description: Datadog permission scopes the client is restricted to. + example: + - dashboards_read + - metrics_read + items: + description: Datadog permission scope name. + example: dashboards_read + type: string + type: array + required: + - oidc_scopes + - permission_scopes + type: object + OAuthScopesRestrictionResponse: + description: Response payload describing the scopes restriction of an OAuth2 client. + properties: + data: + $ref: "#/components/schemas/OAuthScopesRestrictionResponseData" + required: + - data + type: object + OAuthScopesRestrictionResponseAttributes: + description: Attributes of an OAuth2 client scopes restriction. + properties: + required_permission_scopes: + description: |- + Permission scopes automatically required for this client (for example, mobile-app permission scopes). + Returns `null` when no scopes are required. + example: + - mobile_app_access + items: + description: Datadog permission scope name. + example: mobile_app_access + type: string + nullable: true + type: array + scopes_restriction: + $ref: "#/components/schemas/OAuthScopesRestriction" + required: + - scopes_restriction + - required_permission_scopes + type: object + OAuthScopesRestrictionResponseData: + description: Data object of an OAuth2 client scopes restriction response. + properties: + attributes: + $ref: "#/components/schemas/OAuthScopesRestrictionResponseAttributes" + id: + description: UUID of the OAuth2 client this restriction applies to. + example: fafa8e1c-36a5-11f0-a83d-da7ad0900001 + format: uuid + type: string + type: + $ref: "#/components/schemas/OAuthScopesRestrictionType" + required: + - id + - type + - attributes + type: object + OAuthScopesRestrictionType: + default: scopes_restriction + description: JSON:API resource type for an OAuth2 client scopes restriction. + enum: + - scopes_restriction + example: scopes_restriction + type: string + x-enum-varnames: + - SCOPES_RESTRICTION OCIConfig: description: OCI config. properties: @@ -92179,6 +92399,57 @@ components: - id - attributes type: object + UpsertOAuthScopesRestrictionData: + description: Data object of an upsert OAuth2 scopes restriction request. + properties: + attributes: + $ref: "#/components/schemas/UpsertOAuthScopesRestrictionDataAttributes" + type: + $ref: "#/components/schemas/UpsertOAuthScopesRestrictionType" + required: + - type + type: object + UpsertOAuthScopesRestrictionDataAttributes: + description: Attributes of an upsert OAuth2 scopes restriction request. + properties: + oidc_scopes: + description: OIDC scopes the client is allowed to request. + example: + - openid + - email + items: + $ref: "#/components/schemas/OAuthOidcScope" + type: array + permission_scopes: + description: |- + Datadog permission scopes the client is allowed to request. + Each value must be a valid permission name. + example: + - dashboards_read + - metrics_read + items: + description: Datadog permission scope name. + example: dashboards_read + type: string + type: array + type: object + UpsertOAuthScopesRestrictionRequest: + description: Request payload for creating or updating the scopes restriction of an OAuth2 client. + properties: + data: + $ref: "#/components/schemas/UpsertOAuthScopesRestrictionData" + required: + - data + type: object + UpsertOAuthScopesRestrictionType: + default: upsert_scopes_restriction + description: JSON:API resource type for an upsert OAuth2 client scopes restriction request. + enum: + - upsert_scopes_restriction + example: upsert_scopes_restriction + type: string + x-enum-varnames: + - UPSERT_SCOPES_RESTRICTION Urgency: description: Specifies the level of urgency for a routing rule (low, high, or dynamic). enum: @@ -111174,68 +111445,6 @@ 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/cost/tag_metadata/months: - get: - description: |- - List months that have Cloud Cost Management tag metadata for a given provider, - ordered most-recent first. The response is capped at 36 months. - operationId: ListCostTagMetadataMonths - parameters: - - description: |- - Provider to scope the query to. Use the value of the `providername` tag in CCM - (for example, `aws`, `azure`, `gcp`, `Oracle`, `Confluent Cloud`, `Snowflake`). - For costs uploaded through the Custom Costs API, use `custom`. - Values are case-sensitive. - example: aws - in: query - name: filter[provider] - required: true - schema: - type: string - responses: - "200": - content: - application/json: - examples: - default: - value: - data: - - id: "2026-04" - type: cost_tag_metadata_month - - id: "2026-03" - type: cost_tag_metadata_month - schema: - $ref: "#/components/schemas/CostTagMetadataMonthsResponse" - description: OK - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/APIErrorResponse" - description: Bad Request - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/APIErrorResponse" - description: Forbidden - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - apiKeyAuth: [] - appKeyAuth: [] - - AuthZ: - - cloud_cost_management_read - summary: List Cloud Cost Management tag metadata months - tags: - - Cloud Cost Management - "x-permission": - operator: OR - permissions: - - cloud_cost_management_read - x-unstable: |- - **Note**: This endpoint is in preview and is subject to change. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/cost/tag_metadata/orchestrators: get: description: List container orchestrators (for example, `kubernetes`, `ecs`) detected in Cloud Cost Management data for the requested period. @@ -134311,6 +134520,223 @@ paths: summary: Get all aggregated DNS traffic tags: - Cloud Network Monitoring + /api/v2/oauth2/clients/{client_uuid}/scopes_restriction: + delete: + description: Delete the scopes restriction configured for the OAuth2 client. + operationId: DeleteScopesRestriction + parameters: + - $ref: "#/components/parameters/OAuthClientUUIDPathParameter" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete an OAuth2 client scopes restriction + tags: + - OAuth2 Client Public + x-permission: + operator: OR + permissions: + - org_authorized_apps_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get the scopes restriction configured for the OAuth2 client. + operationId: GetScopesRestriction + parameters: + - $ref: "#/components/parameters/OAuthClientUUIDPathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + required_permission_scopes: + scopes_restriction: + oidc_scopes: + - openid + - email + permission_scopes: + - dashboards_read + - metrics_read + id: fafa8e1c-36a5-11f0-a83d-da7ad0900001 + type: scopes_restriction + schema: + $ref: "#/components/schemas/OAuthScopesRestrictionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get an OAuth2 client scopes restriction + tags: + - OAuth2 Client Public + x-permission: + operator: OR + permissions: + - org_authorized_apps_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create or update the scopes restriction configured for the OAuth2 client. + operationId: UpsertScopesRestriction + parameters: + - $ref: "#/components/parameters/OAuthClientUUIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + oidc_scopes: + - openid + - email + permission_scopes: + - dashboards_read + - metrics_read + type: upsert_scopes_restriction + schema: + $ref: "#/components/schemas/UpsertOAuthScopesRestrictionRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + required_permission_scopes: + scopes_restriction: + oidc_scopes: + - openid + - email + permission_scopes: + - dashboards_read + - metrics_read + id: fafa8e1c-36a5-11f0-a83d-da7ad0900001 + type: scopes_restriction + schema: + $ref: "#/components/schemas/OAuthScopesRestrictionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Upsert an OAuth2 client scopes restriction + tags: + - OAuth2 Client Public + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - org_authorized_apps_write + 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/oauth2/register: + post: + description: Register an OAuth2 client using the Dynamic Client Registration protocol defined in RFC 7591. + operationId: RegisterOAuthClient + requestBody: + content: + application/json: + examples: + default: + value: + client_name: Example MCP Client + grant_types: + - authorization_code + - refresh_token + redirect_uris: + - https://example.com/oauth/callback + response_types: + - code + token_endpoint_auth_method: none + schema: + $ref: "#/components/schemas/OAuthClientRegistrationRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + client_id: 72b68208-36a6-11f0-b21b-da7ad0900002 + client_name: Example MCP Client + grant_types: + - authorization_code + - refresh_token + redirect_uris: + - https://example.com/oauth/callback + response_types: + - code + token_endpoint_auth_method: none + schema: + $ref: "#/components/schemas/OAuthClientRegistrationResponse" + description: Created + "400": + content: + application/json: + examples: + default: + value: + error: invalid_client_metadata + error_description: redirect URI is not well-formed + schema: + $ref: "#/components/schemas/OAuthClientRegistrationError" + description: Bad Request + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: [] + summary: Register an OAuth2 client + tags: + - OAuth2 Client Public + x-codegen-request-body-name: body + 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/obs-pipelines/pipelines: get: description: Retrieve a list of pipelines. @@ -167727,6 +168153,10 @@ tags: - description: |- The Network Device Monitoring API allows you to fetch devices and interfaces and their attributes. See the [Network Device Monitoring page](https://docs.datadoghq.com/network_monitoring/) for more information. name: Network Device Monitoring + - description: |- + Configure OAuth2 clients for Datadog. + Supports RFC 7591 Dynamic Client Registration and management of OAuth2 client scopes restrictions. + name: OAuth2 Client Public - description: Auto-generated tag OCI Integration name: OCI Integration - description: |- diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index b983e4d251..6189ddfe73 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -473,6 +473,13 @@ datadog\_api\_client.v2.api.network\_device\_monitoring\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.o\_auth2\_client\_public\_api module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.o_auth2_client_public_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.observability\_pipelines\_api module ---------------------------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 203d259c74..4474e4ed4a 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -7872,27 +7872,6 @@ datadog\_api\_client.v2.model.cost\_tag\_metadata\_daily\_filter module :members: :show-inheritance: -datadog\_api\_client.v2.model.cost\_tag\_metadata\_month module ---------------------------------------------------------------- - -.. automodule:: datadog_api_client.v2.model.cost_tag_metadata_month - :members: - :show-inheritance: - -datadog\_api\_client.v2.model.cost\_tag\_metadata\_month\_type module ---------------------------------------------------------------------- - -.. automodule:: datadog_api_client.v2.model.cost_tag_metadata_month_type - :members: - :show-inheritance: - -datadog\_api\_client.v2.model.cost\_tag\_metadata\_months\_response module --------------------------------------------------------------------------- - -.. automodule:: datadog_api_client.v2.model.cost_tag_metadata_months_response - :members: - :show-inheritance: - datadog\_api\_client.v2.model.cost\_tag\_type module ---------------------------------------------------- @@ -23447,6 +23426,83 @@ datadog\_api\_client.v2.model.nullable\_user\_relationship\_data module :members: :show-inheritance: +datadog\_api\_client.v2.model.o\_auth\_client\_registration\_error module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.o_auth_client_registration_error + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.o\_auth\_client\_registration\_grant\_type module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.o_auth_client_registration_grant_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.o\_auth\_client\_registration\_request module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.o_auth_client_registration_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.o\_auth\_client\_registration\_response module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.o_auth_client_registration_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.o\_auth\_client\_registration\_response\_type module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.o_auth_client_registration_response_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.o\_auth\_oidc\_scope module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.o_auth_oidc_scope + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.o\_auth\_scopes\_restriction module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.o_auth_scopes_restriction + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.o\_auth\_scopes\_restriction\_response module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.o_auth_scopes_restriction_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.o\_auth\_scopes\_restriction\_response\_attributes module +--------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.o_auth_scopes_restriction_response_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.o\_auth\_scopes\_restriction\_response\_data module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.o_auth_scopes_restriction_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.o\_auth\_scopes\_restriction\_type module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.o_auth_scopes_restriction_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.observability\_pipeline module ------------------------------------------------------------ @@ -40240,6 +40296,34 @@ datadog\_api\_client.v2.model.upsert\_cloud\_inventory\_sync\_config\_request\_d :members: :show-inheritance: +datadog\_api\_client.v2.model.upsert\_o\_auth\_scopes\_restriction\_data module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.upsert\_o\_auth\_scopes\_restriction\_data\_attributes module +------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.upsert\_o\_auth\_scopes\_restriction\_request module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.upsert\_o\_auth\_scopes\_restriction\_type module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.urgency module -------------------------------------------- diff --git a/examples/v2/cloud-cost-management/ListCostTagMetadataMonths.py b/examples/v2/cloud-cost-management/ListCostTagMetadataMonths.py deleted file mode 100644 index 1937d1692f..0000000000 --- a/examples/v2/cloud-cost-management/ListCostTagMetadataMonths.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -List Cloud Cost Management tag metadata months returns "OK" response -""" - -from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi - -configuration = Configuration() -configuration.unstable_operations["list_cost_tag_metadata_months"] = True -with ApiClient(configuration) as api_client: - api_instance = CloudCostManagementApi(api_client) - response = api_instance.list_cost_tag_metadata_months( - filter_provider="filter[provider]", - ) - - print(response) diff --git a/examples/v2/oauth2-client-public/DeleteScopesRestriction.py b/examples/v2/oauth2-client-public/DeleteScopesRestriction.py new file mode 100644 index 0000000000..86101a3d85 --- /dev/null +++ b/examples/v2/oauth2-client-public/DeleteScopesRestriction.py @@ -0,0 +1,15 @@ +""" +Delete an OAuth2 client scopes restriction returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.o_auth2_client_public_api import OAuth2ClientPublicApi +from uuid import UUID + +configuration = Configuration() +configuration.unstable_operations["delete_scopes_restriction"] = True +with ApiClient(configuration) as api_client: + api_instance = OAuth2ClientPublicApi(api_client) + api_instance.delete_scopes_restriction( + client_uuid=UUID("fafa8e1c-36a5-11f0-a83d-da7ad0900001"), + ) diff --git a/examples/v2/oauth2-client-public/GetScopesRestriction.py b/examples/v2/oauth2-client-public/GetScopesRestriction.py new file mode 100644 index 0000000000..5e4dde568c --- /dev/null +++ b/examples/v2/oauth2-client-public/GetScopesRestriction.py @@ -0,0 +1,17 @@ +""" +Get an OAuth2 client scopes restriction returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.o_auth2_client_public_api import OAuth2ClientPublicApi +from uuid import UUID + +configuration = Configuration() +configuration.unstable_operations["get_scopes_restriction"] = True +with ApiClient(configuration) as api_client: + api_instance = OAuth2ClientPublicApi(api_client) + response = api_instance.get_scopes_restriction( + client_uuid=UUID("fafa8e1c-36a5-11f0-a83d-da7ad0900001"), + ) + + print(response) diff --git a/examples/v2/oauth2-client-public/RegisterOAuthClient.py b/examples/v2/oauth2-client-public/RegisterOAuthClient.py new file mode 100644 index 0000000000..106acdbc6c --- /dev/null +++ b/examples/v2/oauth2-client-public/RegisterOAuthClient.py @@ -0,0 +1,38 @@ +""" +Register an OAuth2 client returns "Created" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.o_auth2_client_public_api import OAuth2ClientPublicApi +from datadog_api_client.v2.model.o_auth_client_registration_grant_type import OAuthClientRegistrationGrantType +from datadog_api_client.v2.model.o_auth_client_registration_request import OAuthClientRegistrationRequest +from datadog_api_client.v2.model.o_auth_client_registration_response_type import OAuthClientRegistrationResponseType + +body = OAuthClientRegistrationRequest( + client_name="Example MCP Client", + client_uri="https://example.com", + grant_types=[ + OAuthClientRegistrationGrantType.AUTHORIZATION_CODE, + OAuthClientRegistrationGrantType.REFRESH_TOKEN, + ], + jwks_uri="https://example.com/.well-known/jwks.json", + logo_uri="https://example.com/logo.png", + policy_uri="https://example.com/privacy", + redirect_uris=[ + "https://example.com/oauth/callback", + ], + response_types=[ + OAuthClientRegistrationResponseType.CODE, + ], + scope="openid profile", + token_endpoint_auth_method="none", + tos_uri="https://example.com/tos", +) + +configuration = Configuration() +configuration.unstable_operations["register_o_auth_client"] = True +with ApiClient(configuration) as api_client: + api_instance = OAuth2ClientPublicApi(api_client) + response = api_instance.register_o_auth_client(body=body) + + print(response) diff --git a/examples/v2/oauth2-client-public/UpsertScopesRestriction.py b/examples/v2/oauth2-client-public/UpsertScopesRestriction.py new file mode 100644 index 0000000000..ecda5c6b40 --- /dev/null +++ b/examples/v2/oauth2-client-public/UpsertScopesRestriction.py @@ -0,0 +1,40 @@ +""" +Upsert an OAuth2 client scopes restriction returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.o_auth2_client_public_api import OAuth2ClientPublicApi +from datadog_api_client.v2.model.o_auth_oidc_scope import OAuthOidcScope +from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_data import UpsertOAuthScopesRestrictionData +from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_data_attributes import ( + UpsertOAuthScopesRestrictionDataAttributes, +) +from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_request import UpsertOAuthScopesRestrictionRequest +from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_type import UpsertOAuthScopesRestrictionType +from uuid import UUID + +body = UpsertOAuthScopesRestrictionRequest( + data=UpsertOAuthScopesRestrictionData( + attributes=UpsertOAuthScopesRestrictionDataAttributes( + oidc_scopes=[ + OAuthOidcScope.OPENID, + OAuthOidcScope.EMAIL, + ], + permission_scopes=[ + "dashboards_read", + "metrics_read", + ], + ), + type=UpsertOAuthScopesRestrictionType.UPSERT_SCOPES_RESTRICTION, + ), +) + +configuration = Configuration() +configuration.unstable_operations["upsert_scopes_restriction"] = True +with ApiClient(configuration) as api_client: + api_instance = OAuth2ClientPublicApi(api_client) + response = api_instance.upsert_scopes_restriction( + client_uuid=UUID("fafa8e1c-36a5-11f0-a83d-da7ad0900001"), body=body + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index f58ee9964c..ac07f0278e 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -445,7 +445,6 @@ def __init__( "v2.list_cost_tag_key_sources": False, "v2.list_cost_tag_metadata": False, "v2.list_cost_tag_metadata_metrics": False, - "v2.list_cost_tag_metadata_months": False, "v2.list_cost_tag_metadata_orchestrators": False, "v2.search_cost_recommendations": False, "v2.create_dashboard_secure_embed": False, @@ -579,6 +578,10 @@ def __init__( "v2.update_monitor_user_template": False, "v2.validate_existing_monitor_user_template": False, "v2.validate_monitor_user_template": False, + "v2.delete_scopes_restriction": False, + "v2.get_scopes_restriction": False, + "v2.register_o_auth_client": False, + "v2.upsert_scopes_restriction": False, "v2.bulk_update_org_group_memberships": False, "v2.create_org_group": False, "v2.create_org_group_policy": False, diff --git a/src/datadog_api_client/v2/api/cloud_cost_management_api.py b/src/datadog_api_client/v2/api/cloud_cost_management_api.py index 87248097b9..654644f9dd 100644 --- a/src/datadog_api_client/v2/api/cloud_cost_management_api.py +++ b/src/datadog_api_client/v2/api/cloud_cost_management_api.py @@ -65,7 +65,6 @@ from datadog_api_client.v2.model.cost_tag_metadata_daily_filter import CostTagMetadataDailyFilter from datadog_api_client.v2.model.cost_currency_response import CostCurrencyResponse from datadog_api_client.v2.model.cost_metrics_response import CostMetricsResponse -from datadog_api_client.v2.model.cost_tag_metadata_months_response import CostTagMetadataMonthsResponse from datadog_api_client.v2.model.cost_orchestrators_response import CostOrchestratorsResponse from datadog_api_client.v2.model.cost_tag_key_sources_response import CostTagKeySourcesResponse from datadog_api_client.v2.model.cost_tags_response import CostTagsResponse @@ -1283,29 +1282,6 @@ def __init__(self, api_client=None): api_client=api_client, ) - self._list_cost_tag_metadata_months_endpoint = _Endpoint( - settings={ - "response_type": (CostTagMetadataMonthsResponse,), - "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], - "endpoint_path": "/api/v2/cost/tag_metadata/months", - "operation_id": "list_cost_tag_metadata_months", - "http_method": "GET", - "version": "v2", - }, - params_map={ - "filter_provider": { - "required": True, - "openapi_types": (str,), - "attribute": "filter[provider]", - "location": "query", - }, - }, - headers_map={ - "accept": ["application/json"], - }, - api_client=api_client, - ) - self._list_cost_tag_metadata_orchestrators_endpoint = _Endpoint( settings={ "response_type": (CostOrchestratorsResponse,), @@ -2796,27 +2772,6 @@ def list_cost_tag_metadata_metrics( return self._list_cost_tag_metadata_metrics_endpoint.call_with_http_info(**kwargs) - def list_cost_tag_metadata_months( - self, - filter_provider: str, - ) -> CostTagMetadataMonthsResponse: - """List Cloud Cost Management tag metadata months. - - List months that have Cloud Cost Management tag metadata for a given provider, - ordered most-recent first. The response is capped at 36 months. - - :param filter_provider: Provider to scope the query to. Use the value of the ``providername`` tag in CCM - (for example, ``aws`` , ``azure`` , ``gcp`` , ``Oracle`` , ``Confluent Cloud`` , ``Snowflake`` ). - For costs uploaded through the Custom Costs API, use ``custom``. - Values are case-sensitive. - :type filter_provider: str - :rtype: CostTagMetadataMonthsResponse - """ - kwargs: Dict[str, Any] = {} - kwargs["filter_provider"] = filter_provider - - return self._list_cost_tag_metadata_months_endpoint.call_with_http_info(**kwargs) - def list_cost_tag_metadata_orchestrators( self, filter_month: str, diff --git a/src/datadog_api_client/v2/api/o_auth2_client_public_api.py b/src/datadog_api_client/v2/api/o_auth2_client_public_api.py new file mode 100644 index 0000000000..fb59506fc6 --- /dev/null +++ b/src/datadog_api_client/v2/api/o_auth2_client_public_api.py @@ -0,0 +1,191 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.model_utils import ( + UUID, +) +from datadog_api_client.v2.model.o_auth_scopes_restriction_response import OAuthScopesRestrictionResponse +from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_request import UpsertOAuthScopesRestrictionRequest +from datadog_api_client.v2.model.o_auth_client_registration_response import OAuthClientRegistrationResponse +from datadog_api_client.v2.model.o_auth_client_registration_request import OAuthClientRegistrationRequest + + +class OAuth2ClientPublicApi: + """ + Configure OAuth2 clients for Datadog. + Supports RFC 7591 Dynamic Client Registration and management of OAuth2 client scopes restrictions. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._delete_scopes_restriction_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/oauth2/clients/{client_uuid}/scopes_restriction", + "operation_id": "delete_scopes_restriction", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "client_uuid": { + "required": True, + "openapi_types": (UUID,), + "attribute": "client_uuid", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._get_scopes_restriction_endpoint = _Endpoint( + settings={ + "response_type": (OAuthScopesRestrictionResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/oauth2/clients/{client_uuid}/scopes_restriction", + "operation_id": "get_scopes_restriction", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "client_uuid": { + "required": True, + "openapi_types": (UUID,), + "attribute": "client_uuid", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._register_o_auth_client_endpoint = _Endpoint( + settings={ + "response_type": (OAuthClientRegistrationResponse,), + "auth": [], + "endpoint_path": "/api/v2/oauth2/register", + "operation_id": "register_o_auth_client", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (OAuthClientRegistrationRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._upsert_scopes_restriction_endpoint = _Endpoint( + settings={ + "response_type": (OAuthScopesRestrictionResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/oauth2/clients/{client_uuid}/scopes_restriction", + "operation_id": "upsert_scopes_restriction", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "client_uuid": { + "required": True, + "openapi_types": (UUID,), + "attribute": "client_uuid", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (UpsertOAuthScopesRestrictionRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def delete_scopes_restriction( + self, + client_uuid: UUID, + ) -> None: + """Delete an OAuth2 client scopes restriction. + + Delete the scopes restriction configured for the OAuth2 client. + + :param client_uuid: UUID of the OAuth2 client. + :type client_uuid: UUID + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["client_uuid"] = client_uuid + + return self._delete_scopes_restriction_endpoint.call_with_http_info(**kwargs) + + def get_scopes_restriction( + self, + client_uuid: UUID, + ) -> OAuthScopesRestrictionResponse: + """Get an OAuth2 client scopes restriction. + + Get the scopes restriction configured for the OAuth2 client. + + :param client_uuid: UUID of the OAuth2 client. + :type client_uuid: UUID + :rtype: OAuthScopesRestrictionResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["client_uuid"] = client_uuid + + return self._get_scopes_restriction_endpoint.call_with_http_info(**kwargs) + + def register_o_auth_client( + self, + body: OAuthClientRegistrationRequest, + ) -> OAuthClientRegistrationResponse: + """Register an OAuth2 client. + + Register an OAuth2 client using the Dynamic Client Registration protocol defined in RFC 7591. + + :type body: OAuthClientRegistrationRequest + :rtype: OAuthClientRegistrationResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._register_o_auth_client_endpoint.call_with_http_info(**kwargs) + + def upsert_scopes_restriction( + self, + client_uuid: UUID, + body: UpsertOAuthScopesRestrictionRequest, + ) -> OAuthScopesRestrictionResponse: + """Upsert an OAuth2 client scopes restriction. + + Create or update the scopes restriction configured for the OAuth2 client. + + :param client_uuid: UUID of the OAuth2 client. + :type client_uuid: UUID + :type body: UpsertOAuthScopesRestrictionRequest + :rtype: OAuthScopesRestrictionResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["client_uuid"] = client_uuid + + kwargs["body"] = body + + return self._upsert_scopes_restriction_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index 6f2ebf73d1..0e18bb1881 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -65,6 +65,7 @@ from datadog_api_client.v2.api.model_lab_api_api import ModelLabAPIApi from datadog_api_client.v2.api.monitors_api import MonitorsApi from datadog_api_client.v2.api.network_device_monitoring_api import NetworkDeviceMonitoringApi +from datadog_api_client.v2.api.o_auth2_client_public_api import OAuth2ClientPublicApi from datadog_api_client.v2.api.oci_integration_api import OCIIntegrationApi from datadog_api_client.v2.api.observability_pipelines_api import ObservabilityPipelinesApi from datadog_api_client.v2.api.okta_integration_api import OktaIntegrationApi @@ -181,6 +182,7 @@ "ModelLabAPIApi", "MonitorsApi", "NetworkDeviceMonitoringApi", + "OAuth2ClientPublicApi", "OCIIntegrationApi", "ObservabilityPipelinesApi", "OktaIntegrationApi", diff --git a/src/datadog_api_client/v2/model/cost_tag_metadata_month.py b/src/datadog_api_client/v2/model/cost_tag_metadata_month.py deleted file mode 100644 index 4289c4ec43..0000000000 --- a/src/datadog_api_client/v2/model/cost_tag_metadata_month.py +++ /dev/null @@ -1,46 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -# This product includes software developed at Datadog (https://www.datadoghq.com/). -# Copyright 2019-Present Datadog, Inc. -from __future__ import annotations - -from typing import TYPE_CHECKING - -from datadog_api_client.model_utils import ( - ModelNormal, - cached_property, -) - - -if TYPE_CHECKING: - from datadog_api_client.v2.model.cost_tag_metadata_month_type import CostTagMetadataMonthType - - -class CostTagMetadataMonth(ModelNormal): - @cached_property - def openapi_types(_): - from datadog_api_client.v2.model.cost_tag_metadata_month_type import CostTagMetadataMonthType - - return { - "id": (str,), - "type": (CostTagMetadataMonthType,), - } - - attribute_map = { - "id": "id", - "type": "type", - } - - def __init__(self_, id: str, type: CostTagMetadataMonthType, **kwargs): - """ - A month that has Cloud Cost Management tag metadata available for a given provider. - - :param id: The month, in ``YYYY-MM`` format. - :type id: str - - :param type: Type of the Cloud Cost Management tag metadata month resource. - :type type: CostTagMetadataMonthType - """ - super().__init__(kwargs) - - self_.id = id - self_.type = type diff --git a/src/datadog_api_client/v2/model/cost_tag_metadata_months_response.py b/src/datadog_api_client/v2/model/cost_tag_metadata_months_response.py deleted file mode 100644 index a1a70c72ce..0000000000 --- a/src/datadog_api_client/v2/model/cost_tag_metadata_months_response.py +++ /dev/null @@ -1,40 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -# This product includes software developed at Datadog (https://www.datadoghq.com/). -# Copyright 2019-Present Datadog, Inc. -from __future__ import annotations - -from typing import List, TYPE_CHECKING - -from datadog_api_client.model_utils import ( - ModelNormal, - cached_property, -) - - -if TYPE_CHECKING: - from datadog_api_client.v2.model.cost_tag_metadata_month import CostTagMetadataMonth - - -class CostTagMetadataMonthsResponse(ModelNormal): - @cached_property - def openapi_types(_): - from datadog_api_client.v2.model.cost_tag_metadata_month import CostTagMetadataMonth - - return { - "data": ([CostTagMetadataMonth],), - } - - attribute_map = { - "data": "data", - } - - def __init__(self_, data: List[CostTagMetadataMonth], **kwargs): - """ - List of months that have Cloud Cost Management tag metadata for the requested provider, ordered most-recent first and capped at 36 months. - - :param data: List of months that have tag metadata available. - :type data: [CostTagMetadataMonth] - """ - super().__init__(kwargs) - - self_.data = data diff --git a/src/datadog_api_client/v2/model/o_auth_client_registration_error.py b/src/datadog_api_client/v2/model/o_auth_client_registration_error.py new file mode 100644 index 0000000000..541a138237 --- /dev/null +++ b/src/datadog_api_client/v2/model/o_auth_client_registration_error.py @@ -0,0 +1,39 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class OAuthClientRegistrationError(ModelNormal): + @cached_property + def openapi_types(_): + return { + "error": (str,), + "error_description": (str,), + } + + attribute_map = { + "error": "error", + "error_description": "error_description", + } + + def __init__(self_, error: str, error_description: str, **kwargs): + """ + Error payload returned by OAuth2 dynamic client registration as defined by RFC 7591. + + :param error: Single ASCII error code per RFC 7591, such as ``invalid_request`` or ``invalid_client_metadata``. + :type error: str + + :param error_description: Human-readable description of the error. + :type error_description: str + """ + super().__init__(kwargs) + + self_.error = error + self_.error_description = error_description diff --git a/src/datadog_api_client/v2/model/o_auth_client_registration_grant_type.py b/src/datadog_api_client/v2/model/o_auth_client_registration_grant_type.py new file mode 100644 index 0000000000..1a36fa31ef --- /dev/null +++ b/src/datadog_api_client/v2/model/o_auth_client_registration_grant_type.py @@ -0,0 +1,38 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OAuthClientRegistrationGrantType(ModelSimple): + """ + OAuth 2.0 grant type that a registered client may use. + + :param value: Must be one of ["authorization_code", "refresh_token"]. + :type value: str + """ + + allowed_values = { + "authorization_code", + "refresh_token", + } + AUTHORIZATION_CODE: ClassVar["OAuthClientRegistrationGrantType"] + REFRESH_TOKEN: ClassVar["OAuthClientRegistrationGrantType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OAuthClientRegistrationGrantType.AUTHORIZATION_CODE = OAuthClientRegistrationGrantType("authorization_code") +OAuthClientRegistrationGrantType.REFRESH_TOKEN = OAuthClientRegistrationGrantType("refresh_token") diff --git a/src/datadog_api_client/v2/model/o_auth_client_registration_request.py b/src/datadog_api_client/v2/model/o_auth_client_registration_request.py new file mode 100644 index 0000000000..545537cd2d --- /dev/null +++ b/src/datadog_api_client/v2/model/o_auth_client_registration_request.py @@ -0,0 +1,157 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.o_auth_client_registration_grant_type import OAuthClientRegistrationGrantType + from datadog_api_client.v2.model.o_auth_client_registration_response_type import OAuthClientRegistrationResponseType + + +class OAuthClientRegistrationRequest(ModelNormal): + validations = { + "client_name": { + "max_length": 1000, + }, + "client_uri": { + "max_length": 1000, + }, + "jwks_uri": { + "max_length": 1000, + }, + "logo_uri": { + "max_length": 1000, + }, + "policy_uri": { + "max_length": 1000, + }, + "scope": { + "max_length": 1000, + }, + "token_endpoint_auth_method": { + "max_length": 20, + }, + "tos_uri": { + "max_length": 1000, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.o_auth_client_registration_grant_type import OAuthClientRegistrationGrantType + from datadog_api_client.v2.model.o_auth_client_registration_response_type import ( + OAuthClientRegistrationResponseType, + ) + + return { + "client_name": (str,), + "client_uri": (str,), + "grant_types": ([OAuthClientRegistrationGrantType],), + "jwks_uri": (str,), + "logo_uri": (str,), + "policy_uri": (str,), + "redirect_uris": ([str],), + "response_types": ([OAuthClientRegistrationResponseType],), + "scope": (str,), + "token_endpoint_auth_method": (str,), + "tos_uri": (str,), + } + + attribute_map = { + "client_name": "client_name", + "client_uri": "client_uri", + "grant_types": "grant_types", + "jwks_uri": "jwks_uri", + "logo_uri": "logo_uri", + "policy_uri": "policy_uri", + "redirect_uris": "redirect_uris", + "response_types": "response_types", + "scope": "scope", + "token_endpoint_auth_method": "token_endpoint_auth_method", + "tos_uri": "tos_uri", + } + + def __init__( + self_, + client_name: str, + redirect_uris: List[str], + client_uri: Union[str, UnsetType] = unset, + grant_types: Union[List[OAuthClientRegistrationGrantType], UnsetType] = unset, + jwks_uri: Union[str, UnsetType] = unset, + logo_uri: Union[str, UnsetType] = unset, + policy_uri: Union[str, UnsetType] = unset, + response_types: Union[List[OAuthClientRegistrationResponseType], UnsetType] = unset, + scope: Union[str, UnsetType] = unset, + token_endpoint_auth_method: Union[str, UnsetType] = unset, + tos_uri: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Request payload for OAuth2 dynamic client registration as defined by RFC 7591. + + :param client_name: Human-readable name of the client. Control characters are rejected. + :type client_name: str + + :param client_uri: URL of the home page of the client. + :type client_uri: str, optional + + :param grant_types: OAuth 2.0 grant types the client may use. + Defaults to ``authorization_code`` and ``refresh_token`` when omitted. + :type grant_types: [OAuthClientRegistrationGrantType], optional + + :param jwks_uri: URL referencing the client's JSON Web Key Set. + :type jwks_uri: str, optional + + :param logo_uri: URL referencing a logo for the client. + :type logo_uri: str, optional + + :param policy_uri: URL pointing to the client's privacy policy. + :type policy_uri: str, optional + + :param redirect_uris: Array of redirection URI strings used by the client in redirect-based flows. + :type redirect_uris: [str] + + :param response_types: OAuth 2.0 response types the client may use. Only ``code`` is supported. + :type response_types: [OAuthClientRegistrationResponseType], optional + + :param scope: Space-separated list of scope values the client may request. + :type scope: str, optional + + :param token_endpoint_auth_method: Requested authentication method for the token endpoint. Only ``none`` is supported. + :type token_endpoint_auth_method: str, optional + + :param tos_uri: URL pointing to the client's terms of service. + :type tos_uri: str, optional + """ + if client_uri is not unset: + kwargs["client_uri"] = client_uri + if grant_types is not unset: + kwargs["grant_types"] = grant_types + if jwks_uri is not unset: + kwargs["jwks_uri"] = jwks_uri + if logo_uri is not unset: + kwargs["logo_uri"] = logo_uri + if policy_uri is not unset: + kwargs["policy_uri"] = policy_uri + if response_types is not unset: + kwargs["response_types"] = response_types + if scope is not unset: + kwargs["scope"] = scope + if token_endpoint_auth_method is not unset: + kwargs["token_endpoint_auth_method"] = token_endpoint_auth_method + if tos_uri is not unset: + kwargs["tos_uri"] = tos_uri + super().__init__(kwargs) + + self_.client_name = client_name + self_.redirect_uris = redirect_uris diff --git a/src/datadog_api_client/v2/model/o_auth_client_registration_response.py b/src/datadog_api_client/v2/model/o_auth_client_registration_response.py new file mode 100644 index 0000000000..4f8d54ed9c --- /dev/null +++ b/src/datadog_api_client/v2/model/o_auth_client_registration_response.py @@ -0,0 +1,84 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.o_auth_client_registration_grant_type import OAuthClientRegistrationGrantType + from datadog_api_client.v2.model.o_auth_client_registration_response_type import OAuthClientRegistrationResponseType + + +class OAuthClientRegistrationResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.o_auth_client_registration_grant_type import OAuthClientRegistrationGrantType + from datadog_api_client.v2.model.o_auth_client_registration_response_type import ( + OAuthClientRegistrationResponseType, + ) + + return { + "client_id": (UUID,), + "client_name": (str,), + "grant_types": ([OAuthClientRegistrationGrantType],), + "redirect_uris": ([str],), + "response_types": ([OAuthClientRegistrationResponseType],), + "token_endpoint_auth_method": (str,), + } + + attribute_map = { + "client_id": "client_id", + "client_name": "client_name", + "grant_types": "grant_types", + "redirect_uris": "redirect_uris", + "response_types": "response_types", + "token_endpoint_auth_method": "token_endpoint_auth_method", + } + + def __init__( + self_, + client_id: UUID, + client_name: str, + grant_types: List[OAuthClientRegistrationGrantType], + redirect_uris: List[str], + response_types: List[OAuthClientRegistrationResponseType], + token_endpoint_auth_method: str, + **kwargs, + ): + """ + Response payload for a successful OAuth2 dynamic client registration as defined by RFC 7591. + + :param client_id: Unique identifier assigned to the registered client. + :type client_id: UUID + + :param client_name: Human-readable name of the client. + :type client_name: str + + :param grant_types: OAuth 2.0 grant types registered for the client. + :type grant_types: [OAuthClientRegistrationGrantType] + + :param redirect_uris: Redirection URIs registered for the client. + :type redirect_uris: [str] + + :param response_types: OAuth 2.0 response types registered for the client. + :type response_types: [OAuthClientRegistrationResponseType] + + :param token_endpoint_auth_method: Authentication method registered for the token endpoint. Always ``none``. + :type token_endpoint_auth_method: str + """ + super().__init__(kwargs) + + self_.client_id = client_id + self_.client_name = client_name + self_.grant_types = grant_types + self_.redirect_uris = redirect_uris + self_.response_types = response_types + self_.token_endpoint_auth_method = token_endpoint_auth_method diff --git a/src/datadog_api_client/v2/model/cost_tag_metadata_month_type.py b/src/datadog_api_client/v2/model/o_auth_client_registration_response_type.py similarity index 56% rename from src/datadog_api_client/v2/model/cost_tag_metadata_month_type.py rename to src/datadog_api_client/v2/model/o_auth_client_registration_response_type.py index 3389c4d686..32b5f3c5a2 100644 --- a/src/datadog_api_client/v2/model/cost_tag_metadata_month_type.py +++ b/src/datadog_api_client/v2/model/o_auth_client_registration_response_type.py @@ -12,18 +12,18 @@ from typing import ClassVar -class CostTagMetadataMonthType(ModelSimple): +class OAuthClientRegistrationResponseType(ModelSimple): """ - Type of the Cloud Cost Management tag metadata month resource. + OAuth 2.0 response type that a registered client may use. - :param value: If omitted defaults to "cost_tag_metadata_month". Must be one of ["cost_tag_metadata_month"]. + :param value: If omitted defaults to "code". Must be one of ["code"]. :type value: str """ allowed_values = { - "cost_tag_metadata_month", + "code", } - COST_TAG_METADATA_MONTH: ClassVar["CostTagMetadataMonthType"] + CODE: ClassVar["OAuthClientRegistrationResponseType"] @cached_property def openapi_types(_): @@ -32,4 +32,4 @@ def openapi_types(_): } -CostTagMetadataMonthType.COST_TAG_METADATA_MONTH = CostTagMetadataMonthType("cost_tag_metadata_month") +OAuthClientRegistrationResponseType.CODE = OAuthClientRegistrationResponseType("code") diff --git a/src/datadog_api_client/v2/model/o_auth_oidc_scope.py b/src/datadog_api_client/v2/model/o_auth_oidc_scope.py new file mode 100644 index 0000000000..6243ad84c2 --- /dev/null +++ b/src/datadog_api_client/v2/model/o_auth_oidc_scope.py @@ -0,0 +1,44 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OAuthOidcScope(ModelSimple): + """ + OIDC scope a client may be restricted to. + + :param value: Must be one of ["openid", "profile", "email", "offline_access"]. + :type value: str + """ + + allowed_values = { + "openid", + "profile", + "email", + "offline_access", + } + OPENID: ClassVar["OAuthOidcScope"] + PROFILE: ClassVar["OAuthOidcScope"] + EMAIL: ClassVar["OAuthOidcScope"] + OFFLINE_ACCESS: ClassVar["OAuthOidcScope"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OAuthOidcScope.OPENID = OAuthOidcScope("openid") +OAuthOidcScope.PROFILE = OAuthOidcScope("profile") +OAuthOidcScope.EMAIL = OAuthOidcScope("email") +OAuthOidcScope.OFFLINE_ACCESS = OAuthOidcScope("offline_access") diff --git a/src/datadog_api_client/v2/model/o_auth_scopes_restriction.py b/src/datadog_api_client/v2/model/o_auth_scopes_restriction.py new file mode 100644 index 0000000000..f4774fa527 --- /dev/null +++ b/src/datadog_api_client/v2/model/o_auth_scopes_restriction.py @@ -0,0 +1,48 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.o_auth_oidc_scope import OAuthOidcScope + + +class OAuthScopesRestriction(ModelNormal): + _nullable = True + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.o_auth_oidc_scope import OAuthOidcScope + + return { + "oidc_scopes": ([OAuthOidcScope],), + "permission_scopes": ([str],), + } + + attribute_map = { + "oidc_scopes": "oidc_scopes", + "permission_scopes": "permission_scopes", + } + + def __init__(self_, oidc_scopes: List[OAuthOidcScope], permission_scopes: List[str], **kwargs): + """ + Allowlist of OIDC and permission scopes enforced for the OAuth2 client. + + :param oidc_scopes: OIDC scopes the client is restricted to. + :type oidc_scopes: [OAuthOidcScope] + + :param permission_scopes: Datadog permission scopes the client is restricted to. + :type permission_scopes: [str] + """ + super().__init__(kwargs) + + self_.oidc_scopes = oidc_scopes + self_.permission_scopes = permission_scopes diff --git a/src/datadog_api_client/v2/model/o_auth_scopes_restriction_response.py b/src/datadog_api_client/v2/model/o_auth_scopes_restriction_response.py new file mode 100644 index 0000000000..82c84c3439 --- /dev/null +++ b/src/datadog_api_client/v2/model/o_auth_scopes_restriction_response.py @@ -0,0 +1,42 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.o_auth_scopes_restriction_response_data import OAuthScopesRestrictionResponseData + + +class OAuthScopesRestrictionResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.o_auth_scopes_restriction_response_data import ( + OAuthScopesRestrictionResponseData, + ) + + return { + "data": (OAuthScopesRestrictionResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: OAuthScopesRestrictionResponseData, **kwargs): + """ + Response payload describing the scopes restriction of an OAuth2 client. + + :param data: Data object of an OAuth2 client scopes restriction response. + :type data: OAuthScopesRestrictionResponseData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/o_auth_scopes_restriction_response_attributes.py b/src/datadog_api_client/v2/model/o_auth_scopes_restriction_response_attributes.py new file mode 100644 index 0000000000..4cd1104bf3 --- /dev/null +++ b/src/datadog_api_client/v2/model/o_auth_scopes_restriction_response_attributes.py @@ -0,0 +1,53 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.o_auth_scopes_restriction import OAuthScopesRestriction + + +class OAuthScopesRestrictionResponseAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.o_auth_scopes_restriction import OAuthScopesRestriction + + return { + "required_permission_scopes": ([str], none_type), + "scopes_restriction": (OAuthScopesRestriction,), + } + + attribute_map = { + "required_permission_scopes": "required_permission_scopes", + "scopes_restriction": "scopes_restriction", + } + + def __init__( + self_, + required_permission_scopes: Union[List[str], none_type], + scopes_restriction: Union[OAuthScopesRestriction, none_type], + **kwargs, + ): + """ + Attributes of an OAuth2 client scopes restriction. + + :param required_permission_scopes: Permission scopes automatically required for this client (for example, mobile-app permission scopes). + Returns ``null`` when no scopes are required. + :type required_permission_scopes: [str], none_type + + :param scopes_restriction: Allowlist of OIDC and permission scopes enforced for the OAuth2 client. + :type scopes_restriction: OAuthScopesRestriction, none_type + """ + super().__init__(kwargs) + + self_.required_permission_scopes = required_permission_scopes + self_.scopes_restriction = scopes_restriction diff --git a/src/datadog_api_client/v2/model/o_auth_scopes_restriction_response_data.py b/src/datadog_api_client/v2/model/o_auth_scopes_restriction_response_data.py new file mode 100644 index 0000000000..c2987b439c --- /dev/null +++ b/src/datadog_api_client/v2/model/o_auth_scopes_restriction_response_data.py @@ -0,0 +1,65 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.o_auth_scopes_restriction_response_attributes import ( + OAuthScopesRestrictionResponseAttributes, + ) + from datadog_api_client.v2.model.o_auth_scopes_restriction_type import OAuthScopesRestrictionType + + +class OAuthScopesRestrictionResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.o_auth_scopes_restriction_response_attributes import ( + OAuthScopesRestrictionResponseAttributes, + ) + from datadog_api_client.v2.model.o_auth_scopes_restriction_type import OAuthScopesRestrictionType + + return { + "attributes": (OAuthScopesRestrictionResponseAttributes,), + "id": (UUID,), + "type": (OAuthScopesRestrictionType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: OAuthScopesRestrictionResponseAttributes, + id: UUID, + type: OAuthScopesRestrictionType, + **kwargs, + ): + """ + Data object of an OAuth2 client scopes restriction response. + + :param attributes: Attributes of an OAuth2 client scopes restriction. + :type attributes: OAuthScopesRestrictionResponseAttributes + + :param id: UUID of the OAuth2 client this restriction applies to. + :type id: UUID + + :param type: JSON:API resource type for an OAuth2 client scopes restriction. + :type type: OAuthScopesRestrictionType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/o_auth_scopes_restriction_type.py b/src/datadog_api_client/v2/model/o_auth_scopes_restriction_type.py new file mode 100644 index 0000000000..ff83d7845c --- /dev/null +++ b/src/datadog_api_client/v2/model/o_auth_scopes_restriction_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class OAuthScopesRestrictionType(ModelSimple): + """ + JSON:API resource type for an OAuth2 client scopes restriction. + + :param value: If omitted defaults to "scopes_restriction". Must be one of ["scopes_restriction"]. + :type value: str + """ + + allowed_values = { + "scopes_restriction", + } + SCOPES_RESTRICTION: ClassVar["OAuthScopesRestrictionType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +OAuthScopesRestrictionType.SCOPES_RESTRICTION = OAuthScopesRestrictionType("scopes_restriction") diff --git a/src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_data.py b/src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_data.py new file mode 100644 index 0000000000..2b85b7c964 --- /dev/null +++ b/src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_data.py @@ -0,0 +1,60 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_data_attributes import ( + UpsertOAuthScopesRestrictionDataAttributes, + ) + from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_type import UpsertOAuthScopesRestrictionType + + +class UpsertOAuthScopesRestrictionData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_data_attributes import ( + UpsertOAuthScopesRestrictionDataAttributes, + ) + from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_type import UpsertOAuthScopesRestrictionType + + return { + "attributes": (UpsertOAuthScopesRestrictionDataAttributes,), + "type": (UpsertOAuthScopesRestrictionType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + type: UpsertOAuthScopesRestrictionType, + attributes: Union[UpsertOAuthScopesRestrictionDataAttributes, UnsetType] = unset, + **kwargs, + ): + """ + Data object of an upsert OAuth2 scopes restriction request. + + :param attributes: Attributes of an upsert OAuth2 scopes restriction request. + :type attributes: UpsertOAuthScopesRestrictionDataAttributes, optional + + :param type: JSON:API resource type for an upsert OAuth2 client scopes restriction request. + :type type: UpsertOAuthScopesRestrictionType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_data_attributes.py b/src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_data_attributes.py new file mode 100644 index 0000000000..61c8166bf7 --- /dev/null +++ b/src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_data_attributes.py @@ -0,0 +1,55 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.o_auth_oidc_scope import OAuthOidcScope + + +class UpsertOAuthScopesRestrictionDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.o_auth_oidc_scope import OAuthOidcScope + + return { + "oidc_scopes": ([OAuthOidcScope],), + "permission_scopes": ([str],), + } + + attribute_map = { + "oidc_scopes": "oidc_scopes", + "permission_scopes": "permission_scopes", + } + + def __init__( + self_, + oidc_scopes: Union[List[OAuthOidcScope], UnsetType] = unset, + permission_scopes: Union[List[str], UnsetType] = unset, + **kwargs, + ): + """ + Attributes of an upsert OAuth2 scopes restriction request. + + :param oidc_scopes: OIDC scopes the client is allowed to request. + :type oidc_scopes: [OAuthOidcScope], optional + + :param permission_scopes: Datadog permission scopes the client is allowed to request. + Each value must be a valid permission name. + :type permission_scopes: [str], optional + """ + if oidc_scopes is not unset: + kwargs["oidc_scopes"] = oidc_scopes + if permission_scopes is not unset: + kwargs["permission_scopes"] = permission_scopes + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_request.py b/src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_request.py new file mode 100644 index 0000000000..6b2c3a492b --- /dev/null +++ b/src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_request.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_data import UpsertOAuthScopesRestrictionData + + +class UpsertOAuthScopesRestrictionRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_data import UpsertOAuthScopesRestrictionData + + return { + "data": (UpsertOAuthScopesRestrictionData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: UpsertOAuthScopesRestrictionData, **kwargs): + """ + Request payload for creating or updating the scopes restriction of an OAuth2 client. + + :param data: Data object of an upsert OAuth2 scopes restriction request. + :type data: UpsertOAuthScopesRestrictionData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_type.py b/src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_type.py new file mode 100644 index 0000000000..fe790e56b3 --- /dev/null +++ b/src/datadog_api_client/v2/model/upsert_o_auth_scopes_restriction_type.py @@ -0,0 +1,37 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class UpsertOAuthScopesRestrictionType(ModelSimple): + """ + JSON:API resource type for an upsert OAuth2 client scopes restriction request. + + :param value: If omitted defaults to "upsert_scopes_restriction". Must be one of ["upsert_scopes_restriction"]. + :type value: str + """ + + allowed_values = { + "upsert_scopes_restriction", + } + UPSERT_SCOPES_RESTRICTION: ClassVar["UpsertOAuthScopesRestrictionType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +UpsertOAuthScopesRestrictionType.UPSERT_SCOPES_RESTRICTION = UpsertOAuthScopesRestrictionType( + "upsert_scopes_restriction" +) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 71577769a7..651c6d0431 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1434,9 +1434,6 @@ from datadog_api_client.v2.model.cost_tag_key_type import CostTagKeyType from datadog_api_client.v2.model.cost_tag_keys_response import CostTagKeysResponse from datadog_api_client.v2.model.cost_tag_metadata_daily_filter import CostTagMetadataDailyFilter -from datadog_api_client.v2.model.cost_tag_metadata_month import CostTagMetadataMonth -from datadog_api_client.v2.model.cost_tag_metadata_month_type import CostTagMetadataMonthType -from datadog_api_client.v2.model.cost_tag_metadata_months_response import CostTagMetadataMonthsResponse from datadog_api_client.v2.model.cost_tag_type import CostTagType from datadog_api_client.v2.model.cost_tags_response import CostTagsResponse from datadog_api_client.v2.model.coverage_summary_attributes import CoverageSummaryAttributes @@ -4399,6 +4396,19 @@ from datadog_api_client.v2.model.nullable_relationship_to_user_data import NullableRelationshipToUserData from datadog_api_client.v2.model.nullable_user_relationship import NullableUserRelationship from datadog_api_client.v2.model.nullable_user_relationship_data import NullableUserRelationshipData +from datadog_api_client.v2.model.o_auth_client_registration_error import OAuthClientRegistrationError +from datadog_api_client.v2.model.o_auth_client_registration_grant_type import OAuthClientRegistrationGrantType +from datadog_api_client.v2.model.o_auth_client_registration_request import OAuthClientRegistrationRequest +from datadog_api_client.v2.model.o_auth_client_registration_response import OAuthClientRegistrationResponse +from datadog_api_client.v2.model.o_auth_client_registration_response_type import OAuthClientRegistrationResponseType +from datadog_api_client.v2.model.o_auth_oidc_scope import OAuthOidcScope +from datadog_api_client.v2.model.o_auth_scopes_restriction import OAuthScopesRestriction +from datadog_api_client.v2.model.o_auth_scopes_restriction_response import OAuthScopesRestrictionResponse +from datadog_api_client.v2.model.o_auth_scopes_restriction_response_attributes import ( + OAuthScopesRestrictionResponseAttributes, +) +from datadog_api_client.v2.model.o_auth_scopes_restriction_response_data import OAuthScopesRestrictionResponseData +from datadog_api_client.v2.model.o_auth_scopes_restriction_type import OAuthScopesRestrictionType from datadog_api_client.v2.model.oci_config import OCIConfig from datadog_api_client.v2.model.oci_config_attributes import OCIConfigAttributes from datadog_api_client.v2.model.oci_config_type import OCIConfigType @@ -8225,6 +8235,12 @@ from datadog_api_client.v2.model.upsert_cloud_inventory_sync_config_request_data import ( UpsertCloudInventorySyncConfigRequestData, ) +from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_data import UpsertOAuthScopesRestrictionData +from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_data_attributes import ( + UpsertOAuthScopesRestrictionDataAttributes, +) +from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_request import UpsertOAuthScopesRestrictionRequest +from datadog_api_client.v2.model.upsert_o_auth_scopes_restriction_type import UpsertOAuthScopesRestrictionType from datadog_api_client.v2.model.urgency import Urgency from datadog_api_client.v2.model.url_param import UrlParam from datadog_api_client.v2.model.url_param_update import UrlParamUpdate @@ -9542,9 +9558,6 @@ "CostTagKeyType", "CostTagKeysResponse", "CostTagMetadataDailyFilter", - "CostTagMetadataMonth", - "CostTagMetadataMonthType", - "CostTagMetadataMonthsResponse", "CostTagType", "CostTagsResponse", "CoverageSummaryAttributes", @@ -11767,6 +11780,17 @@ "NullableRelationshipToUserData", "NullableUserRelationship", "NullableUserRelationshipData", + "OAuthClientRegistrationError", + "OAuthClientRegistrationGrantType", + "OAuthClientRegistrationRequest", + "OAuthClientRegistrationResponse", + "OAuthClientRegistrationResponseType", + "OAuthOidcScope", + "OAuthScopesRestriction", + "OAuthScopesRestrictionResponse", + "OAuthScopesRestrictionResponseAttributes", + "OAuthScopesRestrictionResponseData", + "OAuthScopesRestrictionType", "OCIConfig", "OCIConfigAttributes", "OCIConfigType", @@ -14173,6 +14197,10 @@ "UpsertCloudInventorySyncConfigRequest", "UpsertCloudInventorySyncConfigRequestAttributes", "UpsertCloudInventorySyncConfigRequestData", + "UpsertOAuthScopesRestrictionData", + "UpsertOAuthScopesRestrictionDataAttributes", + "UpsertOAuthScopesRestrictionRequest", + "UpsertOAuthScopesRestrictionType", "Urgency", "UrlParam", "UrlParamUpdate", diff --git a/tests/v2/features/cloud_cost_management.feature b/tests/v2/features/cloud_cost_management.feature index b41928f4cb..17779e4599 100644 --- a/tests/v2/features/cloud_cost_management.feature +++ b/tests/v2/features/cloud_cost_management.feature @@ -606,22 +606,6 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-cost-management - Scenario: List Cloud Cost Management tag metadata months returns "Bad Request" response - Given operation "ListCostTagMetadataMonths" enabled - And new "ListCostTagMetadataMonths" request - And request contains "filter[provider]" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/cloud-cost-management - Scenario: List Cloud Cost Management tag metadata months returns "OK" response - Given operation "ListCostTagMetadataMonths" enabled - And new "ListCostTagMetadataMonths" request - And request contains "filter[provider]" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-cost-management Scenario: List Cloud Cost Management tag sources returns "Bad Request" response Given operation "ListCostTagKeySources" enabled diff --git a/tests/v2/features/oauth2_client_public.feature b/tests/v2/features/oauth2_client_public.feature new file mode 100644 index 0000000000..a5c7d195ef --- /dev/null +++ b/tests/v2/features/oauth2_client_public.feature @@ -0,0 +1,100 @@ +@endpoint(oauth2-client-public) @endpoint(oauth2-client-public-v2) +Feature: OAuth2 Client Public + Configure OAuth2 clients for Datadog. Supports RFC 7591 Dynamic Client + Registration and management of OAuth2 client scopes restrictions. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "OAuth2ClientPublic" API + + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Delete an OAuth2 client scopes restriction returns "Bad Request" response + Given operation "DeleteScopesRestriction" enabled + And new "DeleteScopesRestriction" request + And request contains "client_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Delete an OAuth2 client scopes restriction returns "No Content" response + Given operation "DeleteScopesRestriction" enabled + And new "DeleteScopesRestriction" request + And request contains "client_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Delete an OAuth2 client scopes restriction returns "Not Found" response + Given operation "DeleteScopesRestriction" enabled + And new "DeleteScopesRestriction" request + And request contains "client_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Get an OAuth2 client scopes restriction returns "Bad Request" response + Given operation "GetScopesRestriction" enabled + And new "GetScopesRestriction" request + And request contains "client_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Get an OAuth2 client scopes restriction returns "Not Found" response + Given operation "GetScopesRestriction" enabled + And new "GetScopesRestriction" request + And request contains "client_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Get an OAuth2 client scopes restriction returns "OK" response + Given operation "GetScopesRestriction" enabled + And new "GetScopesRestriction" request + And request contains "client_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Register an OAuth2 client returns "Bad Request" response + Given operation "RegisterOAuthClient" enabled + And new "RegisterOAuthClient" request + And body with value {"client_name": "Example MCP Client", "client_uri": "https://example.com", "grant_types": ["authorization_code", "refresh_token"], "jwks_uri": "https://example.com/.well-known/jwks.json", "logo_uri": "https://example.com/logo.png", "policy_uri": "https://example.com/privacy", "redirect_uris": ["https://example.com/oauth/callback"], "response_types": ["code"], "scope": "openid profile", "token_endpoint_auth_method": "none", "tos_uri": "https://example.com/tos"} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Register an OAuth2 client returns "Created" response + Given operation "RegisterOAuthClient" enabled + And new "RegisterOAuthClient" request + And body with value {"client_name": "Example MCP Client", "client_uri": "https://example.com", "grant_types": ["authorization_code", "refresh_token"], "jwks_uri": "https://example.com/.well-known/jwks.json", "logo_uri": "https://example.com/logo.png", "policy_uri": "https://example.com/privacy", "redirect_uris": ["https://example.com/oauth/callback"], "response_types": ["code"], "scope": "openid profile", "token_endpoint_auth_method": "none", "tos_uri": "https://example.com/tos"} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Upsert an OAuth2 client scopes restriction returns "Bad Request" response + Given operation "UpsertScopesRestriction" enabled + And new "UpsertScopesRestriction" request + And request contains "client_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"oidc_scopes": ["openid", "email"], "permission_scopes": ["dashboards_read", "metrics_read"]}, "type": "upsert_scopes_restriction"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Upsert an OAuth2 client scopes restriction returns "Not Found" response + Given operation "UpsertScopesRestriction" enabled + And new "UpsertScopesRestriction" request + And request contains "client_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"oidc_scopes": ["openid", "email"], "permission_scopes": ["dashboards_read", "metrics_read"]}, "type": "upsert_scopes_restriction"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/delegated-auth-login + Scenario: Upsert an OAuth2 client scopes restriction returns "OK" response + Given operation "UpsertScopesRestriction" enabled + And new "UpsertScopesRestriction" request + And request contains "client_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"oidc_scopes": ["openid", "email"], "permission_scopes": ["dashboards_read", "metrics_read"]}, "type": "upsert_scopes_restriction"}} + When the request is sent + Then the response status is 200 OK diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 09d6acff28..b55e20fd7e 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1898,12 +1898,6 @@ "type": "safe" } }, - "ListCostTagMetadataMonths": { - "tag": "Cloud Cost Management", - "undo": { - "type": "safe" - } - }, "ListCostTagMetadataOrchestrators": { "tag": "Cloud Cost Management", "undo": { @@ -4672,6 +4666,30 @@ "type": "safe" } }, + "DeleteScopesRestriction": { + "tag": "OAuth2 Client Public", + "undo": { + "type": "idempotent" + } + }, + "GetScopesRestriction": { + "tag": "OAuth2 Client Public", + "undo": { + "type": "safe" + } + }, + "UpsertScopesRestriction": { + "tag": "OAuth2 Client Public", + "undo": { + "type": "idempotent" + } + }, + "RegisterOAuthClient": { + "tag": "OAuth2 Client Public", + "undo": { + "type": "idempotent" + } + }, "ListPipelines": { "tag": "Observability Pipelines", "undo": {