From facbd9150308fdb1db52a3e89ab86043d8a8b207 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 27 May 2026 18:26:15 +0000 Subject: [PATCH] Regenerate client from commit 1e9d9ba of spec repo --- .generator/schemas/v2/openapi.yaml | 632 ++++++++++++--- features/v2/cloud_cost_management.feature | 16 - features/v2/oauth2_client_public.feature | 100 +++ features/v2/undo.json | 30 +- packages/datadog-api-client/README.md | 1 + .../src/support/scenarios_model_mapping.ts | 39 +- .../src/v2/CloudCostManagementApi.ts | 157 ---- .../cloud_cost_management/src/v2/index.ts | 4 - .../src/v2/models/CostTagMetadataMonthType.ts | 9 - .../src/v2/models/TypingInfo.ts | 5 - services/o_auth2_client_public/.yarnrc.yml | 1 + services/o_auth2_client_public/README.md | 45 ++ services/o_auth2_client_public/package.json | 43 ++ services/o_auth2_client_public/src/index.ts | 3 + .../src/v2/OAuth2ClientPublicApi.ts | 720 ++++++++++++++++++ .../o_auth2_client_public/src/v2/index.ts | 27 + .../src/v2/models/APIErrorResponse.ts | 45 ++ .../src/v2/models/JSONAPIErrorItem.ts | 78 ++ .../src/v2/models/JSONAPIErrorItemSource.ts | 60 ++ .../src/v2/models/JSONAPIErrorResponse.ts | 47 ++ .../models/OAuthClientRegistrationError.ts} | 26 +- .../OAuthClientRegistrationGrantType.ts | 11 + .../models/OAuthClientRegistrationRequest.ts | 130 ++++ .../models/OAuthClientRegistrationResponse.ts | 94 +++ .../OAuthClientRegistrationResponseType.ts | 7 + .../src/v2/models/OAuthOidcScope.ts | 15 + .../src/v2/models/OAuthScopesRestriction.ts | 56 ++ .../models/OAuthScopesRestrictionResponse.ts} | 14 +- ...AuthScopesRestrictionResponseAttributes.ts | 57 ++ .../OAuthScopesRestrictionResponseData.ts | 67 ++ .../v2/models/OAuthScopesRestrictionType.ts | 9 + .../src/v2/models/TypingInfo.ts | 45 ++ .../UpsertOAuthScopesRestrictionData.ts | 56 ++ ...ertOAuthScopesRestrictionDataAttributes.ts | 55 ++ .../UpsertOAuthScopesRestrictionRequest.ts | 47 ++ .../UpsertOAuthScopesRestrictionType.ts | 9 + services/o_auth2_client_public/tsconfig.json | 28 + yarn.lock | 9 + 38 files changed, 2471 insertions(+), 326 deletions(-) create mode 100644 features/v2/oauth2_client_public.feature delete mode 100644 services/cloud_cost_management/src/v2/models/CostTagMetadataMonthType.ts create mode 100644 services/o_auth2_client_public/.yarnrc.yml create mode 100644 services/o_auth2_client_public/README.md create mode 100644 services/o_auth2_client_public/package.json create mode 100644 services/o_auth2_client_public/src/index.ts create mode 100644 services/o_auth2_client_public/src/v2/OAuth2ClientPublicApi.ts create mode 100644 services/o_auth2_client_public/src/v2/index.ts create mode 100644 services/o_auth2_client_public/src/v2/models/APIErrorResponse.ts create mode 100644 services/o_auth2_client_public/src/v2/models/JSONAPIErrorItem.ts create mode 100644 services/o_auth2_client_public/src/v2/models/JSONAPIErrorItemSource.ts create mode 100644 services/o_auth2_client_public/src/v2/models/JSONAPIErrorResponse.ts rename services/{cloud_cost_management/src/v2/models/CostTagMetadataMonth.ts => o_auth2_client_public/src/v2/models/OAuthClientRegistrationError.ts} (60%) create mode 100644 services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationGrantType.ts create mode 100644 services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationRequest.ts create mode 100644 services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationResponse.ts create mode 100644 services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationResponseType.ts create mode 100644 services/o_auth2_client_public/src/v2/models/OAuthOidcScope.ts create mode 100644 services/o_auth2_client_public/src/v2/models/OAuthScopesRestriction.ts rename services/{cloud_cost_management/src/v2/models/CostTagMetadataMonthsResponse.ts => o_auth2_client_public/src/v2/models/OAuthScopesRestrictionResponse.ts} (63%) create mode 100644 services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionResponseAttributes.ts create mode 100644 services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionResponseData.ts create mode 100644 services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionType.ts create mode 100644 services/o_auth2_client_public/src/v2/models/TypingInfo.ts create mode 100644 services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionData.ts create mode 100644 services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionDataAttributes.ts create mode 100644 services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionRequest.ts create mode 100644 services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionType.ts create mode 100644 services/o_auth2_client_public/tsconfig.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 795f35ac355f..453a74bab791 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/features/v2/cloud_cost_management.feature b/features/v2/cloud_cost_management.feature index b41928f4cb9d..17779e4599e4 100644 --- a/features/v2/cloud_cost_management.feature +++ b/features/v2/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/features/v2/oauth2_client_public.feature b/features/v2/oauth2_client_public.feature new file mode 100644 index 000000000000..a5c7d195efa7 --- /dev/null +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index 09d6acff288b..b55e20fd7eba 100644 --- a/features/v2/undo.json +++ b/features/v2/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": { diff --git a/packages/datadog-api-client/README.md b/packages/datadog-api-client/README.md index a9e37547d099..cc9e8ae4d487 100644 --- a/packages/datadog-api-client/README.md +++ b/packages/datadog-api-client/README.md @@ -420,6 +420,7 @@ apiInstance | Monitors | @datadog/datadog-api-client-monitors | [README.md](../../services/monitors/README.md) | | Network Device Monitoring | @datadog/datadog-api-client-network-device-monitoring | [README.md](../../services/network-device-monitoring/README.md) | | Notebooks | @datadog/datadog-api-client-notebooks | [README.md](../../services/notebooks/README.md) | +| OAuth2 Client Public | @datadog/datadog-api-client-o-auth2-client-public | [README.md](../../services/o-auth2-client-public/README.md) | | Observability Pipelines | @datadog/datadog-api-client-observability-pipelines | [README.md](../../services/observability-pipelines/README.md) | | OCI Integration | @datadog/datadog-api-client-oci-integration | [README.md](../../services/oci-integration/README.md) | | Okta Integration | @datadog/datadog-api-client-okta-integration | [README.md](../../services/okta-integration/README.md) | diff --git a/private/bdd_runner/src/support/scenarios_model_mapping.ts b/private/bdd_runner/src/support/scenarios_model_mapping.ts index cfe096fad74e..81c0c3a0e007 100644 --- a/private/bdd_runner/src/support/scenarios_model_mapping.ts +++ b/private/bdd_runner/src/support/scenarios_model_mapping.ts @@ -7515,13 +7515,6 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "CostMetricsResponse", }, - "CloudCostManagementApi.V2.ListCostTagMetadataMonths": { - filterProvider: { - type: "string", - format: "", - }, - operationResponseType: "CostTagMetadataMonthsResponse", - }, "CloudCostManagementApi.V2.ListCostTagMetadataOrchestrators": { filterMonth: { type: "string", @@ -10983,6 +10976,38 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "SingleAggregatedDnsResponseArray", }, + "OAuth2ClientPublicApi.V2.GetScopesRestriction": { + clientUuid: { + type: "string", + format: "uuid", + }, + operationResponseType: "OAuthScopesRestrictionResponse", + }, + "OAuth2ClientPublicApi.V2.UpsertScopesRestriction": { + clientUuid: { + type: "string", + format: "uuid", + }, + body: { + type: "UpsertOAuthScopesRestrictionRequest", + format: "", + }, + operationResponseType: "OAuthScopesRestrictionResponse", + }, + "OAuth2ClientPublicApi.V2.DeleteScopesRestriction": { + clientUuid: { + type: "string", + format: "uuid", + }, + operationResponseType: "{}", + }, + "OAuth2ClientPublicApi.V2.RegisterOAuthClient": { + body: { + type: "OAuthClientRegistrationRequest", + format: "", + }, + operationResponseType: "OAuthClientRegistrationResponse", + }, "ObservabilityPipelinesApi.V2.ListPipelines": { pageSize: { type: "number", diff --git a/services/cloud_cost_management/src/v2/CloudCostManagementApi.ts b/services/cloud_cost_management/src/v2/CloudCostManagementApi.ts index ac19f5c3ecd8..4e025eb097a9 100644 --- a/services/cloud_cost_management/src/v2/CloudCostManagementApi.ts +++ b/services/cloud_cost_management/src/v2/CloudCostManagementApi.ts @@ -61,7 +61,6 @@ import { CostTagKeyResponse } from "./models/CostTagKeyResponse"; import { CostTagKeySourcesResponse } from "./models/CostTagKeySourcesResponse"; import { CostTagKeysResponse } from "./models/CostTagKeysResponse"; import { CostTagMetadataDailyFilter } from "./models/CostTagMetadataDailyFilter"; -import { CostTagMetadataMonthsResponse } from "./models/CostTagMetadataMonthsResponse"; import { CostTagsResponse } from "./models/CostTagsResponse"; import { CreateRulesetRequest } from "./models/CreateRulesetRequest"; import { CustomCostsFileGetResponse } from "./models/CustomCostsFileGetResponse"; @@ -2710,67 +2709,6 @@ export class CloudCostManagementApiRequestFactory extends BaseAPIRequestFactory return requestContext; } - public async listCostTagMetadataMonths( - filterProvider: string, - _options?: Configuration, - ): Promise { - const _config = _options || this.configuration; - - if ( - !_config.unstableOperations[ - "CloudCostManagementApi.v2.listCostTagMetadataMonths" - ] - ) { - throw new Error( - "Unstable operation 'listCostTagMetadataMonths' is disabled. Enable it by setting `configuration.unstableOperations['CloudCostManagementApi.v2.listCostTagMetadataMonths'] = true`", - ); - } - - // verify required parameter 'filterProvider' is not null or undefined - if (filterProvider === null || filterProvider === undefined) { - throw new RequiredError("filterProvider", "listCostTagMetadataMonths"); - } - - // Path Params - const localVarPath = "/api/v2/cost/tag_metadata/months"; - - // Make Request Context - const { server, overrides } = _config.getServerAndOverrides( - "CloudCostManagementApi.v2.listCostTagMetadataMonths", - CloudCostManagementApi.operationServers, - ); - const requestContext = server.makeRequestContext( - localVarPath, - HttpMethod.GET, - overrides, - ); - requestContext.setHeaderParam("Accept", "application/json"); - requestContext.setHttpConfig(_config.httpConfig); - - // Set User-Agent - if (this.userAgent) { - requestContext.setHeaderParam("User-Agent", this.userAgent); - } - - // Query Params - if (filterProvider !== undefined) { - requestContext.setQueryParam( - "filter[provider]", - serialize(filterProvider, TypingInfo, "string", ""), - "", - ); - } - - // Apply auth methods - applySecurityAuthentication(_config, requestContext, [ - "apiKeyAuth", - "appKeyAuth", - "AuthZ", - ]); - - return requestContext; - } - public async listCostTagMetadataOrchestrators( filterMonth: string, filterProvider?: string, @@ -6315,66 +6253,6 @@ export class CloudCostManagementApiResponseProcessor { ); } - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to listCostTagMetadataMonths - * @throws ApiException if the response code was not in [200, 299] - */ - public async listCostTagMetadataMonths( - response: ResponseContext, - ): Promise { - const contentType = normalizeMediaType(response.headers["content-type"]); - if (response.httpStatusCode === 200) { - const body: CostTagMetadataMonthsResponse = deserialize( - parse(await response.body.text(), contentType), - TypingInfo, - "CostTagMetadataMonthsResponse", - ) as CostTagMetadataMonthsResponse; - return body; - } - if ( - response.httpStatusCode === 400 || - response.httpStatusCode === 403 || - response.httpStatusCode === 429 - ) { - const bodyText = parse(await response.body.text(), contentType); - let body: APIErrorResponse; - try { - body = deserialize( - bodyText, - TypingInfo, - "APIErrorResponse", - ) as APIErrorResponse; - } catch (error) { - logger.debug(`Got error deserializing error: ${error}`); - throw new ApiException( - response.httpStatusCode, - bodyText, - ); - } - throw new ApiException(response.httpStatusCode, body); - } - - // Work around for missing responses in specification, e.g. for petstore.yaml - if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: CostTagMetadataMonthsResponse = deserialize( - parse(await response.body.text(), contentType), - TypingInfo, - "CostTagMetadataMonthsResponse", - "", - ) as CostTagMetadataMonthsResponse; - return body; - } - - const body = (await response.body.text()) || ""; - throw new ApiException( - response.httpStatusCode, - 'Unknown API Status Code!\nBody: "' + body + '"', - ); - } - /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -8066,17 +7944,6 @@ export interface CloudCostManagementApiListCostTagMetadataMetricsRequest { filterProvider?: string; } -export interface CloudCostManagementApiListCostTagMetadataMonthsRequest { - /** - * 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 string - */ - filterProvider: string; -} - export interface CloudCostManagementApiListCostTagMetadataOrchestratorsRequest { /** * The month to scope the query to, in `YYYY-MM` format. @@ -9249,30 +9116,6 @@ export class CloudCostManagementApi { }); } - /** - * 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 param The request object - */ - public listCostTagMetadataMonths( - param: CloudCostManagementApiListCostTagMetadataMonthsRequest, - options?: Configuration, - ): Promise { - const requestContextPromise = this.requestFactory.listCostTagMetadataMonths( - param.filterProvider, - options, - ); - return requestContextPromise.then((requestContext) => { - return this.configuration.httpApi - .send(requestContext) - .then((responseContext) => { - return this.responseProcessor.listCostTagMetadataMonths( - responseContext, - ); - }); - }); - } - /** * List container orchestrators (for example, `kubernetes`, `ecs`) detected in Cloud Cost Management data for the requested period. * @param param The request object diff --git a/services/cloud_cost_management/src/v2/index.ts b/services/cloud_cost_management/src/v2/index.ts index 06f5c1763147..229670bafd48 100644 --- a/services/cloud_cost_management/src/v2/index.ts +++ b/services/cloud_cost_management/src/v2/index.ts @@ -35,7 +35,6 @@ export { CloudCostManagementApiListCostTagKeysRequest, CloudCostManagementApiListCostTagMetadataRequest, CloudCostManagementApiListCostTagMetadataMetricsRequest, - CloudCostManagementApiListCostTagMetadataMonthsRequest, CloudCostManagementApiListCostTagMetadataOrchestratorsRequest, CloudCostManagementApiListCostTagsRequest, CloudCostManagementApiListCustomCostsFilesRequest, @@ -201,9 +200,6 @@ export { CostTagKeySourceType } from "./models/CostTagKeySourceType"; export { CostTagKeysResponse } from "./models/CostTagKeysResponse"; export { CostTagKeyType } from "./models/CostTagKeyType"; export { CostTagMetadataDailyFilter } from "./models/CostTagMetadataDailyFilter"; -export { CostTagMetadataMonth } from "./models/CostTagMetadataMonth"; -export { CostTagMetadataMonthsResponse } from "./models/CostTagMetadataMonthsResponse"; -export { CostTagMetadataMonthType } from "./models/CostTagMetadataMonthType"; export { CostTagsResponse } from "./models/CostTagsResponse"; export { CostTagType } from "./models/CostTagType"; export { CreateRulesetRequest } from "./models/CreateRulesetRequest"; diff --git a/services/cloud_cost_management/src/v2/models/CostTagMetadataMonthType.ts b/services/cloud_cost_management/src/v2/models/CostTagMetadataMonthType.ts deleted file mode 100644 index d058ed42e0ae..000000000000 --- a/services/cloud_cost_management/src/v2/models/CostTagMetadataMonthType.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { UnparsedObject } from "@datadog/datadog-api-client"; - -/** - * Type of the Cloud Cost Management tag metadata month resource. - */ -export type CostTagMetadataMonthType = - | typeof COST_TAG_METADATA_MONTH - | UnparsedObject; -export const COST_TAG_METADATA_MONTH = "cost_tag_metadata_month"; diff --git a/services/cloud_cost_management/src/v2/models/TypingInfo.ts b/services/cloud_cost_management/src/v2/models/TypingInfo.ts index cacd5314f043..31149e5280e9 100644 --- a/services/cloud_cost_management/src/v2/models/TypingInfo.ts +++ b/services/cloud_cost_management/src/v2/models/TypingInfo.ts @@ -119,8 +119,6 @@ import { CostTagKeySource } from "./CostTagKeySource"; import { CostTagKeySourceAttributes } from "./CostTagKeySourceAttributes"; import { CostTagKeySourcesResponse } from "./CostTagKeySourcesResponse"; import { CostTagKeysResponse } from "./CostTagKeysResponse"; -import { CostTagMetadataMonth } from "./CostTagMetadataMonth"; -import { CostTagMetadataMonthsResponse } from "./CostTagMetadataMonthsResponse"; import { CostTagsResponse } from "./CostTagsResponse"; import { CreateRulesetRequest } from "./CreateRulesetRequest"; import { CreateRulesetRequestData } from "./CreateRulesetRequestData"; @@ -236,7 +234,6 @@ export const TypingInfo: ModelTypingInfo = { CostTagKeySourceType: ["cost_tag_key_source"], CostTagKeyType: ["cost_tag_key"], CostTagMetadataDailyFilter: ["true", "false"], - CostTagMetadataMonthType: ["cost_tag_metadata_month"], CostTagType: ["cost_tag"], CreateRulesetRequestDataType: ["create_ruleset"], DataAttributesRulesItemsIfTagExists: ["append", "do_not_apply", "replace"], @@ -411,8 +408,6 @@ export const TypingInfo: ModelTypingInfo = { CostTagKeySourceAttributes: CostTagKeySourceAttributes, CostTagKeySourcesResponse: CostTagKeySourcesResponse, CostTagKeysResponse: CostTagKeysResponse, - CostTagMetadataMonth: CostTagMetadataMonth, - CostTagMetadataMonthsResponse: CostTagMetadataMonthsResponse, CostTagsResponse: CostTagsResponse, CreateRulesetRequest: CreateRulesetRequest, CreateRulesetRequestData: CreateRulesetRequestData, diff --git a/services/o_auth2_client_public/.yarnrc.yml b/services/o_auth2_client_public/.yarnrc.yml new file mode 100644 index 000000000000..3186f3f0795a --- /dev/null +++ b/services/o_auth2_client_public/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/services/o_auth2_client_public/README.md b/services/o_auth2_client_public/README.md new file mode 100644 index 000000000000..d430a9ab69cf --- /dev/null +++ b/services/o_auth2_client_public/README.md @@ -0,0 +1,45 @@ +# @datadog/datadog-api-client-o-auth2-client-public + +## Description + +Configure OAuth2 clients for Datadog. +Supports RFC 7591 Dynamic Client Registration and management of OAuth2 client scopes restrictions. + +## Navigation + +- [Installation](#installation) +- [Getting Started](#getting-started) + +## Installation + +```sh +# NPM +npm install @datadog/datadog-api-client-o-auth2-client-public +# Yarn +yarn add @datadog/datadog-api-client-o-auth2-client-public +``` + +## Getting Started +```ts +import { createConfiguration } from "@datadog/datadog-api-client"; +import { OAuth2ClientPublicApiV2 } from "@datadog/datadog-api-client-o-auth2-client-public"; +import { v2 } from "@datadog/datadog-api-client-o-auth2-client-public"; + +const configuration = createConfiguration(); +// Enable unstable operations +const configurationOpts = { + unstableOperations: { + "OAuth2ClientPublicApi.v2.getScopesRestriction": true + } +} + +const configuration = createConfiguration(configurationOpts); +const apiInstance = new OAuth2ClientPublicApiV2(configuration); +const params = {/* parameters */}; + +apiInstance.getScopesRestriction(params).then((data) => { + console.log("API called successfully. Returned data: " + JSON.stringify(data)); +}).catch((error) => { + console.error("Error calling API: " + error); +}); +``` \ No newline at end of file diff --git a/services/o_auth2_client_public/package.json b/services/o_auth2_client_public/package.json new file mode 100644 index 000000000000..5518d22828ad --- /dev/null +++ b/services/o_auth2_client_public/package.json @@ -0,0 +1,43 @@ +{ + "name": "@datadog/datadog-api-client-o-auth2-client-public", + "description": "", + "author": "", + "keywords": [ + "api", + "fetch", + "typescript" + ], + "license": "Apache-2.0", + "licenses": [ + { + "type": "Apache-2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/DataDog/datadog-api-client-typescript.git", + "directory": "services/o-auth2-client-public" + }, + "files": [ + "dist/**/*" + ], + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts": { + "prepack": "yarn workspace @datadog/datadog-api-client build && yarn build", + "build": "yarn generate-version-files && tsc", + "generate-version-files": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts" + }, + "dependencies": { + "@datadog/datadog-api-client": "^2.0.0-beta.2" + }, + "devDependencies": { + "typescript": "5.8.3" + }, + "engines": { + "node": ">=18.0.0" + }, + "version": "0.0.1", + "packageManager": "yarn@4.9.1" +} diff --git a/services/o_auth2_client_public/src/index.ts b/services/o_auth2_client_public/src/index.ts new file mode 100644 index 000000000000..f32340d3b7b3 --- /dev/null +++ b/services/o_auth2_client_public/src/index.ts @@ -0,0 +1,3 @@ +export * as v2 from "./v2"; + +export { OAuth2ClientPublicApi as OAuth2ClientPublicApiV2 } from "./v2/OAuth2ClientPublicApi"; diff --git a/services/o_auth2_client_public/src/v2/OAuth2ClientPublicApi.ts b/services/o_auth2_client_public/src/v2/OAuth2ClientPublicApi.ts new file mode 100644 index 000000000000..e42c5f3f8285 --- /dev/null +++ b/services/o_auth2_client_public/src/v2/OAuth2ClientPublicApi.ts @@ -0,0 +1,720 @@ +import { + ApiException, + BaseAPIRequestFactory, + BaseServerConfiguration, + buildUserAgent, + Configuration, + createConfiguration, + deserialize, + getPreferredMediaType, + HttpMethod, + isBrowser, + logger, + normalizeMediaType, + parse, + RequiredError, + RequestContext, + ResponseContext, + serialize, + ServerConfiguration, + stringify, + applySecurityAuthentication, +} from "@datadog/datadog-api-client"; + +import { TypingInfo } from "./models/TypingInfo"; +import { APIErrorResponse } from "./models/APIErrorResponse"; +import { JSONAPIErrorResponse } from "./models/JSONAPIErrorResponse"; +import { OAuthClientRegistrationError } from "./models/OAuthClientRegistrationError"; +import { OAuthClientRegistrationRequest } from "./models/OAuthClientRegistrationRequest"; +import { OAuthClientRegistrationResponse } from "./models/OAuthClientRegistrationResponse"; +import { OAuthScopesRestrictionResponse } from "./models/OAuthScopesRestrictionResponse"; +import { UpsertOAuthScopesRestrictionRequest } from "./models/UpsertOAuthScopesRestrictionRequest"; +import { version } from "../version"; + +export class OAuth2ClientPublicApiRequestFactory extends BaseAPIRequestFactory { + public userAgent: string | undefined; + + public constructor(configuration: Configuration) { + super(configuration); + if (!isBrowser) { + this.userAgent = buildUserAgent("o-auth2-client-public", version); + } + } + public async deleteScopesRestriction( + clientUuid: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations[ + "OAuth2ClientPublicApi.v2.deleteScopesRestriction" + ] + ) { + throw new Error( + "Unstable operation 'deleteScopesRestriction' is disabled. Enable it by setting `configuration.unstableOperations['OAuth2ClientPublicApi.v2.deleteScopesRestriction'] = true`", + ); + } + + // verify required parameter 'clientUuid' is not null or undefined + if (clientUuid === null || clientUuid === undefined) { + throw new RequiredError("clientUuid", "deleteScopesRestriction"); + } + + // Path Params + const localVarPath = + "/api/v2/oauth2/clients/{client_uuid}/scopes_restriction".replace( + "{client_uuid}", + encodeURIComponent(String(clientUuid)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "OAuth2ClientPublicApi.v2.deleteScopesRestriction", + OAuth2ClientPublicApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.DELETE, + overrides, + ); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async getScopesRestriction( + clientUuid: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations[ + "OAuth2ClientPublicApi.v2.getScopesRestriction" + ] + ) { + throw new Error( + "Unstable operation 'getScopesRestriction' is disabled. Enable it by setting `configuration.unstableOperations['OAuth2ClientPublicApi.v2.getScopesRestriction'] = true`", + ); + } + + // verify required parameter 'clientUuid' is not null or undefined + if (clientUuid === null || clientUuid === undefined) { + throw new RequiredError("clientUuid", "getScopesRestriction"); + } + + // Path Params + const localVarPath = + "/api/v2/oauth2/clients/{client_uuid}/scopes_restriction".replace( + "{client_uuid}", + encodeURIComponent(String(clientUuid)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "OAuth2ClientPublicApi.v2.getScopesRestriction", + OAuth2ClientPublicApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async registerOAuthClient( + body: OAuthClientRegistrationRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations[ + "OAuth2ClientPublicApi.v2.registerOAuthClient" + ] + ) { + throw new Error( + "Unstable operation 'registerOAuthClient' is disabled. Enable it by setting `configuration.unstableOperations['OAuth2ClientPublicApi.v2.registerOAuthClient'] = true`", + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "registerOAuthClient"); + } + + // Path Params + const localVarPath = "/api/v2/oauth2/register"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "OAuth2ClientPublicApi.v2.registerOAuthClient", + OAuth2ClientPublicApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "OAuthClientRegistrationRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + return requestContext; + } + + public async upsertScopesRestriction( + clientUuid: string, + body: UpsertOAuthScopesRestrictionRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations[ + "OAuth2ClientPublicApi.v2.upsertScopesRestriction" + ] + ) { + throw new Error( + "Unstable operation 'upsertScopesRestriction' is disabled. Enable it by setting `configuration.unstableOperations['OAuth2ClientPublicApi.v2.upsertScopesRestriction'] = true`", + ); + } + + // verify required parameter 'clientUuid' is not null or undefined + if (clientUuid === null || clientUuid === undefined) { + throw new RequiredError("clientUuid", "upsertScopesRestriction"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "upsertScopesRestriction"); + } + + // Path Params + const localVarPath = + "/api/v2/oauth2/clients/{client_uuid}/scopes_restriction".replace( + "{client_uuid}", + encodeURIComponent(String(clientUuid)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "OAuth2ClientPublicApi.v2.upsertScopesRestriction", + OAuth2ClientPublicApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "UpsertOAuthScopesRestrictionRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } +} + +export class OAuth2ClientPublicApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteScopesRestriction + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteScopesRestriction( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 204) { + return; + } + if (response.httpStatusCode === 400 || response.httpStatusCode === 404) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getScopesRestriction + * @throws ApiException if the response code was not in [200, 299] + */ + public async getScopesRestriction( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: OAuthScopesRestrictionResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "OAuthScopesRestrictionResponse", + ) as OAuthScopesRestrictionResponse; + return body; + } + if (response.httpStatusCode === 400 || response.httpStatusCode === 404) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: OAuthScopesRestrictionResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "OAuthScopesRestrictionResponse", + "", + ) as OAuthScopesRestrictionResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to registerOAuthClient + * @throws ApiException if the response code was not in [200, 299] + */ + public async registerOAuthClient( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 201) { + const body: OAuthClientRegistrationResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "OAuthClientRegistrationResponse", + ) as OAuthClientRegistrationResponse; + return body; + } + if (response.httpStatusCode === 400) { + const bodyText = parse(await response.body.text(), contentType); + let body: OAuthClientRegistrationError; + try { + body = deserialize( + bodyText, + TypingInfo, + "OAuthClientRegistrationError", + ) as OAuthClientRegistrationError; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: OAuthClientRegistrationResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "OAuthClientRegistrationResponse", + "", + ) as OAuthClientRegistrationResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to upsertScopesRestriction + * @throws ApiException if the response code was not in [200, 299] + */ + public async upsertScopesRestriction( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: OAuthScopesRestrictionResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "OAuthScopesRestrictionResponse", + ) as OAuthScopesRestrictionResponse; + return body; + } + if (response.httpStatusCode === 400 || response.httpStatusCode === 404) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: OAuthScopesRestrictionResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "OAuthScopesRestrictionResponse", + "", + ) as OAuthScopesRestrictionResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } +} + +export interface OAuth2ClientPublicApiDeleteScopesRestrictionRequest { + /** + * UUID of the OAuth2 client. + * @type string + */ + clientUuid: string; +} + +export interface OAuth2ClientPublicApiGetScopesRestrictionRequest { + /** + * UUID of the OAuth2 client. + * @type string + */ + clientUuid: string; +} + +export interface OAuth2ClientPublicApiRegisterOAuthClientRequest { + /** + * @type OAuthClientRegistrationRequest + */ + body: OAuthClientRegistrationRequest; +} + +export interface OAuth2ClientPublicApiUpsertScopesRestrictionRequest { + /** + * UUID of the OAuth2 client. + * @type string + */ + clientUuid: string; + /** + * @type UpsertOAuthScopesRestrictionRequest + */ + body: UpsertOAuthScopesRestrictionRequest; +} + +export class OAuth2ClientPublicApi { + private requestFactory: OAuth2ClientPublicApiRequestFactory; + private responseProcessor: OAuth2ClientPublicApiResponseProcessor; + private configuration: Configuration; + + static operationServers: { [key: string]: BaseServerConfiguration[] } = {}; + + public constructor( + configuration?: Configuration, + requestFactory?: OAuth2ClientPublicApiRequestFactory, + responseProcessor?: OAuth2ClientPublicApiResponseProcessor, + ) { + this.configuration = configuration || createConfiguration(); + this.requestFactory = + requestFactory || + new OAuth2ClientPublicApiRequestFactory(this.configuration); + this.responseProcessor = + responseProcessor || new OAuth2ClientPublicApiResponseProcessor(); + } + + /** + * Delete the scopes restriction configured for the OAuth2 client. + * @param param The request object + */ + public deleteScopesRestriction( + param: OAuth2ClientPublicApiDeleteScopesRestrictionRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.deleteScopesRestriction( + param.clientUuid, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteScopesRestriction( + responseContext, + ); + }); + }); + } + + /** + * Get the scopes restriction configured for the OAuth2 client. + * @param param The request object + */ + public getScopesRestriction( + param: OAuth2ClientPublicApiGetScopesRestrictionRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.getScopesRestriction( + param.clientUuid, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getScopesRestriction(responseContext); + }); + }); + } + + /** + * Register an OAuth2 client using the Dynamic Client Registration protocol defined in RFC 7591. + * @param param The request object + */ + public registerOAuthClient( + param: OAuth2ClientPublicApiRegisterOAuthClientRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.registerOAuthClient( + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.registerOAuthClient(responseContext); + }); + }); + } + + /** + * Create or update the scopes restriction configured for the OAuth2 client. + * @param param The request object + */ + public upsertScopesRestriction( + param: OAuth2ClientPublicApiUpsertScopesRestrictionRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.upsertScopesRestriction( + param.clientUuid, + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.upsertScopesRestriction( + responseContext, + ); + }); + }); + } +} diff --git a/services/o_auth2_client_public/src/v2/index.ts b/services/o_auth2_client_public/src/v2/index.ts new file mode 100644 index 000000000000..a7131866df37 --- /dev/null +++ b/services/o_auth2_client_public/src/v2/index.ts @@ -0,0 +1,27 @@ +export { + OAuth2ClientPublicApiDeleteScopesRestrictionRequest, + OAuth2ClientPublicApiGetScopesRestrictionRequest, + OAuth2ClientPublicApiRegisterOAuthClientRequest, + OAuth2ClientPublicApiUpsertScopesRestrictionRequest, + OAuth2ClientPublicApi, +} from "./OAuth2ClientPublicApi"; + +export { APIErrorResponse } from "./models/APIErrorResponse"; +export { JSONAPIErrorItem } from "./models/JSONAPIErrorItem"; +export { JSONAPIErrorItemSource } from "./models/JSONAPIErrorItemSource"; +export { JSONAPIErrorResponse } from "./models/JSONAPIErrorResponse"; +export { OAuthClientRegistrationError } from "./models/OAuthClientRegistrationError"; +export { OAuthClientRegistrationGrantType } from "./models/OAuthClientRegistrationGrantType"; +export { OAuthClientRegistrationRequest } from "./models/OAuthClientRegistrationRequest"; +export { OAuthClientRegistrationResponse } from "./models/OAuthClientRegistrationResponse"; +export { OAuthClientRegistrationResponseType } from "./models/OAuthClientRegistrationResponseType"; +export { OAuthOidcScope } from "./models/OAuthOidcScope"; +export { OAuthScopesRestriction } from "./models/OAuthScopesRestriction"; +export { OAuthScopesRestrictionResponse } from "./models/OAuthScopesRestrictionResponse"; +export { OAuthScopesRestrictionResponseAttributes } from "./models/OAuthScopesRestrictionResponseAttributes"; +export { OAuthScopesRestrictionResponseData } from "./models/OAuthScopesRestrictionResponseData"; +export { OAuthScopesRestrictionType } from "./models/OAuthScopesRestrictionType"; +export { UpsertOAuthScopesRestrictionData } from "./models/UpsertOAuthScopesRestrictionData"; +export { UpsertOAuthScopesRestrictionDataAttributes } from "./models/UpsertOAuthScopesRestrictionDataAttributes"; +export { UpsertOAuthScopesRestrictionRequest } from "./models/UpsertOAuthScopesRestrictionRequest"; +export { UpsertOAuthScopesRestrictionType } from "./models/UpsertOAuthScopesRestrictionType"; diff --git a/services/o_auth2_client_public/src/v2/models/APIErrorResponse.ts b/services/o_auth2_client_public/src/v2/models/APIErrorResponse.ts new file mode 100644 index 000000000000..58d6c35b80f0 --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/APIErrorResponse.ts @@ -0,0 +1,45 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * API error response. + */ +export class APIErrorResponse { + /** + * A list of errors. + */ + "errors": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + errors: { + baseName: "errors", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return APIErrorResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/o_auth2_client_public/src/v2/models/JSONAPIErrorItem.ts b/services/o_auth2_client_public/src/v2/models/JSONAPIErrorItem.ts new file mode 100644 index 000000000000..a1ca45cd463c --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/JSONAPIErrorItem.ts @@ -0,0 +1,78 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { JSONAPIErrorItemSource } from "./JSONAPIErrorItemSource"; + +/** + * API error response body + */ +export class JSONAPIErrorItem { + /** + * A human-readable explanation specific to this occurrence of the error. + */ + "detail"?: string; + /** + * Non-standard meta-information about the error + */ + "meta"?: { [key: string]: any }; + /** + * References to the source of the error. + */ + "source"?: JSONAPIErrorItemSource; + /** + * Status code of the response. + */ + "status"?: string; + /** + * Short human-readable summary of the error. + */ + "title"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + detail: { + baseName: "detail", + type: "string", + }, + meta: { + baseName: "meta", + type: "{ [key: string]: any; }", + }, + source: { + baseName: "source", + type: "JSONAPIErrorItemSource", + }, + status: { + baseName: "status", + type: "string", + }, + title: { + baseName: "title", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorItem.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/o_auth2_client_public/src/v2/models/JSONAPIErrorItemSource.ts b/services/o_auth2_client_public/src/v2/models/JSONAPIErrorItemSource.ts new file mode 100644 index 000000000000..5889114315fa --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/JSONAPIErrorItemSource.ts @@ -0,0 +1,60 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * References to the source of the error. + */ +export class JSONAPIErrorItemSource { + /** + * A string indicating the name of a single request header which caused the error. + */ + "header"?: string; + /** + * A string indicating which URI query parameter caused the error. + */ + "parameter"?: string; + /** + * A JSON pointer to the value in the request document that caused the error. + */ + "pointer"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + header: { + baseName: "header", + type: "string", + }, + parameter: { + baseName: "parameter", + type: "string", + }, + pointer: { + baseName: "pointer", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorItemSource.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/o_auth2_client_public/src/v2/models/JSONAPIErrorResponse.ts b/services/o_auth2_client_public/src/v2/models/JSONAPIErrorResponse.ts new file mode 100644 index 000000000000..68aa04ffc27b --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/JSONAPIErrorResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { JSONAPIErrorItem } from "./JSONAPIErrorItem"; + +/** + * API error response. + */ +export class JSONAPIErrorResponse { + /** + * A list of errors. + */ + "errors": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + errors: { + baseName: "errors", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/cloud_cost_management/src/v2/models/CostTagMetadataMonth.ts b/services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationError.ts similarity index 60% rename from services/cloud_cost_management/src/v2/models/CostTagMetadataMonth.ts rename to services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationError.ts index e877cefb6f7f..a7c3efd1667c 100644 --- a/services/cloud_cost_management/src/v2/models/CostTagMetadataMonth.ts +++ b/services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationError.ts @@ -1,19 +1,17 @@ import { AttributeTypeMap } from "@datadog/datadog-api-client"; -import { CostTagMetadataMonthType } from "./CostTagMetadataMonthType"; - /** - * A month that has Cloud Cost Management tag metadata available for a given provider. + * Error payload returned by OAuth2 dynamic client registration as defined by RFC 7591. */ -export class CostTagMetadataMonth { +export class OAuthClientRegistrationError { /** - * The month, in `YYYY-MM` format. + * Single ASCII error code per RFC 7591, such as `invalid_request` or `invalid_client_metadata`. */ - "id": string; + "error": string; /** - * Type of the Cloud Cost Management tag metadata month resource. + * Human-readable description of the error. */ - "type": CostTagMetadataMonthType; + "errorDescription": string; /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -29,14 +27,14 @@ export class CostTagMetadataMonth { * @ignore */ static readonly attributeTypeMap: AttributeTypeMap = { - id: { - baseName: "id", + error: { + baseName: "error", type: "string", required: true, }, - type: { - baseName: "type", - type: "CostTagMetadataMonthType", + errorDescription: { + baseName: "error_description", + type: "string", required: true, }, additionalProperties: { @@ -49,7 +47,7 @@ export class CostTagMetadataMonth { * @ignore */ static getAttributeTypeMap(): AttributeTypeMap { - return CostTagMetadataMonth.attributeTypeMap; + return OAuthClientRegistrationError.attributeTypeMap; } public constructor() {} diff --git a/services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationGrantType.ts b/services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationGrantType.ts new file mode 100644 index 000000000000..f4016c88fb6b --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationGrantType.ts @@ -0,0 +1,11 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * OAuth 2.0 grant type that a registered client may use. + */ +export type OAuthClientRegistrationGrantType = + | typeof AUTHORIZATION_CODE + | typeof REFRESH_TOKEN + | UnparsedObject; +export const AUTHORIZATION_CODE = "authorization_code"; +export const REFRESH_TOKEN = "refresh_token"; diff --git a/services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationRequest.ts b/services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationRequest.ts new file mode 100644 index 000000000000..c86522a2131e --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationRequest.ts @@ -0,0 +1,130 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OAuthClientRegistrationGrantType } from "./OAuthClientRegistrationGrantType"; +import { OAuthClientRegistrationResponseType } from "./OAuthClientRegistrationResponseType"; + +/** + * Request payload for OAuth2 dynamic client registration as defined by RFC 7591. + */ +export class OAuthClientRegistrationRequest { + /** + * Human-readable name of the client. Control characters are rejected. + */ + "clientName": string; + /** + * URL of the home page of the client. + */ + "clientUri"?: string; + /** + * OAuth 2.0 grant types the client may use. + * Defaults to `authorization_code` and `refresh_token` when omitted. + */ + "grantTypes"?: Array; + /** + * URL referencing the client's JSON Web Key Set. + */ + "jwksUri"?: string; + /** + * URL referencing a logo for the client. + */ + "logoUri"?: string; + /** + * URL pointing to the client's privacy policy. + */ + "policyUri"?: string; + /** + * Array of redirection URI strings used by the client in redirect-based flows. + */ + "redirectUris": Array; + /** + * OAuth 2.0 response types the client may use. Only `code` is supported. + */ + "responseTypes"?: Array; + /** + * Space-separated list of scope values the client may request. + */ + "scope"?: string; + /** + * Requested authentication method for the token endpoint. Only `none` is supported. + */ + "tokenEndpointAuthMethod"?: string; + /** + * URL pointing to the client's terms of service. + */ + "tosUri"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + clientName: { + baseName: "client_name", + type: "string", + required: true, + }, + clientUri: { + baseName: "client_uri", + type: "string", + }, + grantTypes: { + baseName: "grant_types", + type: "Array", + }, + jwksUri: { + baseName: "jwks_uri", + type: "string", + }, + logoUri: { + baseName: "logo_uri", + type: "string", + }, + policyUri: { + baseName: "policy_uri", + type: "string", + }, + redirectUris: { + baseName: "redirect_uris", + type: "Array", + required: true, + }, + responseTypes: { + baseName: "response_types", + type: "Array", + }, + scope: { + baseName: "scope", + type: "string", + }, + tokenEndpointAuthMethod: { + baseName: "token_endpoint_auth_method", + type: "string", + }, + tosUri: { + baseName: "tos_uri", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OAuthClientRegistrationRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationResponse.ts b/services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationResponse.ts new file mode 100644 index 000000000000..110d6e25dd7f --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationResponse.ts @@ -0,0 +1,94 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OAuthClientRegistrationGrantType } from "./OAuthClientRegistrationGrantType"; +import { OAuthClientRegistrationResponseType } from "./OAuthClientRegistrationResponseType"; + +/** + * Response payload for a successful OAuth2 dynamic client registration as defined by RFC 7591. + */ +export class OAuthClientRegistrationResponse { + /** + * Unique identifier assigned to the registered client. + */ + "clientId": string; + /** + * Human-readable name of the client. + */ + "clientName": string; + /** + * OAuth 2.0 grant types registered for the client. + */ + "grantTypes": Array; + /** + * Redirection URIs registered for the client. + */ + "redirectUris": Array; + /** + * OAuth 2.0 response types registered for the client. + */ + "responseTypes": Array; + /** + * Authentication method registered for the token endpoint. Always `none`. + */ + "tokenEndpointAuthMethod": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + clientId: { + baseName: "client_id", + type: "string", + required: true, + format: "uuid", + }, + clientName: { + baseName: "client_name", + type: "string", + required: true, + }, + grantTypes: { + baseName: "grant_types", + type: "Array", + required: true, + }, + redirectUris: { + baseName: "redirect_uris", + type: "Array", + required: true, + }, + responseTypes: { + baseName: "response_types", + type: "Array", + required: true, + }, + tokenEndpointAuthMethod: { + baseName: "token_endpoint_auth_method", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OAuthClientRegistrationResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationResponseType.ts b/services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationResponseType.ts new file mode 100644 index 000000000000..2831fab3ba8b --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/OAuthClientRegistrationResponseType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * OAuth 2.0 response type that a registered client may use. + */ +export type OAuthClientRegistrationResponseType = typeof CODE | UnparsedObject; +export const CODE = "code"; diff --git a/services/o_auth2_client_public/src/v2/models/OAuthOidcScope.ts b/services/o_auth2_client_public/src/v2/models/OAuthOidcScope.ts new file mode 100644 index 000000000000..1e8b82ee806d --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/OAuthOidcScope.ts @@ -0,0 +1,15 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * OIDC scope a client may be restricted to. + */ +export type OAuthOidcScope = + | typeof OPENID + | typeof PROFILE + | typeof EMAIL + | typeof OFFLINE_ACCESS + | UnparsedObject; +export const OPENID = "openid"; +export const PROFILE = "profile"; +export const EMAIL = "email"; +export const OFFLINE_ACCESS = "offline_access"; diff --git a/services/o_auth2_client_public/src/v2/models/OAuthScopesRestriction.ts b/services/o_auth2_client_public/src/v2/models/OAuthScopesRestriction.ts new file mode 100644 index 000000000000..f250268c91a6 --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/OAuthScopesRestriction.ts @@ -0,0 +1,56 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OAuthOidcScope } from "./OAuthOidcScope"; + +/** + * Allowlist of OIDC and permission scopes enforced for the OAuth2 client. + */ +export class OAuthScopesRestriction { + /** + * OIDC scopes the client is restricted to. + */ + "oidcScopes": Array; + /** + * Datadog permission scopes the client is restricted to. + */ + "permissionScopes": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + oidcScopes: { + baseName: "oidc_scopes", + type: "Array", + required: true, + }, + permissionScopes: { + baseName: "permission_scopes", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OAuthScopesRestriction.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/cloud_cost_management/src/v2/models/CostTagMetadataMonthsResponse.ts b/services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionResponse.ts similarity index 63% rename from services/cloud_cost_management/src/v2/models/CostTagMetadataMonthsResponse.ts rename to services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionResponse.ts index 5256b8895550..8229e5617148 100644 --- a/services/cloud_cost_management/src/v2/models/CostTagMetadataMonthsResponse.ts +++ b/services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionResponse.ts @@ -1,15 +1,15 @@ import { AttributeTypeMap } from "@datadog/datadog-api-client"; -import { CostTagMetadataMonth } from "./CostTagMetadataMonth"; +import { OAuthScopesRestrictionResponseData } from "./OAuthScopesRestrictionResponseData"; /** - * List of months that have Cloud Cost Management tag metadata for the requested provider, ordered most-recent first and capped at 36 months. + * Response payload describing the scopes restriction of an OAuth2 client. */ -export class CostTagMetadataMonthsResponse { +export class OAuthScopesRestrictionResponse { /** - * List of months that have tag metadata available. + * Data object of an OAuth2 client scopes restriction response. */ - "data": Array; + "data": OAuthScopesRestrictionResponseData; /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -27,7 +27,7 @@ export class CostTagMetadataMonthsResponse { static readonly attributeTypeMap: AttributeTypeMap = { data: { baseName: "data", - type: "Array", + type: "OAuthScopesRestrictionResponseData", required: true, }, additionalProperties: { @@ -40,7 +40,7 @@ export class CostTagMetadataMonthsResponse { * @ignore */ static getAttributeTypeMap(): AttributeTypeMap { - return CostTagMetadataMonthsResponse.attributeTypeMap; + return OAuthScopesRestrictionResponse.attributeTypeMap; } public constructor() {} diff --git a/services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionResponseAttributes.ts b/services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionResponseAttributes.ts new file mode 100644 index 000000000000..735d5972da03 --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionResponseAttributes.ts @@ -0,0 +1,57 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OAuthScopesRestriction } from "./OAuthScopesRestriction"; + +/** + * Attributes of an OAuth2 client scopes restriction. + */ +export class OAuthScopesRestrictionResponseAttributes { + /** + * Permission scopes automatically required for this client (for example, mobile-app permission scopes). + * Returns `null` when no scopes are required. + */ + "requiredPermissionScopes": Array | null; + /** + * Allowlist of OIDC and permission scopes enforced for the OAuth2 client. + */ + "scopesRestriction": OAuthScopesRestriction | null; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + requiredPermissionScopes: { + baseName: "required_permission_scopes", + type: "Array", + required: true, + }, + scopesRestriction: { + baseName: "scopes_restriction", + type: "OAuthScopesRestriction", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OAuthScopesRestrictionResponseAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionResponseData.ts b/services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionResponseData.ts new file mode 100644 index 000000000000..44881e35054b --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionResponseData.ts @@ -0,0 +1,67 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OAuthScopesRestrictionResponseAttributes } from "./OAuthScopesRestrictionResponseAttributes"; +import { OAuthScopesRestrictionType } from "./OAuthScopesRestrictionType"; + +/** + * Data object of an OAuth2 client scopes restriction response. + */ +export class OAuthScopesRestrictionResponseData { + /** + * Attributes of an OAuth2 client scopes restriction. + */ + "attributes": OAuthScopesRestrictionResponseAttributes; + /** + * UUID of the OAuth2 client this restriction applies to. + */ + "id": string; + /** + * JSON:API resource type for an OAuth2 client scopes restriction. + */ + "type": OAuthScopesRestrictionType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "OAuthScopesRestrictionResponseAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + format: "uuid", + }, + type: { + baseName: "type", + type: "OAuthScopesRestrictionType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OAuthScopesRestrictionResponseData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionType.ts b/services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionType.ts new file mode 100644 index 000000000000..ce4cb959763f --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/OAuthScopesRestrictionType.ts @@ -0,0 +1,9 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * JSON:API resource type for an OAuth2 client scopes restriction. + */ +export type OAuthScopesRestrictionType = + | typeof SCOPES_RESTRICTION + | UnparsedObject; +export const SCOPES_RESTRICTION = "scopes_restriction"; diff --git a/services/o_auth2_client_public/src/v2/models/TypingInfo.ts b/services/o_auth2_client_public/src/v2/models/TypingInfo.ts new file mode 100644 index 000000000000..bb3aa6c0d382 --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/TypingInfo.ts @@ -0,0 +1,45 @@ +import { ModelTypingInfo } from "@datadog/datadog-api-client"; + +import { APIErrorResponse } from "./APIErrorResponse"; +import { JSONAPIErrorItem } from "./JSONAPIErrorItem"; +import { JSONAPIErrorItemSource } from "./JSONAPIErrorItemSource"; +import { JSONAPIErrorResponse } from "./JSONAPIErrorResponse"; +import { OAuthClientRegistrationError } from "./OAuthClientRegistrationError"; +import { OAuthClientRegistrationRequest } from "./OAuthClientRegistrationRequest"; +import { OAuthClientRegistrationResponse } from "./OAuthClientRegistrationResponse"; +import { OAuthScopesRestriction } from "./OAuthScopesRestriction"; +import { OAuthScopesRestrictionResponse } from "./OAuthScopesRestrictionResponse"; +import { OAuthScopesRestrictionResponseAttributes } from "./OAuthScopesRestrictionResponseAttributes"; +import { OAuthScopesRestrictionResponseData } from "./OAuthScopesRestrictionResponseData"; +import { UpsertOAuthScopesRestrictionData } from "./UpsertOAuthScopesRestrictionData"; +import { UpsertOAuthScopesRestrictionDataAttributes } from "./UpsertOAuthScopesRestrictionDataAttributes"; +import { UpsertOAuthScopesRestrictionRequest } from "./UpsertOAuthScopesRestrictionRequest"; + +export const TypingInfo: ModelTypingInfo = { + enumsMap: { + OAuthClientRegistrationGrantType: ["authorization_code", "refresh_token"], + OAuthClientRegistrationResponseType: ["code"], + OAuthOidcScope: ["openid", "profile", "email", "offline_access"], + OAuthScopesRestrictionType: ["scopes_restriction"], + UpsertOAuthScopesRestrictionType: ["upsert_scopes_restriction"], + }, + oneOfMap: {}, + typeMap: { + APIErrorResponse: APIErrorResponse, + JSONAPIErrorItem: JSONAPIErrorItem, + JSONAPIErrorItemSource: JSONAPIErrorItemSource, + JSONAPIErrorResponse: JSONAPIErrorResponse, + OAuthClientRegistrationError: OAuthClientRegistrationError, + OAuthClientRegistrationRequest: OAuthClientRegistrationRequest, + OAuthClientRegistrationResponse: OAuthClientRegistrationResponse, + OAuthScopesRestriction: OAuthScopesRestriction, + OAuthScopesRestrictionResponse: OAuthScopesRestrictionResponse, + OAuthScopesRestrictionResponseAttributes: + OAuthScopesRestrictionResponseAttributes, + OAuthScopesRestrictionResponseData: OAuthScopesRestrictionResponseData, + UpsertOAuthScopesRestrictionData: UpsertOAuthScopesRestrictionData, + UpsertOAuthScopesRestrictionDataAttributes: + UpsertOAuthScopesRestrictionDataAttributes, + UpsertOAuthScopesRestrictionRequest: UpsertOAuthScopesRestrictionRequest, + }, +}; diff --git a/services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionData.ts b/services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionData.ts new file mode 100644 index 000000000000..d88054301c00 --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionData.ts @@ -0,0 +1,56 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UpsertOAuthScopesRestrictionDataAttributes } from "./UpsertOAuthScopesRestrictionDataAttributes"; +import { UpsertOAuthScopesRestrictionType } from "./UpsertOAuthScopesRestrictionType"; + +/** + * Data object of an upsert OAuth2 scopes restriction request. + */ +export class UpsertOAuthScopesRestrictionData { + /** + * Attributes of an upsert OAuth2 scopes restriction request. + */ + "attributes"?: UpsertOAuthScopesRestrictionDataAttributes; + /** + * JSON:API resource type for an upsert OAuth2 client scopes restriction request. + */ + "type": UpsertOAuthScopesRestrictionType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "UpsertOAuthScopesRestrictionDataAttributes", + }, + type: { + baseName: "type", + type: "UpsertOAuthScopesRestrictionType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpsertOAuthScopesRestrictionData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionDataAttributes.ts b/services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionDataAttributes.ts new file mode 100644 index 000000000000..edb88b72255b --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionDataAttributes.ts @@ -0,0 +1,55 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OAuthOidcScope } from "./OAuthOidcScope"; + +/** + * Attributes of an upsert OAuth2 scopes restriction request. + */ +export class UpsertOAuthScopesRestrictionDataAttributes { + /** + * OIDC scopes the client is allowed to request. + */ + "oidcScopes"?: Array; + /** + * Datadog permission scopes the client is allowed to request. + * Each value must be a valid permission name. + */ + "permissionScopes"?: Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + oidcScopes: { + baseName: "oidc_scopes", + type: "Array", + }, + permissionScopes: { + baseName: "permission_scopes", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpsertOAuthScopesRestrictionDataAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionRequest.ts b/services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionRequest.ts new file mode 100644 index 000000000000..f7cb1a50886e --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UpsertOAuthScopesRestrictionData } from "./UpsertOAuthScopesRestrictionData"; + +/** + * Request payload for creating or updating the scopes restriction of an OAuth2 client. + */ +export class UpsertOAuthScopesRestrictionRequest { + /** + * Data object of an upsert OAuth2 scopes restriction request. + */ + "data": UpsertOAuthScopesRestrictionData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "UpsertOAuthScopesRestrictionData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpsertOAuthScopesRestrictionRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionType.ts b/services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionType.ts new file mode 100644 index 000000000000..d290bf695bac --- /dev/null +++ b/services/o_auth2_client_public/src/v2/models/UpsertOAuthScopesRestrictionType.ts @@ -0,0 +1,9 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * JSON:API resource type for an upsert OAuth2 client scopes restriction request. + */ +export type UpsertOAuthScopesRestrictionType = + | typeof UPSERT_SCOPES_RESTRICTION + | UnparsedObject; +export const UPSERT_SCOPES_RESTRICTION = "upsert_scopes_restriction"; diff --git a/services/o_auth2_client_public/tsconfig.json b/services/o_auth2_client_public/tsconfig.json new file mode 100644 index 000000000000..d6c32bfb893c --- /dev/null +++ b/services/o_auth2_client_public/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "strict": true, + /* Basic Options */ + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "declaration": true, + + "esModuleInterop": true, + "resolveJsonModule": true, + + "noImplicitAny": true, + "noImplicitThis": true, + + /* Additional Checks */ + "noUnusedLocals": false /* Report errors on unused locals. */, // TODO: reenable (unused imports!) + "noUnusedParameters": false /* Report errors on unused parameters. */, // TODO: set to true again + "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, + "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, + + "sourceMap": true, + "outDir": "./dist", + "lib": ["es6", "es7"] + }, + "exclude": ["dist", "node_modules", "tests"], + "include": ["src"] +} diff --git a/yarn.lock b/yarn.lock index e8f646185899..795b1782b410 100644 --- a/yarn.lock +++ b/yarn.lock @@ -946,6 +946,15 @@ __metadata: languageName: unknown linkType: soft +"@datadog/datadog-api-client-o-auth2-client-public@workspace:services/o_auth2_client_public": + version: 0.0.0-use.local + resolution: "@datadog/datadog-api-client-o-auth2-client-public@workspace:services/o_auth2_client_public" + dependencies: + "@datadog/datadog-api-client": "npm:^2.0.0-beta.2" + typescript: "npm:5.8.3" + languageName: unknown + linkType: soft + "@datadog/datadog-api-client-observability-pipelines@workspace:services/observability_pipelines": version: 0.0.0-use.local resolution: "@datadog/datadog-api-client-observability-pipelines@workspace:services/observability_pipelines"