From be8f441c67c411add6cc52adb1e3979011ed55e4 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 27 May 2026 18:26:08 +0000 Subject: [PATCH] Regenerate client from commit 1e9d9ba of spec repo --- .generator/schemas/v2/openapi.yaml | 632 +++++++++++++++--- .../ListCostTagMetadataMonths.rb | 8 - .../DeleteScopesRestriction.rb | 8 + .../GetScopesRestriction.rb | 8 + .../RegisterOAuthClient.rb | 29 + .../UpsertScopesRestriction.rb | 24 + features/scenarios_model_mapping.rb | 16 +- features/v2/cloud_cost_management.feature | 16 - features/v2/oauth2_client_public.feature | 100 +++ features/v2/undo.json | 30 +- lib/datadog_api_client/configuration.rb | 5 +- lib/datadog_api_client/inflector.rb | 19 +- .../v2/api/cloud_cost_management_api.rb | 73 -- .../v2/api/o_auth2_client_public_api.rb | 319 +++++++++ .../o_auth_client_registration_error.rb | 144 ++++ .../o_auth_client_registration_grant_type.rb | 27 + .../o_auth_client_registration_request.rb | 322 +++++++++ .../o_auth_client_registration_response.rb | 234 +++++++ ...auth_client_registration_response_type.rb} | 6 +- .../v2/models/o_auth_oidc_scope.rb | 29 + .../v2/models/o_auth_scopes_restriction.rb | 148 ++++ ... => o_auth_scopes_restriction_response.rb} | 14 +- ..._scopes_restriction_response_attributes.rb | 127 ++++ ...o_auth_scopes_restriction_response_data.rb | 165 +++++ .../models/o_auth_scopes_restriction_type.rb | 26 + ... upsert_o_auth_scopes_restriction_data.rb} | 37 +- ...auth_scopes_restriction_data_attributes.rb | 120 ++++ ...psert_o_auth_scopes_restriction_request.rb | 123 ++++ .../upsert_o_auth_scopes_restriction_type.rb | 26 + 29 files changed, 2589 insertions(+), 246 deletions(-) delete mode 100644 examples/v2/cloud-cost-management/ListCostTagMetadataMonths.rb create mode 100644 examples/v2/oauth2-client-public/DeleteScopesRestriction.rb create mode 100644 examples/v2/oauth2-client-public/GetScopesRestriction.rb create mode 100644 examples/v2/oauth2-client-public/RegisterOAuthClient.rb create mode 100644 examples/v2/oauth2-client-public/UpsertScopesRestriction.rb create mode 100644 features/v2/oauth2_client_public.feature create mode 100644 lib/datadog_api_client/v2/api/o_auth2_client_public_api.rb create mode 100644 lib/datadog_api_client/v2/models/o_auth_client_registration_error.rb create mode 100644 lib/datadog_api_client/v2/models/o_auth_client_registration_grant_type.rb create mode 100644 lib/datadog_api_client/v2/models/o_auth_client_registration_request.rb create mode 100644 lib/datadog_api_client/v2/models/o_auth_client_registration_response.rb rename lib/datadog_api_client/v2/models/{cost_tag_metadata_month_type.rb => o_auth_client_registration_response_type.rb} (77%) create mode 100644 lib/datadog_api_client/v2/models/o_auth_oidc_scope.rb create mode 100644 lib/datadog_api_client/v2/models/o_auth_scopes_restriction.rb rename lib/datadog_api_client/v2/models/{cost_tag_metadata_months_response.rb => o_auth_scopes_restriction_response.rb} (87%) create mode 100644 lib/datadog_api_client/v2/models/o_auth_scopes_restriction_response_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/o_auth_scopes_restriction_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/o_auth_scopes_restriction_type.rb rename lib/datadog_api_client/v2/models/{cost_tag_metadata_month.rb => upsert_o_auth_scopes_restriction_data.rb} (79%) create mode 100644 lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_request.rb create mode 100644 lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_type.rb 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/examples/v2/cloud-cost-management/ListCostTagMetadataMonths.rb b/examples/v2/cloud-cost-management/ListCostTagMetadataMonths.rb deleted file mode 100644 index 7f388f29bcaa..000000000000 --- a/examples/v2/cloud-cost-management/ListCostTagMetadataMonths.rb +++ /dev/null @@ -1,8 +0,0 @@ -# List Cloud Cost Management tag metadata months returns "OK" response - -require "datadog_api_client" -DatadogAPIClient.configure do |config| - config.unstable_operations["v2.list_cost_tag_metadata_months".to_sym] = true -end -api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new -p api_instance.list_cost_tag_metadata_months("filter[provider]") diff --git a/examples/v2/oauth2-client-public/DeleteScopesRestriction.rb b/examples/v2/oauth2-client-public/DeleteScopesRestriction.rb new file mode 100644 index 000000000000..19ef9539a0ad --- /dev/null +++ b/examples/v2/oauth2-client-public/DeleteScopesRestriction.rb @@ -0,0 +1,8 @@ +# Delete an OAuth2 client scopes restriction returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_scopes_restriction".to_sym] = true +end +api_instance = DatadogAPIClient::V2::OAuth2ClientPublicAPI.new +api_instance.delete_scopes_restriction("fafa8e1c-36a5-11f0-a83d-da7ad0900001") diff --git a/examples/v2/oauth2-client-public/GetScopesRestriction.rb b/examples/v2/oauth2-client-public/GetScopesRestriction.rb new file mode 100644 index 000000000000..f959d785e912 --- /dev/null +++ b/examples/v2/oauth2-client-public/GetScopesRestriction.rb @@ -0,0 +1,8 @@ +# Get an OAuth2 client scopes restriction returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_scopes_restriction".to_sym] = true +end +api_instance = DatadogAPIClient::V2::OAuth2ClientPublicAPI.new +p api_instance.get_scopes_restriction("fafa8e1c-36a5-11f0-a83d-da7ad0900001") diff --git a/examples/v2/oauth2-client-public/RegisterOAuthClient.rb b/examples/v2/oauth2-client-public/RegisterOAuthClient.rb new file mode 100644 index 000000000000..d438389b1248 --- /dev/null +++ b/examples/v2/oauth2-client-public/RegisterOAuthClient.rb @@ -0,0 +1,29 @@ +# Register an OAuth2 client returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.register_o_auth_client".to_sym] = true +end +api_instance = DatadogAPIClient::V2::OAuth2ClientPublicAPI.new + +body = DatadogAPIClient::V2::OAuthClientRegistrationRequest.new({ + client_name: "Example MCP Client", + client_uri: "https://example.com", + grant_types: [ + DatadogAPIClient::V2::OAuthClientRegistrationGrantType::AUTHORIZATION_CODE, + DatadogAPIClient::V2::OAuthClientRegistrationGrantType::REFRESH_TOKEN, + ], + jwks_uri: "https://example.com/.well-known/jwks.json", + logo_uri: "https://example.com/logo.png", + policy_uri: "https://example.com/privacy", + redirect_uris: [ + "https://example.com/oauth/callback", + ], + response_types: [ + DatadogAPIClient::V2::OAuthClientRegistrationResponseType::CODE, + ], + scope: "openid profile", + token_endpoint_auth_method: "none", + tos_uri: "https://example.com/tos", +}) +p api_instance.register_o_auth_client(body) diff --git a/examples/v2/oauth2-client-public/UpsertScopesRestriction.rb b/examples/v2/oauth2-client-public/UpsertScopesRestriction.rb new file mode 100644 index 000000000000..157b32764346 --- /dev/null +++ b/examples/v2/oauth2-client-public/UpsertScopesRestriction.rb @@ -0,0 +1,24 @@ +# Upsert an OAuth2 client scopes restriction returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.upsert_scopes_restriction".to_sym] = true +end +api_instance = DatadogAPIClient::V2::OAuth2ClientPublicAPI.new + +body = DatadogAPIClient::V2::UpsertOAuthScopesRestrictionRequest.new({ + data: DatadogAPIClient::V2::UpsertOAuthScopesRestrictionData.new({ + attributes: DatadogAPIClient::V2::UpsertOAuthScopesRestrictionDataAttributes.new({ + oidc_scopes: [ + DatadogAPIClient::V2::OAuthOidcScope::OPENID, + DatadogAPIClient::V2::OAuthOidcScope::EMAIL, + ], + permission_scopes: [ + "dashboards_read", + "metrics_read", + ], + }), + type: DatadogAPIClient::V2::UpsertOAuthScopesRestrictionType::UPSERT_SCOPES_RESTRICTION, + }), +}) +p api_instance.upsert_scopes_restriction("fafa8e1c-36a5-11f0-a83d-da7ad0900001", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 7ed0eaac9136..d3f08acd5676 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2643,9 +2643,6 @@ "filter_month" => "String", "filter_provider" => "String", }, - "v2.ListCostTagMetadataMonths" => { - "filter_provider" => "String", - }, "v2.ListCostTagMetadataOrchestrators" => { "filter_month" => "String", "filter_provider" => "String", @@ -3878,6 +3875,19 @@ "tags" => "String", "limit" => "Integer", }, + "v2.DeleteScopesRestriction" => { + "client_uuid" => "UUID", + }, + "v2.GetScopesRestriction" => { + "client_uuid" => "UUID", + }, + "v2.UpsertScopesRestriction" => { + "client_uuid" => "UUID", + "body" => "UpsertOAuthScopesRestrictionRequest", + }, + "v2.RegisterOAuthClient" => { + "body" => "OAuthClientRegistrationRequest", + }, "v2.ListPipelines" => { "page_size" => "Integer", "page_number" => "Integer", 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/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 112134511ef0..35fd6c97069c 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -387,7 +387,6 @@ def initialize "v2.list_cost_tag_key_sources": false, "v2.list_cost_tag_metadata": false, "v2.list_cost_tag_metadata_metrics": false, - "v2.list_cost_tag_metadata_months": false, "v2.list_cost_tag_metadata_orchestrators": false, "v2.search_cost_recommendations": false, "v2.create_dashboard_secure_embed": false, @@ -521,6 +520,10 @@ def initialize "v2.update_monitor_user_template": false, "v2.validate_existing_monitor_user_template": false, "v2.validate_monitor_user_template": false, + "v2.delete_scopes_restriction": false, + "v2.get_scopes_restriction": false, + "v2.register_o_auth_client": false, + "v2.upsert_scopes_restriction": false, "v2.bulk_update_org_group_memberships": false, "v2.create_org_group": false, "v2.create_org_group_policy": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 8dfcde4a6339..9692211d2a95 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2234,9 +2234,6 @@ def overrides "v2.cost_tag_keys_response" => "CostTagKeysResponse", "v2.cost_tag_key_type" => "CostTagKeyType", "v2.cost_tag_metadata_daily_filter" => "CostTagMetadataDailyFilter", - "v2.cost_tag_metadata_month" => "CostTagMetadataMonth", - "v2.cost_tag_metadata_months_response" => "CostTagMetadataMonthsResponse", - "v2.cost_tag_metadata_month_type" => "CostTagMetadataMonthType", "v2.cost_tags_response" => "CostTagsResponse", "v2.cost_tag_type" => "CostTagType", "v2.coverage_summary_attributes" => "CoverageSummaryAttributes", @@ -4442,6 +4439,17 @@ def overrides "v2.nullable_relationship_to_user_data" => "NullableRelationshipToUserData", "v2.nullable_user_relationship" => "NullableUserRelationship", "v2.nullable_user_relationship_data" => "NullableUserRelationshipData", + "v2.o_auth_client_registration_error" => "OAuthClientRegistrationError", + "v2.o_auth_client_registration_grant_type" => "OAuthClientRegistrationGrantType", + "v2.o_auth_client_registration_request" => "OAuthClientRegistrationRequest", + "v2.o_auth_client_registration_response" => "OAuthClientRegistrationResponse", + "v2.o_auth_client_registration_response_type" => "OAuthClientRegistrationResponseType", + "v2.o_auth_oidc_scope" => "OAuthOidcScope", + "v2.o_auth_scopes_restriction" => "OAuthScopesRestriction", + "v2.o_auth_scopes_restriction_response" => "OAuthScopesRestrictionResponse", + "v2.o_auth_scopes_restriction_response_attributes" => "OAuthScopesRestrictionResponseAttributes", + "v2.o_auth_scopes_restriction_response_data" => "OAuthScopesRestrictionResponseData", + "v2.o_auth_scopes_restriction_type" => "OAuthScopesRestrictionType", "v2.observability_pipeline" => "ObservabilityPipeline", "v2.observability_pipeline_add_env_vars_processor" => "ObservabilityPipelineAddEnvVarsProcessor", "v2.observability_pipeline_add_env_vars_processor_type" => "ObservabilityPipelineAddEnvVarsProcessorType", @@ -6829,6 +6837,10 @@ def overrides "v2.upsert_cloud_inventory_sync_config_request" => "UpsertCloudInventorySyncConfigRequest", "v2.upsert_cloud_inventory_sync_config_request_attributes" => "UpsertCloudInventorySyncConfigRequestAttributes", "v2.upsert_cloud_inventory_sync_config_request_data" => "UpsertCloudInventorySyncConfigRequestData", + "v2.upsert_o_auth_scopes_restriction_data" => "UpsertOAuthScopesRestrictionData", + "v2.upsert_o_auth_scopes_restriction_data_attributes" => "UpsertOAuthScopesRestrictionDataAttributes", + "v2.upsert_o_auth_scopes_restriction_request" => "UpsertOAuthScopesRestrictionRequest", + "v2.upsert_o_auth_scopes_restriction_type" => "UpsertOAuthScopesRestrictionType", "v2.urgency" => "Urgency", "v2.url_param" => "UrlParam", "v2.url_param_update" => "UrlParamUpdate", @@ -7095,6 +7107,7 @@ def overrides "v2.model_lab_api_api" => "ModelLabAPIAPI", "v2.monitors_api" => "MonitorsAPI", "v2.network_device_monitoring_api" => "NetworkDeviceMonitoringAPI", + "v2.o_auth2_client_public_api" => "OAuth2ClientPublicAPI", "v2.observability_pipelines_api" => "ObservabilityPipelinesAPI", "v2.oci_integration_api" => "OCIIntegrationAPI", "v2.okta_integration_api" => "OktaIntegrationAPI", diff --git a/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb b/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb index 5b81f8a65ee6..a2e6e2ae335f 100644 --- a/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb +++ b/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb @@ -3039,79 +3039,6 @@ def list_cost_tag_metadata_metrics_with_http_info(filter_month, opts = {}) return data, status_code, headers end - # List Cloud Cost Management tag metadata months. - # - # @see #list_cost_tag_metadata_months_with_http_info - def list_cost_tag_metadata_months(filter_provider, opts = {}) - data, _status_code, _headers = list_cost_tag_metadata_months_with_http_info(filter_provider, opts) - data - end - - # List Cloud Cost Management tag metadata months. - # - # List months that have Cloud Cost Management tag metadata for a given provider, - # ordered most-recent first. The response is capped at 36 months. - # - # @param filter_provider [String] 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. - # @param opts [Hash] the optional parameters - # @return [Array<(CostTagMetadataMonthsResponse, Integer, Hash)>] CostTagMetadataMonthsResponse data, response status code and response headers - def list_cost_tag_metadata_months_with_http_info(filter_provider, opts = {}) - unstable_enabled = @api_client.config.unstable_operations["v2.list_cost_tag_metadata_months".to_sym] - if unstable_enabled - @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_cost_tag_metadata_months") - else - raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_cost_tag_metadata_months")) - end - - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: CloudCostManagementAPI.list_cost_tag_metadata_months ...' - end - # verify the required parameter 'filter_provider' is set - if @api_client.config.client_side_validation && filter_provider.nil? - fail ArgumentError, "Missing the required parameter 'filter_provider' when calling CloudCostManagementAPI.list_cost_tag_metadata_months" - end - # resource path - local_var_path = '/api/v2/cost/tag_metadata/months' - - # query parameters - query_params = opts[:query_params] || {} - query_params[:'filter[provider]'] = filter_provider - - # header parameters - header_params = opts[:header_params] || {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) - - # form parameters - form_params = opts[:form_params] || {} - - # http body (model) - post_body = opts[:debug_body] - - # return_type - return_type = opts[:debug_return_type] || 'CostTagMetadataMonthsResponse' - - # auth_names - auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] - - new_options = opts.merge( - :operation => :list_cost_tag_metadata_months, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => return_type, - :api_version => "V2" - ) - - data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) - if @api_client.config.debugging - @api_client.config.logger.debug "API called: CloudCostManagementAPI#list_cost_tag_metadata_months\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # List Cloud Cost Management orchestrators. # # @see #list_cost_tag_metadata_orchestrators_with_http_info diff --git a/lib/datadog_api_client/v2/api/o_auth2_client_public_api.rb b/lib/datadog_api_client/v2/api/o_auth2_client_public_api.rb new file mode 100644 index 000000000000..1264fef6c088 --- /dev/null +++ b/lib/datadog_api_client/v2/api/o_auth2_client_public_api.rb @@ -0,0 +1,319 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class OAuth2ClientPublicAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Delete an OAuth2 client scopes restriction. + # + # @see #delete_scopes_restriction_with_http_info + def delete_scopes_restriction(client_uuid, opts = {}) + delete_scopes_restriction_with_http_info(client_uuid, opts) + nil + end + + # Delete an OAuth2 client scopes restriction. + # + # Delete the scopes restriction configured for the OAuth2 client. + # + # @param client_uuid [UUID] UUID of the OAuth2 client. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_scopes_restriction_with_http_info(client_uuid, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_scopes_restriction".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_scopes_restriction") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_scopes_restriction")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OAuth2ClientPublicAPI.delete_scopes_restriction ...' + end + # verify the required parameter 'client_uuid' is set + if @api_client.config.client_side_validation && client_uuid.nil? + fail ArgumentError, "Missing the required parameter 'client_uuid' when calling OAuth2ClientPublicAPI.delete_scopes_restriction" + end + # resource path + local_var_path = '/api/v2/oauth2/clients/{client_uuid}/scopes_restriction'.sub('{client_uuid}', CGI.escape(client_uuid.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_scopes_restriction, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OAuth2ClientPublicAPI#delete_scopes_restriction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get an OAuth2 client scopes restriction. + # + # @see #get_scopes_restriction_with_http_info + def get_scopes_restriction(client_uuid, opts = {}) + data, _status_code, _headers = get_scopes_restriction_with_http_info(client_uuid, opts) + data + end + + # Get an OAuth2 client scopes restriction. + # + # Get the scopes restriction configured for the OAuth2 client. + # + # @param client_uuid [UUID] UUID of the OAuth2 client. + # @param opts [Hash] the optional parameters + # @return [Array<(OAuthScopesRestrictionResponse, Integer, Hash)>] OAuthScopesRestrictionResponse data, response status code and response headers + def get_scopes_restriction_with_http_info(client_uuid, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_scopes_restriction".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_scopes_restriction") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_scopes_restriction")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OAuth2ClientPublicAPI.get_scopes_restriction ...' + end + # verify the required parameter 'client_uuid' is set + if @api_client.config.client_side_validation && client_uuid.nil? + fail ArgumentError, "Missing the required parameter 'client_uuid' when calling OAuth2ClientPublicAPI.get_scopes_restriction" + end + # resource path + local_var_path = '/api/v2/oauth2/clients/{client_uuid}/scopes_restriction'.sub('{client_uuid}', CGI.escape(client_uuid.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'OAuthScopesRestrictionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_scopes_restriction, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OAuth2ClientPublicAPI#get_scopes_restriction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Register an OAuth2 client. + # + # @see #register_o_auth_client_with_http_info + def register_o_auth_client(body, opts = {}) + data, _status_code, _headers = register_o_auth_client_with_http_info(body, opts) + data + end + + # Register an OAuth2 client. + # + # Register an OAuth2 client using the Dynamic Client Registration protocol defined in RFC 7591. + # + # @param body [OAuthClientRegistrationRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(OAuthClientRegistrationResponse, Integer, Hash)>] OAuthClientRegistrationResponse data, response status code and response headers + def register_o_auth_client_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.register_o_auth_client".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.register_o_auth_client") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.register_o_auth_client")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OAuth2ClientPublicAPI.register_o_auth_client ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling OAuth2ClientPublicAPI.register_o_auth_client" + end + # resource path + local_var_path = '/api/v2/oauth2/register' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'OAuthClientRegistrationResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :register_o_auth_client, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OAuth2ClientPublicAPI#register_o_auth_client\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Upsert an OAuth2 client scopes restriction. + # + # @see #upsert_scopes_restriction_with_http_info + def upsert_scopes_restriction(client_uuid, body, opts = {}) + data, _status_code, _headers = upsert_scopes_restriction_with_http_info(client_uuid, body, opts) + data + end + + # Upsert an OAuth2 client scopes restriction. + # + # Create or update the scopes restriction configured for the OAuth2 client. + # + # @param client_uuid [UUID] UUID of the OAuth2 client. + # @param body [UpsertOAuthScopesRestrictionRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(OAuthScopesRestrictionResponse, Integer, Hash)>] OAuthScopesRestrictionResponse data, response status code and response headers + def upsert_scopes_restriction_with_http_info(client_uuid, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.upsert_scopes_restriction".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.upsert_scopes_restriction") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.upsert_scopes_restriction")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OAuth2ClientPublicAPI.upsert_scopes_restriction ...' + end + # verify the required parameter 'client_uuid' is set + if @api_client.config.client_side_validation && client_uuid.nil? + fail ArgumentError, "Missing the required parameter 'client_uuid' when calling OAuth2ClientPublicAPI.upsert_scopes_restriction" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling OAuth2ClientPublicAPI.upsert_scopes_restriction" + end + # resource path + local_var_path = '/api/v2/oauth2/clients/{client_uuid}/scopes_restriction'.sub('{client_uuid}', CGI.escape(client_uuid.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'OAuthScopesRestrictionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :upsert_scopes_restriction, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OAuth2ClientPublicAPI#upsert_scopes_restriction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/o_auth_client_registration_error.rb b/lib/datadog_api_client/v2/models/o_auth_client_registration_error.rb new file mode 100644 index 000000000000..a6dd8badabd5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/o_auth_client_registration_error.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Error payload returned by OAuth2 dynamic client registration as defined by RFC 7591. + class OAuthClientRegistrationError + include BaseGenericModel + + # Single ASCII error code per RFC 7591, such as `invalid_request` or `invalid_client_metadata`. + attr_reader :error + + # Human-readable description of the error. + attr_reader :error_description + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'error' => :'error', + :'error_description' => :'error_description' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'error' => :'String', + :'error_description' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OAuthClientRegistrationError` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + + if attributes.key?(:'error_description') + self.error_description = attributes[:'error_description'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @error.nil? + return false if @error_description.nil? + true + end + + # Custom attribute writer method with validation + # @param error [Object] Object to be assigned + # @!visibility private + def error=(error) + if error.nil? + fail ArgumentError, 'invalid value for "error", error cannot be nil.' + end + @error = error + end + + # Custom attribute writer method with validation + # @param error_description [Object] Object to be assigned + # @!visibility private + def error_description=(error_description) + if error_description.nil? + fail ArgumentError, 'invalid value for "error_description", error_description cannot be nil.' + end + @error_description = error_description + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + error == o.error && + error_description == o.error_description && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [error, error_description, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/o_auth_client_registration_grant_type.rb b/lib/datadog_api_client/v2/models/o_auth_client_registration_grant_type.rb new file mode 100644 index 000000000000..a8c9a5d5121d --- /dev/null +++ b/lib/datadog_api_client/v2/models/o_auth_client_registration_grant_type.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # OAuth 2.0 grant type that a registered client may use. + class OAuthClientRegistrationGrantType + include BaseEnumModel + + AUTHORIZATION_CODE = "authorization_code".freeze + REFRESH_TOKEN = "refresh_token".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/o_auth_client_registration_request.rb b/lib/datadog_api_client/v2/models/o_auth_client_registration_request.rb new file mode 100644 index 000000000000..f6db36a48b4b --- /dev/null +++ b/lib/datadog_api_client/v2/models/o_auth_client_registration_request.rb @@ -0,0 +1,322 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request payload for OAuth2 dynamic client registration as defined by RFC 7591. + class OAuthClientRegistrationRequest + include BaseGenericModel + + # Human-readable name of the client. Control characters are rejected. + attr_reader :client_name + + # URL of the home page of the client. + attr_reader :client_uri + + # OAuth 2.0 grant types the client may use. + # Defaults to `authorization_code` and `refresh_token` when omitted. + attr_accessor :grant_types + + # URL referencing the client's JSON Web Key Set. + attr_reader :jwks_uri + + # URL referencing a logo for the client. + attr_reader :logo_uri + + # URL pointing to the client's privacy policy. + attr_reader :policy_uri + + # Array of redirection URI strings used by the client in redirect-based flows. + attr_reader :redirect_uris + + # OAuth 2.0 response types the client may use. Only `code` is supported. + attr_accessor :response_types + + # Space-separated list of scope values the client may request. + attr_reader :scope + + # Requested authentication method for the token endpoint. Only `none` is supported. + attr_reader :token_endpoint_auth_method + + # URL pointing to the client's terms of service. + attr_reader :tos_uri + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'client_name' => :'client_name', + :'client_uri' => :'client_uri', + :'grant_types' => :'grant_types', + :'jwks_uri' => :'jwks_uri', + :'logo_uri' => :'logo_uri', + :'policy_uri' => :'policy_uri', + :'redirect_uris' => :'redirect_uris', + :'response_types' => :'response_types', + :'scope' => :'scope', + :'token_endpoint_auth_method' => :'token_endpoint_auth_method', + :'tos_uri' => :'tos_uri' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'client_name' => :'String', + :'client_uri' => :'String', + :'grant_types' => :'Array', + :'jwks_uri' => :'String', + :'logo_uri' => :'String', + :'policy_uri' => :'String', + :'redirect_uris' => :'Array', + :'response_types' => :'Array', + :'scope' => :'String', + :'token_endpoint_auth_method' => :'String', + :'tos_uri' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OAuthClientRegistrationRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'client_name') + self.client_name = attributes[:'client_name'] + end + + if attributes.key?(:'client_uri') + self.client_uri = attributes[:'client_uri'] + end + + if attributes.key?(:'grant_types') + if (value = attributes[:'grant_types']).is_a?(Array) + self.grant_types = value + end + end + + if attributes.key?(:'jwks_uri') + self.jwks_uri = attributes[:'jwks_uri'] + end + + if attributes.key?(:'logo_uri') + self.logo_uri = attributes[:'logo_uri'] + end + + if attributes.key?(:'policy_uri') + self.policy_uri = attributes[:'policy_uri'] + end + + if attributes.key?(:'redirect_uris') + if (value = attributes[:'redirect_uris']).is_a?(Array) + self.redirect_uris = value + end + end + + if attributes.key?(:'response_types') + if (value = attributes[:'response_types']).is_a?(Array) + self.response_types = value + end + end + + if attributes.key?(:'scope') + self.scope = attributes[:'scope'] + end + + if attributes.key?(:'token_endpoint_auth_method') + self.token_endpoint_auth_method = attributes[:'token_endpoint_auth_method'] + end + + if attributes.key?(:'tos_uri') + self.tos_uri = attributes[:'tos_uri'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @client_name.nil? + return false if @client_name.to_s.length > 1000 + return false if !@client_uri.nil? && @client_uri.to_s.length > 1000 + return false if !@jwks_uri.nil? && @jwks_uri.to_s.length > 1000 + return false if !@logo_uri.nil? && @logo_uri.to_s.length > 1000 + return false if !@policy_uri.nil? && @policy_uri.to_s.length > 1000 + return false if @redirect_uris.nil? + return false if !@scope.nil? && @scope.to_s.length > 1000 + return false if !@token_endpoint_auth_method.nil? && @token_endpoint_auth_method.to_s.length > 20 + return false if !@tos_uri.nil? && @tos_uri.to_s.length > 1000 + true + end + + # Custom attribute writer method with validation + # @param client_name [Object] Object to be assigned + # @!visibility private + def client_name=(client_name) + if client_name.nil? + fail ArgumentError, 'invalid value for "client_name", client_name cannot be nil.' + end + if client_name.to_s.length > 1000 + fail ArgumentError, 'invalid value for "client_name", the character length must be smaller than or equal to 1000.' + end + @client_name = client_name + end + + # Custom attribute writer method with validation + # @param client_uri [Object] Object to be assigned + # @!visibility private + def client_uri=(client_uri) + if !client_uri.nil? && client_uri.to_s.length > 1000 + fail ArgumentError, 'invalid value for "client_uri", the character length must be smaller than or equal to 1000.' + end + @client_uri = client_uri + end + + # Custom attribute writer method with validation + # @param jwks_uri [Object] Object to be assigned + # @!visibility private + def jwks_uri=(jwks_uri) + if !jwks_uri.nil? && jwks_uri.to_s.length > 1000 + fail ArgumentError, 'invalid value for "jwks_uri", the character length must be smaller than or equal to 1000.' + end + @jwks_uri = jwks_uri + end + + # Custom attribute writer method with validation + # @param logo_uri [Object] Object to be assigned + # @!visibility private + def logo_uri=(logo_uri) + if !logo_uri.nil? && logo_uri.to_s.length > 1000 + fail ArgumentError, 'invalid value for "logo_uri", the character length must be smaller than or equal to 1000.' + end + @logo_uri = logo_uri + end + + # Custom attribute writer method with validation + # @param policy_uri [Object] Object to be assigned + # @!visibility private + def policy_uri=(policy_uri) + if !policy_uri.nil? && policy_uri.to_s.length > 1000 + fail ArgumentError, 'invalid value for "policy_uri", the character length must be smaller than or equal to 1000.' + end + @policy_uri = policy_uri + end + + # Custom attribute writer method with validation + # @param redirect_uris [Object] Object to be assigned + # @!visibility private + def redirect_uris=(redirect_uris) + if redirect_uris.nil? + fail ArgumentError, 'invalid value for "redirect_uris", redirect_uris cannot be nil.' + end + @redirect_uris = redirect_uris + end + + # Custom attribute writer method with validation + # @param scope [Object] Object to be assigned + # @!visibility private + def scope=(scope) + if !scope.nil? && scope.to_s.length > 1000 + fail ArgumentError, 'invalid value for "scope", the character length must be smaller than or equal to 1000.' + end + @scope = scope + end + + # Custom attribute writer method with validation + # @param token_endpoint_auth_method [Object] Object to be assigned + # @!visibility private + def token_endpoint_auth_method=(token_endpoint_auth_method) + if !token_endpoint_auth_method.nil? && token_endpoint_auth_method.to_s.length > 20 + fail ArgumentError, 'invalid value for "token_endpoint_auth_method", the character length must be smaller than or equal to 20.' + end + @token_endpoint_auth_method = token_endpoint_auth_method + end + + # Custom attribute writer method with validation + # @param tos_uri [Object] Object to be assigned + # @!visibility private + def tos_uri=(tos_uri) + if !tos_uri.nil? && tos_uri.to_s.length > 1000 + fail ArgumentError, 'invalid value for "tos_uri", the character length must be smaller than or equal to 1000.' + end + @tos_uri = tos_uri + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + client_name == o.client_name && + client_uri == o.client_uri && + grant_types == o.grant_types && + jwks_uri == o.jwks_uri && + logo_uri == o.logo_uri && + policy_uri == o.policy_uri && + redirect_uris == o.redirect_uris && + response_types == o.response_types && + scope == o.scope && + token_endpoint_auth_method == o.token_endpoint_auth_method && + tos_uri == o.tos_uri && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [client_name, client_uri, grant_types, jwks_uri, logo_uri, policy_uri, redirect_uris, response_types, scope, token_endpoint_auth_method, tos_uri, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/o_auth_client_registration_response.rb b/lib/datadog_api_client/v2/models/o_auth_client_registration_response.rb new file mode 100644 index 000000000000..4b9ef409a5ad --- /dev/null +++ b/lib/datadog_api_client/v2/models/o_auth_client_registration_response.rb @@ -0,0 +1,234 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response payload for a successful OAuth2 dynamic client registration as defined by RFC 7591. + class OAuthClientRegistrationResponse + include BaseGenericModel + + # Unique identifier assigned to the registered client. + attr_reader :client_id + + # Human-readable name of the client. + attr_reader :client_name + + # OAuth 2.0 grant types registered for the client. + attr_reader :grant_types + + # Redirection URIs registered for the client. + attr_reader :redirect_uris + + # OAuth 2.0 response types registered for the client. + attr_reader :response_types + + # Authentication method registered for the token endpoint. Always `none`. + attr_reader :token_endpoint_auth_method + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'client_id' => :'client_id', + :'client_name' => :'client_name', + :'grant_types' => :'grant_types', + :'redirect_uris' => :'redirect_uris', + :'response_types' => :'response_types', + :'token_endpoint_auth_method' => :'token_endpoint_auth_method' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'client_id' => :'UUID', + :'client_name' => :'String', + :'grant_types' => :'Array', + :'redirect_uris' => :'Array', + :'response_types' => :'Array', + :'token_endpoint_auth_method' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OAuthClientRegistrationResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'client_id') + self.client_id = attributes[:'client_id'] + end + + if attributes.key?(:'client_name') + self.client_name = attributes[:'client_name'] + end + + if attributes.key?(:'grant_types') + if (value = attributes[:'grant_types']).is_a?(Array) + self.grant_types = value + end + end + + if attributes.key?(:'redirect_uris') + if (value = attributes[:'redirect_uris']).is_a?(Array) + self.redirect_uris = value + end + end + + if attributes.key?(:'response_types') + if (value = attributes[:'response_types']).is_a?(Array) + self.response_types = value + end + end + + if attributes.key?(:'token_endpoint_auth_method') + self.token_endpoint_auth_method = attributes[:'token_endpoint_auth_method'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @client_id.nil? + return false if @client_name.nil? + return false if @grant_types.nil? + return false if @redirect_uris.nil? + return false if @response_types.nil? + return false if @token_endpoint_auth_method.nil? + true + end + + # Custom attribute writer method with validation + # @param client_id [Object] Object to be assigned + # @!visibility private + def client_id=(client_id) + if client_id.nil? + fail ArgumentError, 'invalid value for "client_id", client_id cannot be nil.' + end + @client_id = client_id + end + + # Custom attribute writer method with validation + # @param client_name [Object] Object to be assigned + # @!visibility private + def client_name=(client_name) + if client_name.nil? + fail ArgumentError, 'invalid value for "client_name", client_name cannot be nil.' + end + @client_name = client_name + end + + # Custom attribute writer method with validation + # @param grant_types [Object] Object to be assigned + # @!visibility private + def grant_types=(grant_types) + if grant_types.nil? + fail ArgumentError, 'invalid value for "grant_types", grant_types cannot be nil.' + end + @grant_types = grant_types + end + + # Custom attribute writer method with validation + # @param redirect_uris [Object] Object to be assigned + # @!visibility private + def redirect_uris=(redirect_uris) + if redirect_uris.nil? + fail ArgumentError, 'invalid value for "redirect_uris", redirect_uris cannot be nil.' + end + @redirect_uris = redirect_uris + end + + # Custom attribute writer method with validation + # @param response_types [Object] Object to be assigned + # @!visibility private + def response_types=(response_types) + if response_types.nil? + fail ArgumentError, 'invalid value for "response_types", response_types cannot be nil.' + end + @response_types = response_types + end + + # Custom attribute writer method with validation + # @param token_endpoint_auth_method [Object] Object to be assigned + # @!visibility private + def token_endpoint_auth_method=(token_endpoint_auth_method) + if token_endpoint_auth_method.nil? + fail ArgumentError, 'invalid value for "token_endpoint_auth_method", token_endpoint_auth_method cannot be nil.' + end + @token_endpoint_auth_method = token_endpoint_auth_method + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + client_id == o.client_id && + client_name == o.client_name && + grant_types == o.grant_types && + redirect_uris == o.redirect_uris && + response_types == o.response_types && + token_endpoint_auth_method == o.token_endpoint_auth_method && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [client_id, client_name, grant_types, redirect_uris, response_types, token_endpoint_auth_method, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/cost_tag_metadata_month_type.rb b/lib/datadog_api_client/v2/models/o_auth_client_registration_response_type.rb similarity index 77% rename from lib/datadog_api_client/v2/models/cost_tag_metadata_month_type.rb rename to lib/datadog_api_client/v2/models/o_auth_client_registration_response_type.rb index f8779112e560..6c2847371ff5 100644 --- a/lib/datadog_api_client/v2/models/cost_tag_metadata_month_type.rb +++ b/lib/datadog_api_client/v2/models/o_auth_client_registration_response_type.rb @@ -17,10 +17,10 @@ require 'time' module DatadogAPIClient::V2 - # Type of the Cloud Cost Management tag metadata month resource. - class CostTagMetadataMonthType + # OAuth 2.0 response type that a registered client may use. + class OAuthClientRegistrationResponseType include BaseEnumModel - COST_TAG_METADATA_MONTH = "cost_tag_metadata_month".freeze + CODE = "code".freeze end end diff --git a/lib/datadog_api_client/v2/models/o_auth_oidc_scope.rb b/lib/datadog_api_client/v2/models/o_auth_oidc_scope.rb new file mode 100644 index 000000000000..4ae4befd6609 --- /dev/null +++ b/lib/datadog_api_client/v2/models/o_auth_oidc_scope.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # OIDC scope a client may be restricted to. + class OAuthOidcScope + include BaseEnumModel + + OPENID = "openid".freeze + PROFILE = "profile".freeze + EMAIL = "email".freeze + OFFLINE_ACCESS = "offline_access".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/o_auth_scopes_restriction.rb b/lib/datadog_api_client/v2/models/o_auth_scopes_restriction.rb new file mode 100644 index 000000000000..5aaf1633b8ea --- /dev/null +++ b/lib/datadog_api_client/v2/models/o_auth_scopes_restriction.rb @@ -0,0 +1,148 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Allowlist of OIDC and permission scopes enforced for the OAuth2 client. + class OAuthScopesRestriction + include BaseGenericModel + + # OIDC scopes the client is restricted to. + attr_reader :oidc_scopes + + # Datadog permission scopes the client is restricted to. + attr_reader :permission_scopes + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'oidc_scopes' => :'oidc_scopes', + :'permission_scopes' => :'permission_scopes' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'oidc_scopes' => :'Array', + :'permission_scopes' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OAuthScopesRestriction` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'oidc_scopes') + if (value = attributes[:'oidc_scopes']).is_a?(Array) + self.oidc_scopes = value + end + end + + if attributes.key?(:'permission_scopes') + if (value = attributes[:'permission_scopes']).is_a?(Array) + self.permission_scopes = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @oidc_scopes.nil? + return false if @permission_scopes.nil? + true + end + + # Custom attribute writer method with validation + # @param oidc_scopes [Object] Object to be assigned + # @!visibility private + def oidc_scopes=(oidc_scopes) + if oidc_scopes.nil? + fail ArgumentError, 'invalid value for "oidc_scopes", oidc_scopes cannot be nil.' + end + @oidc_scopes = oidc_scopes + end + + # Custom attribute writer method with validation + # @param permission_scopes [Object] Object to be assigned + # @!visibility private + def permission_scopes=(permission_scopes) + if permission_scopes.nil? + fail ArgumentError, 'invalid value for "permission_scopes", permission_scopes cannot be nil.' + end + @permission_scopes = permission_scopes + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + oidc_scopes == o.oidc_scopes && + permission_scopes == o.permission_scopes && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [oidc_scopes, permission_scopes, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/cost_tag_metadata_months_response.rb b/lib/datadog_api_client/v2/models/o_auth_scopes_restriction_response.rb similarity index 87% rename from lib/datadog_api_client/v2/models/cost_tag_metadata_months_response.rb rename to lib/datadog_api_client/v2/models/o_auth_scopes_restriction_response.rb index 9e3b46d205a9..8808631362e6 100644 --- a/lib/datadog_api_client/v2/models/cost_tag_metadata_months_response.rb +++ b/lib/datadog_api_client/v2/models/o_auth_scopes_restriction_response.rb @@ -17,11 +17,11 @@ require 'time' module DatadogAPIClient::V2 - # List of months that have Cloud Cost Management tag metadata for the requested provider, ordered most-recent first and capped at 36 months. - class CostTagMetadataMonthsResponse + # Response payload describing the scopes restriction of an OAuth2 client. + class OAuthScopesRestrictionResponse include BaseGenericModel - # List of months that have tag metadata available. + # Data object of an OAuth2 client scopes restriction response. attr_reader :data attr_accessor :additional_properties @@ -38,7 +38,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'data' => :'Array' + :'data' => :'OAuthScopesRestrictionResponseData' } end @@ -47,7 +47,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CostTagMetadataMonthsResponse` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OAuthScopesRestrictionResponse` initialize method" end self.additional_properties = {} @@ -61,9 +61,7 @@ def initialize(attributes = {}) } if attributes.key?(:'data') - if (value = attributes[:'data']).is_a?(Array) - self.data = value - end + self.data = attributes[:'data'] end end diff --git a/lib/datadog_api_client/v2/models/o_auth_scopes_restriction_response_attributes.rb b/lib/datadog_api_client/v2/models/o_auth_scopes_restriction_response_attributes.rb new file mode 100644 index 000000000000..18c8bdbb4aef --- /dev/null +++ b/lib/datadog_api_client/v2/models/o_auth_scopes_restriction_response_attributes.rb @@ -0,0 +1,127 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of an OAuth2 client scopes restriction. + class OAuthScopesRestrictionResponseAttributes + include BaseGenericModel + + # Permission scopes automatically required for this client (for example, mobile-app permission scopes). + # Returns `null` when no scopes are required. + attr_accessor :required_permission_scopes + + # Allowlist of OIDC and permission scopes enforced for the OAuth2 client. + attr_accessor :scopes_restriction + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'required_permission_scopes' => :'required_permission_scopes', + :'scopes_restriction' => :'scopes_restriction' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'required_permission_scopes' => :'Array', + :'scopes_restriction' => :'OAuthScopesRestriction' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'required_permission_scopes', + :'scopes_restriction', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OAuthScopesRestrictionResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'required_permission_scopes') + if (value = attributes[:'required_permission_scopes']).is_a?(Array) + self.required_permission_scopes = value + end + end + + if attributes.key?(:'scopes_restriction') + self.scopes_restriction = attributes[:'scopes_restriction'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + required_permission_scopes == o.required_permission_scopes && + scopes_restriction == o.scopes_restriction && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [required_permission_scopes, scopes_restriction, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/o_auth_scopes_restriction_response_data.rb b/lib/datadog_api_client/v2/models/o_auth_scopes_restriction_response_data.rb new file mode 100644 index 000000000000..70c8124753c0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/o_auth_scopes_restriction_response_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object of an OAuth2 client scopes restriction response. + class OAuthScopesRestrictionResponseData + include BaseGenericModel + + # Attributes of an OAuth2 client scopes restriction. + attr_reader :attributes + + # UUID of the OAuth2 client this restriction applies to. + attr_reader :id + + # JSON:API resource type for an OAuth2 client scopes restriction. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'OAuthScopesRestrictionResponseAttributes', + :'id' => :'UUID', + :'type' => :'OAuthScopesRestrictionType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OAuthScopesRestrictionResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/o_auth_scopes_restriction_type.rb b/lib/datadog_api_client/v2/models/o_auth_scopes_restriction_type.rb new file mode 100644 index 000000000000..0d0808aee801 --- /dev/null +++ b/lib/datadog_api_client/v2/models/o_auth_scopes_restriction_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource type for an OAuth2 client scopes restriction. + class OAuthScopesRestrictionType + include BaseEnumModel + + SCOPES_RESTRICTION = "scopes_restriction".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/cost_tag_metadata_month.rb b/lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_data.rb similarity index 79% rename from lib/datadog_api_client/v2/models/cost_tag_metadata_month.rb rename to lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_data.rb index 17087b4346cc..6cae03a85eec 100644 --- a/lib/datadog_api_client/v2/models/cost_tag_metadata_month.rb +++ b/lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_data.rb @@ -17,14 +17,14 @@ require 'time' module DatadogAPIClient::V2 - # A month that has Cloud Cost Management tag metadata available for a given provider. - class CostTagMetadataMonth + # Data object of an upsert OAuth2 scopes restriction request. + class UpsertOAuthScopesRestrictionData include BaseGenericModel - # The month, in `YYYY-MM` format. - attr_reader :id + # Attributes of an upsert OAuth2 scopes restriction request. + attr_accessor :attributes - # Type of the Cloud Cost Management tag metadata month resource. + # JSON:API resource type for an upsert OAuth2 client scopes restriction request. attr_reader :type attr_accessor :additional_properties @@ -33,7 +33,7 @@ class CostTagMetadataMonth # @!visibility private def self.attribute_map { - :'id' => :'id', + :'attributes' => :'attributes', :'type' => :'type' } end @@ -42,8 +42,8 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'id' => :'String', - :'type' => :'CostTagMetadataMonthType' + :'attributes' => :'UpsertOAuthScopesRestrictionDataAttributes', + :'type' => :'UpsertOAuthScopesRestrictionType' } end @@ -52,7 +52,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CostTagMetadataMonth` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::UpsertOAuthScopesRestrictionData` initialize method" end self.additional_properties = {} @@ -65,8 +65,8 @@ def initialize(attributes = {}) end } - if attributes.key?(:'id') - self.id = attributes[:'id'] + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] end if attributes.key?(:'type') @@ -78,21 +78,10 @@ def initialize(attributes = {}) # @return true if the model is valid # @!visibility private def valid? - return false if @id.nil? return false if @type.nil? true end - # Custom attribute writer method with validation - # @param id [Object] Object to be assigned - # @!visibility private - def id=(id) - if id.nil? - fail ArgumentError, 'invalid value for "id", id cannot be nil.' - end - @id = id - end - # Custom attribute writer method with validation # @param type [Object] Object to be assigned # @!visibility private @@ -129,7 +118,7 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && - id == o.id && + attributes == o.attributes && type == o.type && additional_properties == o.additional_properties end @@ -138,7 +127,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [id, type, additional_properties].hash + [attributes, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_data_attributes.rb b/lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_data_attributes.rb new file mode 100644 index 000000000000..992dddb15dd8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_data_attributes.rb @@ -0,0 +1,120 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of an upsert OAuth2 scopes restriction request. + class UpsertOAuthScopesRestrictionDataAttributes + include BaseGenericModel + + # OIDC scopes the client is allowed to request. + attr_accessor :oidc_scopes + + # Datadog permission scopes the client is allowed to request. + # Each value must be a valid permission name. + attr_accessor :permission_scopes + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'oidc_scopes' => :'oidc_scopes', + :'permission_scopes' => :'permission_scopes' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'oidc_scopes' => :'Array', + :'permission_scopes' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::UpsertOAuthScopesRestrictionDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'oidc_scopes') + if (value = attributes[:'oidc_scopes']).is_a?(Array) + self.oidc_scopes = value + end + end + + if attributes.key?(:'permission_scopes') + if (value = attributes[:'permission_scopes']).is_a?(Array) + self.permission_scopes = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + oidc_scopes == o.oidc_scopes && + permission_scopes == o.permission_scopes && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [oidc_scopes, permission_scopes, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_request.rb b/lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_request.rb new file mode 100644 index 000000000000..03ba65e4f357 --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request payload for creating or updating the scopes restriction of an OAuth2 client. + class UpsertOAuthScopesRestrictionRequest + include BaseGenericModel + + # Data object of an upsert OAuth2 scopes restriction request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'UpsertOAuthScopesRestrictionData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::UpsertOAuthScopesRestrictionRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_type.rb b/lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_type.rb new file mode 100644 index 000000000000..ca38a2df07d3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource type for an upsert OAuth2 client scopes restriction request. + class UpsertOAuthScopesRestrictionType + include BaseEnumModel + + UPSERT_SCOPES_RESTRICTION = "upsert_scopes_restriction".freeze + end +end