diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index dede702aea71..0b0d95213e6b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1034,6 +1034,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" @@ -48934,6 +48943,51 @@ components: example: "/api/v2/catalog/relation?filter[from_ref]=service:service-catalog&include=entity&page[limit]=2&page[offset]=0" type: string type: object + ListRowsResponse: + description: Paginated list of reference table rows. + example: + data: + - attributes: + values: + category: tor + intention: suspicious + ip_address: 102.130.113.9 + id: 102.130.113.9 + type: row + links: + first: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Blimit%5D=100" + self: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100" + properties: + data: + description: The rows. + items: + $ref: "#/components/schemas/TableRowResourceData" + type: array + links: + $ref: "#/components/schemas/ListRowsResponseLinks" + required: + - data + - links + type: object + ListRowsResponseLinks: + description: Pagination links for the list rows response. + properties: + first: + description: Link to the first page of results. + example: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Blimit%5D=100" + type: string + next: + description: Link to the next page of results. Only present when more rows are available. + example: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100" + type: string + self: + description: Link to the current page of results. + example: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100" + type: string + required: + - self + - first + type: object ListRulesResponse: description: Scorecard rules response. properties: @@ -54649,6 +54703,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: @@ -92269,6 +92573,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: @@ -134428,6 +134783,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. @@ -140887,6 +141459,73 @@ paths: summary: Upsert rows tags: - Reference Tables + /api/v2/reference-tables/tables/{id}/rows/list: + get: + description: List all rows in a reference table using cursor-based pagination. Pass the `page[continuation_token]` from the previous response to fetch the next page on the same consistent snapshot. Returns 400 for tables with more than 10,000,000 rows. + operationId: ListReferenceTableRows + parameters: + - description: Unique identifier of the reference table to list rows from. + example: "00000000-0000-0000-0000-000000000000" + in: path + name: id + required: true + schema: + type: string + - description: Number of rows to return per page. Defaults to 100, maximum is 1000. + example: 100 + in: query + name: page[limit] + required: false + schema: + default: 100 + format: int64 + maximum: 1000 + minimum: 1 + type: integer + - description: Opaque cursor from the previous response's next link. Pass this to retrieve the next page on the same consistent snapshot. + example: "eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ==" + in: query + name: page[continuation_token] + required: false + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + values: + category: tor + intention: suspicious + ip_address: 102.130.113.9 + id: 102.130.113.9 + type: row + links: + first: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Blimit%5D=100" + next: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjY5NzA0ODkwNDE4ODA3MTAzOTgsInBrIjoiMTAyLjEzMC4xMjcuMTE3In0%3D&page%5Blimit%5D=100" + self: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100" + schema: + $ref: "#/components/schemas/ListRowsResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List rows + tags: + - Reference Tables /api/v2/reference-tables/uploads: post: description: Create a reference table upload for bulk data ingestion @@ -167842,6 +168481,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/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Bad-Request-response-for-invalid-limit.frozen b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Bad-Request-response-for-invalid-limit.frozen new file mode 100644 index 000000000000..84c1983149ea --- /dev/null +++ b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Bad-Request-response-for-invalid-limit.frozen @@ -0,0 +1 @@ +2026-05-15T19:32:21.293Z \ No newline at end of file diff --git a/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Bad-Request-response-for-invalid-limit.yml b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Bad-Request-response-for-invalid-limit.yml new file mode 100644 index 000000000000..3d715c914725 --- /dev/null +++ b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Bad-Request-response-for-invalid-limit.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Fri, 15 May 2026 19:32:21 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/reference-tables/tables/not-a-valid-uuid/rows/list + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"table ID must be a valid + UUID format"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Not-Found-response.frozen b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..58c81afc5ec5 --- /dev/null +++ b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-05-15T19:32:23.068Z \ No newline at end of file diff --git a/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Not-Found-response.yml b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Not-Found-response.yml new file mode 100644 index 000000000000..c711c8ca53df --- /dev/null +++ b/cassettes/features/v2/reference_tables/List-reference-table-rows-returns-Not-Found-response.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Fri, 15 May 2026 19:32:23 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","title":"Not Found","detail":"table not + found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 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/examples/v2/reference-tables/ListReferenceTableRows.rb b/examples/v2/reference-tables/ListReferenceTableRows.rb new file mode 100644 index 000000000000..c07ce192e480 --- /dev/null +++ b/examples/v2/reference-tables/ListReferenceTableRows.rb @@ -0,0 +1,5 @@ +# List rows returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ReferenceTablesAPI.new +p api_instance.list_reference_table_rows("id") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 95054c25f8dd..56c944077a41 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3881,6 +3881,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", @@ -4258,6 +4271,11 @@ "id" => "String", "body" => "BatchUpsertRowsRequestArray", }, + "v2.ListReferenceTableRows" => { + "id" => "String", + "page_limit" => "Integer", + "page_continuation_token" => "String", + }, "v2.CreateReferenceTableUpload" => { "body" => "CreateUploadRequest", }, 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/reference_tables.feature b/features/v2/reference_tables.feature index 0ba8738c6b9f..859f70c13ec0 100644 --- a/features/v2/reference_tables.feature +++ b/features/v2/reference_tables.feature @@ -142,6 +142,41 @@ Feature: Reference Tables When the request is sent Then the response status is 200 OK + @team:DataDog/redapl-experiences + Scenario: List reference table rows returns "Bad Request" response for invalid limit + Given new "ListReferenceTableRows" request + And request contains "id" parameter with value "not-a-valid-uuid" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/redapl-experiences + Scenario: List reference table rows returns "Not Found" response + Given new "ListReferenceTableRows" request + And request contains "id" parameter with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/redapl-experiences + Scenario: List rows returns "Bad Request" response + Given new "ListReferenceTableRows" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/redapl-experiences + Scenario: List rows returns "Not Found" response + Given new "ListReferenceTableRows" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/redapl-experiences + Scenario: List rows returns "OK" response + Given new "ListReferenceTableRows" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/redapl-experiences Scenario: List tables returns "OK" response Given new "ListTables" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 0878797ffd8c..e6f52033958f 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -4678,6 +4678,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": { @@ -5371,6 +5395,12 @@ "type": "unsafe" } }, + "ListReferenceTableRows": { + "tag": "Reference Tables", + "undo": { + "type": "safe" + } + }, "CreateReferenceTableUpload": { "tag": "Reference Tables", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index bf08354c8d54..19120a954229 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -520,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 abbf1654651c..4d59a909cc7b 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3787,6 +3787,8 @@ def overrides "v2.list_powerpacks_response" => "ListPowerpacksResponse", "v2.list_relation_catalog_response" => "ListRelationCatalogResponse", "v2.list_relation_catalog_response_links" => "ListRelationCatalogResponseLinks", + "v2.list_rows_response" => "ListRowsResponse", + "v2.list_rows_response_links" => "ListRowsResponseLinks", "v2.list_rules_response" => "ListRulesResponse", "v2.list_rules_response_data_item" => "ListRulesResponseDataItem", "v2.list_rules_response_links" => "ListRulesResponseLinks", @@ -4442,6 +4444,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", @@ -6832,6 +6845,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", @@ -7098,6 +7115,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/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/api/reference_tables_api.rb b/lib/datadog_api_client/v2/api/reference_tables_api.rb index 97df6f86556e..c0d8f3abfda6 100644 --- a/lib/datadog_api_client/v2/api/reference_tables_api.rb +++ b/lib/datadog_api_client/v2/api/reference_tables_api.rb @@ -502,6 +502,81 @@ def get_table_with_http_info(id, opts = {}) return data, status_code, headers end + # List rows. + # + # @see #list_reference_table_rows_with_http_info + def list_reference_table_rows(id, opts = {}) + data, _status_code, _headers = list_reference_table_rows_with_http_info(id, opts) + data + end + + # List rows. + # + # List all rows in a reference table using cursor-based pagination. Pass the `page[continuation_token]` from the previous response to fetch the next page on the same consistent snapshot. Returns 400 for tables with more than 10,000,000 rows. + # + # @param id [String] Unique identifier of the reference table to list rows from. + # @param opts [Hash] the optional parameters + # @option opts [Integer] :page_limit Number of rows to return per page. Defaults to 100, maximum is 1000. + # @option opts [String] :page_continuation_token Opaque cursor from the previous response's next link. Pass this to retrieve the next page on the same consistent snapshot. + # @return [Array<(ListRowsResponse, Integer, Hash)>] ListRowsResponse data, response status code and response headers + def list_reference_table_rows_with_http_info(id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReferenceTablesAPI.list_reference_table_rows ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ReferenceTablesAPI.list_reference_table_rows" + end + if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 1000 + fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling ReferenceTablesAPI.list_reference_table_rows, must be smaller than or equal to 1000.' + end + if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling ReferenceTablesAPI.list_reference_table_rows, must be greater than or equal to 1.' + end + # resource path + local_var_path = '/api/v2/reference-tables/tables/{id}/rows/list'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil? + query_params[:'page[continuation_token]'] = opts[:'page_continuation_token'] if !opts[:'page_continuation_token'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListRowsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_reference_table_rows, + :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: ReferenceTablesAPI#list_reference_table_rows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List tables. # # @see #list_tables_with_http_info diff --git a/lib/datadog_api_client/v2/models/list_rows_response.rb b/lib/datadog_api_client/v2/models/list_rows_response.rb new file mode 100644 index 000000000000..83d562f457f8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/list_rows_response.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Paginated list of reference table rows. + class ListRowsResponse + include BaseGenericModel + + # The rows. + attr_reader :data + + # Pagination links for the list rows response. + attr_reader :links + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'links' => :'links' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'links' => :'ListRowsResponseLinks' + } + 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::ListRowsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'links') + self.links = attributes[:'links'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + return false if @links.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Custom attribute writer method with validation + # @param links [Object] Object to be assigned + # @!visibility private + def links=(links) + if links.nil? + fail ArgumentError, 'invalid value for "links", links cannot be nil.' + end + @links = links + 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 && + links == o.links && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, links, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/list_rows_response_links.rb b/lib/datadog_api_client/v2/models/list_rows_response_links.rb new file mode 100644 index 000000000000..d79c72a4504c --- /dev/null +++ b/lib/datadog_api_client/v2/models/list_rows_response_links.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Pagination links for the list rows response. + class ListRowsResponseLinks + include BaseGenericModel + + # Link to the first page of results. + attr_reader :first + + # Link to the next page of results. Only present when more rows are available. + attr_accessor :_next + + # Link to the current page of results. + attr_reader :_self + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'first' => :'first', + :'_next' => :'next', + :'_self' => :'self' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'first' => :'String', + :'_next' => :'String', + :'_self' => :'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::ListRowsResponseLinks` 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?(:'first') + self.first = attributes[:'first'] + end + + if attributes.key?(:'_next') + self._next = attributes[:'_next'] + end + + if attributes.key?(:'_self') + self._self = attributes[:'_self'] + 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 @first.nil? + return false if @_self.nil? + true + end + + # Custom attribute writer method with validation + # @param first [Object] Object to be assigned + # @!visibility private + def first=(first) + if first.nil? + fail ArgumentError, 'invalid value for "first", first cannot be nil.' + end + @first = first + end + + # Custom attribute writer method with validation + # @param _self [Object] Object to be assigned + # @!visibility private + def _self=(_self) + if _self.nil? + fail ArgumentError, 'invalid value for "_self", _self cannot be nil.' + end + @_self = _self + 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 && + first == o.first && + _next == o._next && + _self == o._self && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [first, _next, _self, additional_properties].hash + 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/o_auth_client_registration_response_type.rb b/lib/datadog_api_client/v2/models/o_auth_client_registration_response_type.rb new file mode 100644 index 000000000000..6c2847371ff5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/o_auth_client_registration_response_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 + # OAuth 2.0 response type that a registered client may use. + class OAuthClientRegistrationResponseType + include BaseEnumModel + + 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/o_auth_scopes_restriction_response.rb b/lib/datadog_api_client/v2/models/o_auth_scopes_restriction_response.rb new file mode 100644 index 000000000000..8808631362e6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/o_auth_scopes_restriction_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response payload describing the scopes restriction of an OAuth2 client. + class OAuthScopesRestrictionResponse + include BaseGenericModel + + # Data object of an OAuth2 client scopes restriction response. + 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' => :'OAuthScopesRestrictionResponseData' + } + 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::OAuthScopesRestrictionResponse` 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/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/upsert_o_auth_scopes_restriction_data.rb b/lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_data.rb new file mode 100644 index 000000000000..6cae03a85eec --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_o_auth_scopes_restriction_data.rb @@ -0,0 +1,133 @@ +=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 upsert OAuth2 scopes restriction request. + class UpsertOAuthScopesRestrictionData + include BaseGenericModel + + # Attributes of an upsert OAuth2 scopes restriction request. + attr_accessor :attributes + + # JSON:API resource type for an upsert OAuth2 client scopes restriction request. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'UpsertOAuthScopesRestrictionDataAttributes', + :'type' => :'UpsertOAuthScopesRestrictionType' + } + 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::UpsertOAuthScopesRestrictionData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/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