diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 795f35ac355..453a74bab79 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1026,6 +1026,15 @@ components: required: true schema: type: string + OAuthClientUUIDPathParameter: + description: UUID of the OAuth2 client. + in: path + name: client_uuid + required: true + schema: + example: fafa8e1c-36a5-11f0-a83d-da7ad0900001 + format: uuid + type: string OnDemandTaskId: description: The UUID of the task. example: "6d09294c-9ad9-42fd-a759-a0c1599b4828" @@ -19897,45 +19906,6 @@ components: x-enum-varnames: - "TRUE" - "FALSE" - CostTagMetadataMonth: - description: A month that has Cloud Cost Management tag metadata available for a given provider. - properties: - id: - description: The month, in `YYYY-MM` format. - example: "2026-04" - type: string - type: - $ref: "#/components/schemas/CostTagMetadataMonthType" - required: - - id - - type - type: object - CostTagMetadataMonthType: - default: cost_tag_metadata_month - description: Type of the Cloud Cost Management tag metadata month resource. - enum: - - cost_tag_metadata_month - example: cost_tag_metadata_month - type: string - x-enum-varnames: - - COST_TAG_METADATA_MONTH - CostTagMetadataMonthsResponse: - description: List of months that have Cloud Cost Management tag metadata for the requested provider, ordered most-recent first and capped at 36 months. - example: - data: - - id: "2026-04" - type: cost_tag_metadata_month - - id: "2026-03" - type: cost_tag_metadata_month - properties: - data: - description: List of months that have tag metadata available. - items: - $ref: "#/components/schemas/CostTagMetadataMonth" - type: array - required: - - data - type: object CostTagType: default: cost_tag description: Type of the Cloud Cost Management tag resource. @@ -54635,6 +54605,256 @@ components: - id - type type: object + OAuthClientRegistrationError: + description: Error payload returned by OAuth2 dynamic client registration as defined by RFC 7591. + properties: + error: + description: Single ASCII error code per RFC 7591, such as `invalid_request` or `invalid_client_metadata`. + example: invalid_client_metadata + type: string + error_description: + description: Human-readable description of the error. + example: redirect URI is not well-formed + type: string + required: + - error + - error_description + type: object + OAuthClientRegistrationGrantType: + description: OAuth 2.0 grant type that a registered client may use. + enum: + - authorization_code + - refresh_token + example: authorization_code + type: string + x-enum-varnames: + - AUTHORIZATION_CODE + - REFRESH_TOKEN + OAuthClientRegistrationRequest: + description: Request payload for OAuth2 dynamic client registration as defined by RFC 7591. + properties: + client_name: + description: Human-readable name of the client. Control characters are rejected. + example: Example MCP Client + maxLength: 1000 + type: string + client_uri: + description: URL of the home page of the client. + example: https://example.com + maxLength: 1000 + type: string + grant_types: + description: |- + OAuth 2.0 grant types the client may use. + Defaults to `authorization_code` and `refresh_token` when omitted. + example: + - authorization_code + - refresh_token + items: + $ref: "#/components/schemas/OAuthClientRegistrationGrantType" + type: array + jwks_uri: + description: URL referencing the client's JSON Web Key Set. + example: https://example.com/.well-known/jwks.json + maxLength: 1000 + type: string + logo_uri: + description: URL referencing a logo for the client. + example: https://example.com/logo.png + maxLength: 1000 + type: string + policy_uri: + description: URL pointing to the client's privacy policy. + example: https://example.com/privacy + maxLength: 1000 + type: string + redirect_uris: + description: Array of redirection URI strings used by the client in redirect-based flows. + example: + - https://example.com/oauth/callback + items: + description: Redirection URI registered for the client. + example: https://example.com/oauth/callback + maxLength: 1000 + type: string + type: array + response_types: + description: OAuth 2.0 response types the client may use. Only `code` is supported. + example: + - code + items: + $ref: "#/components/schemas/OAuthClientRegistrationResponseType" + type: array + scope: + description: Space-separated list of scope values the client may request. + example: openid profile + maxLength: 1000 + type: string + token_endpoint_auth_method: + description: Requested authentication method for the token endpoint. Only `none` is supported. + example: none + maxLength: 20 + type: string + tos_uri: + description: URL pointing to the client's terms of service. + example: https://example.com/tos + maxLength: 1000 + type: string + required: + - client_name + - redirect_uris + type: object + OAuthClientRegistrationResponse: + description: Response payload for a successful OAuth2 dynamic client registration as defined by RFC 7591. + properties: + client_id: + description: Unique identifier assigned to the registered client. + example: 72b68208-36a6-11f0-b21b-da7ad0900002 + format: uuid + type: string + client_name: + description: Human-readable name of the client. + example: Example MCP Client + type: string + grant_types: + description: OAuth 2.0 grant types registered for the client. + example: + - authorization_code + - refresh_token + items: + $ref: "#/components/schemas/OAuthClientRegistrationGrantType" + type: array + redirect_uris: + description: Redirection URIs registered for the client. + example: + - https://example.com/oauth/callback + items: + description: Redirection URI registered for the client. + example: https://example.com/oauth/callback + type: string + type: array + response_types: + description: OAuth 2.0 response types registered for the client. + example: + - code + items: + $ref: "#/components/schemas/OAuthClientRegistrationResponseType" + type: array + token_endpoint_auth_method: + description: Authentication method registered for the token endpoint. Always `none`. + example: none + type: string + required: + - client_id + - client_name + - redirect_uris + - token_endpoint_auth_method + - grant_types + - response_types + type: object + OAuthClientRegistrationResponseType: + description: OAuth 2.0 response type that a registered client may use. + enum: + - code + example: code + type: string + x-enum-varnames: + - CODE + OAuthOidcScope: + description: OIDC scope a client may be restricted to. + enum: + - openid + - profile + - email + - offline_access + example: openid + type: string + x-enum-varnames: + - OPENID + - PROFILE + - EMAIL + - OFFLINE_ACCESS + OAuthScopesRestriction: + description: Allowlist of OIDC and permission scopes enforced for the OAuth2 client. + nullable: true + properties: + oidc_scopes: + description: OIDC scopes the client is restricted to. + example: + - openid + - email + items: + $ref: "#/components/schemas/OAuthOidcScope" + type: array + permission_scopes: + description: Datadog permission scopes the client is restricted to. + example: + - dashboards_read + - metrics_read + items: + description: Datadog permission scope name. + example: dashboards_read + type: string + type: array + required: + - oidc_scopes + - permission_scopes + type: object + OAuthScopesRestrictionResponse: + description: Response payload describing the scopes restriction of an OAuth2 client. + properties: + data: + $ref: "#/components/schemas/OAuthScopesRestrictionResponseData" + required: + - data + type: object + OAuthScopesRestrictionResponseAttributes: + description: Attributes of an OAuth2 client scopes restriction. + properties: + required_permission_scopes: + description: |- + Permission scopes automatically required for this client (for example, mobile-app permission scopes). + Returns `null` when no scopes are required. + example: + - mobile_app_access + items: + description: Datadog permission scope name. + example: mobile_app_access + type: string + nullable: true + type: array + scopes_restriction: + $ref: "#/components/schemas/OAuthScopesRestriction" + required: + - scopes_restriction + - required_permission_scopes + type: object + OAuthScopesRestrictionResponseData: + description: Data object of an OAuth2 client scopes restriction response. + properties: + attributes: + $ref: "#/components/schemas/OAuthScopesRestrictionResponseAttributes" + id: + description: UUID of the OAuth2 client this restriction applies to. + example: fafa8e1c-36a5-11f0-a83d-da7ad0900001 + format: uuid + type: string + type: + $ref: "#/components/schemas/OAuthScopesRestrictionType" + required: + - id + - type + - attributes + type: object + OAuthScopesRestrictionType: + default: scopes_restriction + description: JSON:API resource type for an OAuth2 client scopes restriction. + enum: + - scopes_restriction + example: scopes_restriction + type: string + x-enum-varnames: + - SCOPES_RESTRICTION OCIConfig: description: OCI config. properties: @@ -92179,6 +92399,57 @@ components: - id - attributes type: object + UpsertOAuthScopesRestrictionData: + description: Data object of an upsert OAuth2 scopes restriction request. + properties: + attributes: + $ref: "#/components/schemas/UpsertOAuthScopesRestrictionDataAttributes" + type: + $ref: "#/components/schemas/UpsertOAuthScopesRestrictionType" + required: + - type + type: object + UpsertOAuthScopesRestrictionDataAttributes: + description: Attributes of an upsert OAuth2 scopes restriction request. + properties: + oidc_scopes: + description: OIDC scopes the client is allowed to request. + example: + - openid + - email + items: + $ref: "#/components/schemas/OAuthOidcScope" + type: array + permission_scopes: + description: |- + Datadog permission scopes the client is allowed to request. + Each value must be a valid permission name. + example: + - dashboards_read + - metrics_read + items: + description: Datadog permission scope name. + example: dashboards_read + type: string + type: array + type: object + UpsertOAuthScopesRestrictionRequest: + description: Request payload for creating or updating the scopes restriction of an OAuth2 client. + properties: + data: + $ref: "#/components/schemas/UpsertOAuthScopesRestrictionData" + required: + - data + type: object + UpsertOAuthScopesRestrictionType: + default: upsert_scopes_restriction + description: JSON:API resource type for an upsert OAuth2 client scopes restriction request. + enum: + - upsert_scopes_restriction + example: upsert_scopes_restriction + type: string + x-enum-varnames: + - UPSERT_SCOPES_RESTRICTION Urgency: description: Specifies the level of urgency for a routing rule (low, high, or dynamic). enum: @@ -111174,68 +111445,6 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - /api/v2/cost/tag_metadata/months: - get: - description: |- - List months that have Cloud Cost Management tag metadata for a given provider, - ordered most-recent first. The response is capped at 36 months. - operationId: ListCostTagMetadataMonths - parameters: - - description: |- - Provider to scope the query to. Use the value of the `providername` tag in CCM - (for example, `aws`, `azure`, `gcp`, `Oracle`, `Confluent Cloud`, `Snowflake`). - For costs uploaded through the Custom Costs API, use `custom`. - Values are case-sensitive. - example: aws - in: query - name: filter[provider] - required: true - schema: - type: string - responses: - "200": - content: - application/json: - examples: - default: - value: - data: - - id: "2026-04" - type: cost_tag_metadata_month - - id: "2026-03" - type: cost_tag_metadata_month - schema: - $ref: "#/components/schemas/CostTagMetadataMonthsResponse" - description: OK - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/APIErrorResponse" - description: Bad Request - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/APIErrorResponse" - description: Forbidden - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - apiKeyAuth: [] - appKeyAuth: [] - - AuthZ: - - cloud_cost_management_read - summary: List Cloud Cost Management tag metadata months - tags: - - Cloud Cost Management - "x-permission": - operator: OR - permissions: - - cloud_cost_management_read - x-unstable: |- - **Note**: This endpoint is in preview and is subject to change. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/cost/tag_metadata/orchestrators: get: description: List container orchestrators (for example, `kubernetes`, `ecs`) detected in Cloud Cost Management data for the requested period. @@ -134311,6 +134520,223 @@ paths: summary: Get all aggregated DNS traffic tags: - Cloud Network Monitoring + /api/v2/oauth2/clients/{client_uuid}/scopes_restriction: + delete: + description: Delete the scopes restriction configured for the OAuth2 client. + operationId: DeleteScopesRestriction + parameters: + - $ref: "#/components/parameters/OAuthClientUUIDPathParameter" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete an OAuth2 client scopes restriction + tags: + - OAuth2 Client Public + x-permission: + operator: OR + permissions: + - org_authorized_apps_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get the scopes restriction configured for the OAuth2 client. + operationId: GetScopesRestriction + parameters: + - $ref: "#/components/parameters/OAuthClientUUIDPathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + required_permission_scopes: + scopes_restriction: + oidc_scopes: + - openid + - email + permission_scopes: + - dashboards_read + - metrics_read + id: fafa8e1c-36a5-11f0-a83d-da7ad0900001 + type: scopes_restriction + schema: + $ref: "#/components/schemas/OAuthScopesRestrictionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get an OAuth2 client scopes restriction + tags: + - OAuth2 Client Public + x-permission: + operator: OR + permissions: + - org_authorized_apps_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create or update the scopes restriction configured for the OAuth2 client. + operationId: UpsertScopesRestriction + parameters: + - $ref: "#/components/parameters/OAuthClientUUIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + oidc_scopes: + - openid + - email + permission_scopes: + - dashboards_read + - metrics_read + type: upsert_scopes_restriction + schema: + $ref: "#/components/schemas/UpsertOAuthScopesRestrictionRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + required_permission_scopes: + scopes_restriction: + oidc_scopes: + - openid + - email + permission_scopes: + - dashboards_read + - metrics_read + id: fafa8e1c-36a5-11f0-a83d-da7ad0900001 + type: scopes_restriction + schema: + $ref: "#/components/schemas/OAuthScopesRestrictionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Upsert an OAuth2 client scopes restriction + tags: + - OAuth2 Client Public + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - org_authorized_apps_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/oauth2/register: + post: + description: Register an OAuth2 client using the Dynamic Client Registration protocol defined in RFC 7591. + operationId: RegisterOAuthClient + requestBody: + content: + application/json: + examples: + default: + value: + client_name: Example MCP Client + grant_types: + - authorization_code + - refresh_token + redirect_uris: + - https://example.com/oauth/callback + response_types: + - code + token_endpoint_auth_method: none + schema: + $ref: "#/components/schemas/OAuthClientRegistrationRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + client_id: 72b68208-36a6-11f0-b21b-da7ad0900002 + client_name: Example MCP Client + grant_types: + - authorization_code + - refresh_token + redirect_uris: + - https://example.com/oauth/callback + response_types: + - code + token_endpoint_auth_method: none + schema: + $ref: "#/components/schemas/OAuthClientRegistrationResponse" + description: Created + "400": + content: + application/json: + examples: + default: + value: + error: invalid_client_metadata + error_description: redirect URI is not well-formed + schema: + $ref: "#/components/schemas/OAuthClientRegistrationError" + description: Bad Request + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: [] + summary: Register an OAuth2 client + tags: + - OAuth2 Client Public + x-codegen-request-body-name: body + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/obs-pipelines/pipelines: get: description: Retrieve a list of pipelines. @@ -167727,6 +168153,10 @@ tags: - description: |- The Network Device Monitoring API allows you to fetch devices and interfaces and their attributes. See the [Network Device Monitoring page](https://docs.datadoghq.com/network_monitoring/) for more information. name: Network Device Monitoring + - description: |- + Configure OAuth2 clients for Datadog. + Supports RFC 7591 Dynamic Client Registration and management of OAuth2 client scopes restrictions. + name: OAuth2 Client Public - description: Auto-generated tag OCI Integration name: OCI Integration - description: |- diff --git a/examples/v2/cloud-cost-management/ListCostTagMetadataMonths.java b/examples/v2/cloud-cost-management/ListCostTagMetadataMonths.java deleted file mode 100644 index aeb96ecbd3b..00000000000 --- a/examples/v2/cloud-cost-management/ListCostTagMetadataMonths.java +++ /dev/null @@ -1,25 +0,0 @@ -// List Cloud Cost Management tag metadata months returns "OK" response - -import com.datadog.api.client.ApiClient; -import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.CloudCostManagementApi; -import com.datadog.api.client.v2.model.CostTagMetadataMonthsResponse; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = ApiClient.getDefaultApiClient(); - defaultClient.setUnstableOperationEnabled("v2.listCostTagMetadataMonths", true); - CloudCostManagementApi apiInstance = new CloudCostManagementApi(defaultClient); - - try { - CostTagMetadataMonthsResponse result = apiInstance.listCostTagMetadataMonths("aws"); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling CloudCostManagementApi#listCostTagMetadataMonths"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} diff --git a/examples/v2/oauth2-client-public/DeleteScopesRestriction.java b/examples/v2/oauth2-client-public/DeleteScopesRestriction.java new file mode 100644 index 00000000000..602fee9fd1f --- /dev/null +++ b/examples/v2/oauth2-client-public/DeleteScopesRestriction.java @@ -0,0 +1,24 @@ +// Delete an OAuth2 client scopes restriction returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OAuth2ClientPublicApi; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteScopesRestriction", true); + OAuth2ClientPublicApi apiInstance = new OAuth2ClientPublicApi(defaultClient); + + try { + apiInstance.deleteScopesRestriction(UUID.fromString("fafa8e1c-36a5-11f0-a83d-da7ad0900001")); + } catch (ApiException e) { + System.err.println("Exception when calling OAuth2ClientPublicApi#deleteScopesRestriction"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/oauth2-client-public/GetScopesRestriction.java b/examples/v2/oauth2-client-public/GetScopesRestriction.java new file mode 100644 index 00000000000..b5292323a93 --- /dev/null +++ b/examples/v2/oauth2-client-public/GetScopesRestriction.java @@ -0,0 +1,27 @@ +// Get an OAuth2 client scopes restriction returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OAuth2ClientPublicApi; +import com.datadog.api.client.v2.model.OAuthScopesRestrictionResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getScopesRestriction", true); + OAuth2ClientPublicApi apiInstance = new OAuth2ClientPublicApi(defaultClient); + + try { + OAuthScopesRestrictionResponse result = + apiInstance.getScopesRestriction(UUID.fromString("fafa8e1c-36a5-11f0-a83d-da7ad0900001")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling OAuth2ClientPublicApi#getScopesRestriction"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/oauth2-client-public/RegisterOAuthClient.java b/examples/v2/oauth2-client-public/RegisterOAuthClient.java new file mode 100644 index 00000000000..efb5b182175 --- /dev/null +++ b/examples/v2/oauth2-client-public/RegisterOAuthClient.java @@ -0,0 +1,47 @@ +// Register an OAuth2 client returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OAuth2ClientPublicApi; +import com.datadog.api.client.v2.model.OAuthClientRegistrationGrantType; +import com.datadog.api.client.v2.model.OAuthClientRegistrationRequest; +import com.datadog.api.client.v2.model.OAuthClientRegistrationResponse; +import com.datadog.api.client.v2.model.OAuthClientRegistrationResponseType; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.registerOAuthClient", true); + OAuth2ClientPublicApi apiInstance = new OAuth2ClientPublicApi(defaultClient); + + OAuthClientRegistrationRequest body = + new OAuthClientRegistrationRequest() + .clientName("Example MCP Client") + .clientUri("https://example.com") + .grantTypes( + Arrays.asList( + OAuthClientRegistrationGrantType.AUTHORIZATION_CODE, + OAuthClientRegistrationGrantType.REFRESH_TOKEN)) + .jwksUri("https://example.com/.well-known/jwks.json") + .logoUri("https://example.com/logo.png") + .policyUri("https://example.com/privacy") + .redirectUris(Collections.singletonList("https://example.com/oauth/callback")) + .responseTypes(Collections.singletonList(OAuthClientRegistrationResponseType.CODE)) + .scope("openid profile") + .tokenEndpointAuthMethod("none") + .tosUri("https://example.com/tos"); + + try { + OAuthClientRegistrationResponse result = apiInstance.registerOAuthClient(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling OAuth2ClientPublicApi#registerOAuthClient"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/oauth2-client-public/UpsertScopesRestriction.java b/examples/v2/oauth2-client-public/UpsertScopesRestriction.java new file mode 100644 index 00000000000..7a94c0d1f16 --- /dev/null +++ b/examples/v2/oauth2-client-public/UpsertScopesRestriction.java @@ -0,0 +1,44 @@ +// Upsert an OAuth2 client scopes restriction returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OAuth2ClientPublicApi; +import com.datadog.api.client.v2.model.OAuthOidcScope; +import com.datadog.api.client.v2.model.OAuthScopesRestrictionResponse; +import com.datadog.api.client.v2.model.UpsertOAuthScopesRestrictionData; +import com.datadog.api.client.v2.model.UpsertOAuthScopesRestrictionDataAttributes; +import com.datadog.api.client.v2.model.UpsertOAuthScopesRestrictionRequest; +import com.datadog.api.client.v2.model.UpsertOAuthScopesRestrictionType; +import java.util.Arrays; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.upsertScopesRestriction", true); + OAuth2ClientPublicApi apiInstance = new OAuth2ClientPublicApi(defaultClient); + + UpsertOAuthScopesRestrictionRequest body = + new UpsertOAuthScopesRestrictionRequest() + .data( + new UpsertOAuthScopesRestrictionData() + .attributes( + new UpsertOAuthScopesRestrictionDataAttributes() + .oidcScopes(Arrays.asList(OAuthOidcScope.OPENID, OAuthOidcScope.EMAIL)) + .permissionScopes(Arrays.asList("dashboards_read", "metrics_read"))) + .type(UpsertOAuthScopesRestrictionType.UPSERT_SCOPES_RESTRICTION)); + + try { + OAuthScopesRestrictionResponse result = + apiInstance.upsertScopesRestriction( + UUID.fromString("fafa8e1c-36a5-11f0-a83d-da7ad0900001"), body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling OAuth2ClientPublicApi#upsertScopesRestriction"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index c172f090b44..c56de03b269 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -953,7 +953,6 @@ public class ApiClient { put("v2.listCostTagKeySources", false); put("v2.listCostTagMetadata", false); put("v2.listCostTagMetadataMetrics", false); - put("v2.listCostTagMetadataMonths", false); put("v2.listCostTagMetadataOrchestrators", false); put("v2.searchCostRecommendations", false); put("v2.createDashboardSecureEmbed", false); @@ -1087,6 +1086,10 @@ public class ApiClient { put("v2.updateMonitorUserTemplate", false); put("v2.validateExistingMonitorUserTemplate", false); put("v2.validateMonitorUserTemplate", false); + put("v2.deleteScopesRestriction", false); + put("v2.getScopesRestriction", false); + put("v2.registerOAuthClient", false); + put("v2.upsertScopesRestriction", false); put("v2.bulkUpdateOrgGroupMemberships", false); put("v2.createOrgGroup", false); put("v2.createOrgGroupPolicy", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java b/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java index 940a2bbaac5..482720c505b 100644 --- a/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/CloudCostManagementApi.java @@ -42,7 +42,6 @@ import com.datadog.api.client.v2.model.CostTagKeySourcesResponse; import com.datadog.api.client.v2.model.CostTagKeysResponse; import com.datadog.api.client.v2.model.CostTagMetadataDailyFilter; -import com.datadog.api.client.v2.model.CostTagMetadataMonthsResponse; import com.datadog.api.client.v2.model.CostTagsResponse; import com.datadog.api.client.v2.model.CreateRulesetRequest; import com.datadog.api.client.v2.model.CustomCostsFileGetResponse; @@ -7920,185 +7919,6 @@ public ApiResponse listCostTagMetadataMetricsWithHttpInfo( new GenericType() {}); } - /** - * List Cloud Cost Management tag metadata months. - * - *

See {@link #listCostTagMetadataMonthsWithHttpInfo}. - * - * @param filterProvider Provider to scope the query to. Use the value of the providername - * tag in CCM (for example, aws, azure, gcp, - * Oracle, Confluent Cloud, Snowflake). For costs - * uploaded through the Custom Costs API, use custom. Values are case-sensitive. - * (required) - * @return CostTagMetadataMonthsResponse - * @throws ApiException if fails to make API call - */ - public CostTagMetadataMonthsResponse listCostTagMetadataMonths(String filterProvider) - throws ApiException { - return listCostTagMetadataMonthsWithHttpInfo(filterProvider).getData(); - } - - /** - * List Cloud Cost Management tag metadata months. - * - *

See {@link #listCostTagMetadataMonthsWithHttpInfoAsync}. - * - * @param filterProvider Provider to scope the query to. Use the value of the providername - * tag in CCM (for example, aws, azure, gcp, - * Oracle, Confluent Cloud, Snowflake). For costs - * uploaded through the Custom Costs API, use custom. Values are case-sensitive. - * (required) - * @return CompletableFuture<CostTagMetadataMonthsResponse> - */ - public CompletableFuture listCostTagMetadataMonthsAsync( - String filterProvider) { - return listCostTagMetadataMonthsWithHttpInfoAsync(filterProvider) - .thenApply( - response -> { - return response.getData(); - }); - } - - /** - * List months that have Cloud Cost Management tag metadata for a given provider, ordered - * most-recent first. The response is capped at 36 months. - * - * @param filterProvider Provider to scope the query to. Use the value of the providername - * tag in CCM (for example, aws, azure, gcp, - * Oracle, Confluent Cloud, Snowflake). For costs - * uploaded through the Custom Costs API, use custom. Values are case-sensitive. - * (required) - * @return ApiResponse<CostTagMetadataMonthsResponse> - * @throws ApiException if fails to make API call - * @http.response.details - * - * - * - * - * - * - * - *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
- */ - public ApiResponse listCostTagMetadataMonthsWithHttpInfo( - String filterProvider) throws ApiException { - // Check if unstable operation is enabled - String operationId = "listCostTagMetadataMonths"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); - } - Object localVarPostBody = null; - - // verify the required parameter 'filterProvider' is set - if (filterProvider == null) { - throw new ApiException( - 400, - "Missing the required parameter 'filterProvider' when calling listCostTagMetadataMonths"); - } - // create path and map variables - String localVarPath = "/api/v2/cost/tag_metadata/months"; - - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[provider]", filterProvider)); - - Invocation.Builder builder = - apiClient.createBuilder( - "v2.CloudCostManagementApi.listCostTagMetadataMonths", - localVarPath, - localVarQueryParams, - localVarHeaderParams, - new HashMap(), - new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); - return apiClient.invokeAPI( - "GET", - builder, - localVarHeaderParams, - new String[] {}, - localVarPostBody, - new HashMap(), - false, - new GenericType() {}); - } - - /** - * List Cloud Cost Management tag metadata months. - * - *

See {@link #listCostTagMetadataMonthsWithHttpInfo}. - * - * @param filterProvider Provider to scope the query to. Use the value of the providername - * tag in CCM (for example, aws, azure, gcp, - * Oracle, Confluent Cloud, Snowflake). For costs - * uploaded through the Custom Costs API, use custom. Values are case-sensitive. - * (required) - * @return CompletableFuture<ApiResponse<CostTagMetadataMonthsResponse>> - */ - public CompletableFuture> - listCostTagMetadataMonthsWithHttpInfoAsync(String filterProvider) { - // Check if unstable operation is enabled - String operationId = "listCostTagMetadataMonths"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - CompletableFuture> result = - new CompletableFuture<>(); - result.completeExceptionally( - new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); - return result; - } - Object localVarPostBody = null; - - // verify the required parameter 'filterProvider' is set - if (filterProvider == null) { - CompletableFuture> result = - new CompletableFuture<>(); - result.completeExceptionally( - new ApiException( - 400, - "Missing the required parameter 'filterProvider' when calling" - + " listCostTagMetadataMonths")); - return result; - } - // create path and map variables - String localVarPath = "/api/v2/cost/tag_metadata/months"; - - List localVarQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[provider]", filterProvider)); - - Invocation.Builder builder; - try { - builder = - apiClient.createBuilder( - "v2.CloudCostManagementApi.listCostTagMetadataMonths", - localVarPath, - localVarQueryParams, - localVarHeaderParams, - new HashMap(), - new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); - } catch (ApiException ex) { - CompletableFuture> result = - new CompletableFuture<>(); - result.completeExceptionally(ex); - return result; - } - return apiClient.invokeAPIAsync( - "GET", - builder, - localVarHeaderParams, - new String[] {}, - localVarPostBody, - new HashMap(), - false, - new GenericType() {}); - } - /** Manage optional parameters to listCostTagMetadataOrchestrators. */ public static class ListCostTagMetadataOrchestratorsOptionalParameters { private String filterProvider; diff --git a/src/main/java/com/datadog/api/client/v2/api/OAuth2ClientPublicApi.java b/src/main/java/com/datadog/api/client/v2/api/OAuth2ClientPublicApi.java new file mode 100644 index 00000000000..37c81a86c5c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/OAuth2ClientPublicApi.java @@ -0,0 +1,695 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.OAuthClientRegistrationRequest; +import com.datadog.api.client.v2.model.OAuthClientRegistrationResponse; +import com.datadog.api.client.v2.model.OAuthScopesRestrictionResponse; +import com.datadog.api.client.v2.model.UpsertOAuthScopesRestrictionRequest; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OAuth2ClientPublicApi { + private ApiClient apiClient; + + public OAuth2ClientPublicApi() { + this(ApiClient.getDefaultApiClient()); + } + + public OAuth2ClientPublicApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Delete an OAuth2 client scopes restriction. + * + *

See {@link #deleteScopesRestrictionWithHttpInfo}. + * + * @param clientUuid UUID of the OAuth2 client. (required) + * @throws ApiException if fails to make API call + */ + public void deleteScopesRestriction(UUID clientUuid) throws ApiException { + deleteScopesRestrictionWithHttpInfo(clientUuid); + } + + /** + * Delete an OAuth2 client scopes restriction. + * + *

See {@link #deleteScopesRestrictionWithHttpInfoAsync}. + * + * @param clientUuid UUID of the OAuth2 client. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteScopesRestrictionAsync(UUID clientUuid) { + return deleteScopesRestrictionWithHttpInfoAsync(clientUuid) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete the scopes restriction configured for the OAuth2 client. + * + * @param clientUuid UUID of the OAuth2 client. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteScopesRestrictionWithHttpInfo(UUID clientUuid) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteScopesRestriction"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'clientUuid' is set + if (clientUuid == null) { + throw new ApiException( + 400, "Missing the required parameter 'clientUuid' when calling deleteScopesRestriction"); + } + // create path and map variables + String localVarPath = + "/api/v2/oauth2/clients/{client_uuid}/scopes_restriction" + .replaceAll( + "\\{" + "client_uuid" + "\\}", apiClient.escapeString(clientUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OAuth2ClientPublicApi.deleteScopesRestriction", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete an OAuth2 client scopes restriction. + * + *

See {@link #deleteScopesRestrictionWithHttpInfo}. + * + * @param clientUuid UUID of the OAuth2 client. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteScopesRestrictionWithHttpInfoAsync( + UUID clientUuid) { + // Check if unstable operation is enabled + String operationId = "deleteScopesRestriction"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'clientUuid' is set + if (clientUuid == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'clientUuid' when calling deleteScopesRestriction")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/oauth2/clients/{client_uuid}/scopes_restriction" + .replaceAll( + "\\{" + "client_uuid" + "\\}", apiClient.escapeString(clientUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OAuth2ClientPublicApi.deleteScopesRestriction", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Get an OAuth2 client scopes restriction. + * + *

See {@link #getScopesRestrictionWithHttpInfo}. + * + * @param clientUuid UUID of the OAuth2 client. (required) + * @return OAuthScopesRestrictionResponse + * @throws ApiException if fails to make API call + */ + public OAuthScopesRestrictionResponse getScopesRestriction(UUID clientUuid) throws ApiException { + return getScopesRestrictionWithHttpInfo(clientUuid).getData(); + } + + /** + * Get an OAuth2 client scopes restriction. + * + *

See {@link #getScopesRestrictionWithHttpInfoAsync}. + * + * @param clientUuid UUID of the OAuth2 client. (required) + * @return CompletableFuture<OAuthScopesRestrictionResponse> + */ + public CompletableFuture getScopesRestrictionAsync( + UUID clientUuid) { + return getScopesRestrictionWithHttpInfoAsync(clientUuid) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get the scopes restriction configured for the OAuth2 client. + * + * @param clientUuid UUID of the OAuth2 client. (required) + * @return ApiResponse<OAuthScopesRestrictionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getScopesRestrictionWithHttpInfo( + UUID clientUuid) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getScopesRestriction"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'clientUuid' is set + if (clientUuid == null) { + throw new ApiException( + 400, "Missing the required parameter 'clientUuid' when calling getScopesRestriction"); + } + // create path and map variables + String localVarPath = + "/api/v2/oauth2/clients/{client_uuid}/scopes_restriction" + .replaceAll( + "\\{" + "client_uuid" + "\\}", apiClient.escapeString(clientUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OAuth2ClientPublicApi.getScopesRestriction", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get an OAuth2 client scopes restriction. + * + *

See {@link #getScopesRestrictionWithHttpInfo}. + * + * @param clientUuid UUID of the OAuth2 client. (required) + * @return CompletableFuture<ApiResponse<OAuthScopesRestrictionResponse>> + */ + public CompletableFuture> + getScopesRestrictionWithHttpInfoAsync(UUID clientUuid) { + // Check if unstable operation is enabled + String operationId = "getScopesRestriction"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'clientUuid' is set + if (clientUuid == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'clientUuid' when calling getScopesRestriction")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/oauth2/clients/{client_uuid}/scopes_restriction" + .replaceAll( + "\\{" + "client_uuid" + "\\}", apiClient.escapeString(clientUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OAuth2ClientPublicApi.getScopesRestriction", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Register an OAuth2 client. + * + *

See {@link #registerOAuthClientWithHttpInfo}. + * + * @param body (required) + * @return OAuthClientRegistrationResponse + * @throws ApiException if fails to make API call + */ + public OAuthClientRegistrationResponse registerOAuthClient(OAuthClientRegistrationRequest body) + throws ApiException { + return registerOAuthClientWithHttpInfo(body).getData(); + } + + /** + * Register an OAuth2 client. + * + *

See {@link #registerOAuthClientWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<OAuthClientRegistrationResponse> + */ + public CompletableFuture registerOAuthClientAsync( + OAuthClientRegistrationRequest body) { + return registerOAuthClientWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Register an OAuth2 client using the Dynamic Client Registration protocol defined in RFC 7591. + * + * @param body (required) + * @return ApiResponse<OAuthClientRegistrationResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
429 Too many requests -
+ */ + public ApiResponse registerOAuthClientWithHttpInfo( + OAuthClientRegistrationRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "registerOAuthClient"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling registerOAuthClient"); + } + // create path and map variables + String localVarPath = "/api/v2/oauth2/register"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OAuth2ClientPublicApi.registerOAuthClient", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Register an OAuth2 client. + * + *

See {@link #registerOAuthClientWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<OAuthClientRegistrationResponse>> + */ + public CompletableFuture> + registerOAuthClientWithHttpInfoAsync(OAuthClientRegistrationRequest body) { + // Check if unstable operation is enabled + String operationId = "registerOAuthClient"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling registerOAuthClient")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/oauth2/register"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OAuth2ClientPublicApi.registerOAuthClient", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Upsert an OAuth2 client scopes restriction. + * + *

See {@link #upsertScopesRestrictionWithHttpInfo}. + * + * @param clientUuid UUID of the OAuth2 client. (required) + * @param body (required) + * @return OAuthScopesRestrictionResponse + * @throws ApiException if fails to make API call + */ + public OAuthScopesRestrictionResponse upsertScopesRestriction( + UUID clientUuid, UpsertOAuthScopesRestrictionRequest body) throws ApiException { + return upsertScopesRestrictionWithHttpInfo(clientUuid, body).getData(); + } + + /** + * Upsert an OAuth2 client scopes restriction. + * + *

See {@link #upsertScopesRestrictionWithHttpInfoAsync}. + * + * @param clientUuid UUID of the OAuth2 client. (required) + * @param body (required) + * @return CompletableFuture<OAuthScopesRestrictionResponse> + */ + public CompletableFuture upsertScopesRestrictionAsync( + UUID clientUuid, UpsertOAuthScopesRestrictionRequest body) { + return upsertScopesRestrictionWithHttpInfoAsync(clientUuid, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create or update the scopes restriction configured for the OAuth2 client. + * + * @param clientUuid UUID of the OAuth2 client. (required) + * @param body (required) + * @return ApiResponse<OAuthScopesRestrictionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse upsertScopesRestrictionWithHttpInfo( + UUID clientUuid, UpsertOAuthScopesRestrictionRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "upsertScopesRestriction"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'clientUuid' is set + if (clientUuid == null) { + throw new ApiException( + 400, "Missing the required parameter 'clientUuid' when calling upsertScopesRestriction"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling upsertScopesRestriction"); + } + // create path and map variables + String localVarPath = + "/api/v2/oauth2/clients/{client_uuid}/scopes_restriction" + .replaceAll( + "\\{" + "client_uuid" + "\\}", apiClient.escapeString(clientUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OAuth2ClientPublicApi.upsertScopesRestriction", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Upsert an OAuth2 client scopes restriction. + * + *

See {@link #upsertScopesRestrictionWithHttpInfo}. + * + * @param clientUuid UUID of the OAuth2 client. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<OAuthScopesRestrictionResponse>> + */ + public CompletableFuture> + upsertScopesRestrictionWithHttpInfoAsync( + UUID clientUuid, UpsertOAuthScopesRestrictionRequest body) { + // Check if unstable operation is enabled + String operationId = "upsertScopesRestriction"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'clientUuid' is set + if (clientUuid == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'clientUuid' when calling upsertScopesRestriction")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling upsertScopesRestriction")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/oauth2/clients/{client_uuid}/scopes_restriction" + .replaceAll( + "\\{" + "client_uuid" + "\\}", apiClient.escapeString(clientUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OAuth2ClientPublicApi.upsertScopesRestriction", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationError.java b/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationError.java new file mode 100644 index 00000000000..f2c50db5d17 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationError.java @@ -0,0 +1,176 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Error payload returned by OAuth2 dynamic client registration as defined by RFC 7591. */ +@JsonPropertyOrder({ + OAuthClientRegistrationError.JSON_PROPERTY_ERROR, + OAuthClientRegistrationError.JSON_PROPERTY_ERROR_DESCRIPTION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OAuthClientRegistrationError { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ERROR = "error"; + private String error; + + public static final String JSON_PROPERTY_ERROR_DESCRIPTION = "error_description"; + private String errorDescription; + + public OAuthClientRegistrationError() {} + + @JsonCreator + public OAuthClientRegistrationError( + @JsonProperty(required = true, value = JSON_PROPERTY_ERROR) String error, + @JsonProperty(required = true, value = JSON_PROPERTY_ERROR_DESCRIPTION) + String errorDescription) { + this.error = error; + this.errorDescription = errorDescription; + } + + public OAuthClientRegistrationError error(String error) { + this.error = error; + return this; + } + + /** + * Single ASCII error code per RFC 7591, such as invalid_request or + * invalid_client_metadata. + * + * @return error + */ + @JsonProperty(JSON_PROPERTY_ERROR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getError() { + return error; + } + + public void setError(String error) { + this.error = error; + } + + public OAuthClientRegistrationError errorDescription(String errorDescription) { + this.errorDescription = errorDescription; + return this; + } + + /** + * Human-readable description of the error. + * + * @return errorDescription + */ + @JsonProperty(JSON_PROPERTY_ERROR_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getErrorDescription() { + return errorDescription; + } + + public void setErrorDescription(String errorDescription) { + this.errorDescription = errorDescription; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OAuthClientRegistrationError + */ + @JsonAnySetter + public OAuthClientRegistrationError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OAuthClientRegistrationError object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OAuthClientRegistrationError oAuthClientRegistrationError = (OAuthClientRegistrationError) o; + return Objects.equals(this.error, oAuthClientRegistrationError.error) + && Objects.equals(this.errorDescription, oAuthClientRegistrationError.errorDescription) + && Objects.equals( + this.additionalProperties, oAuthClientRegistrationError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(error, errorDescription, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OAuthClientRegistrationError {\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" errorDescription: ").append(toIndentedString(errorDescription)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationGrantType.java b/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationGrantType.java new file mode 100644 index 00000000000..2a29ed6a981 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationGrantType.java @@ -0,0 +1,60 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** OAuth 2.0 grant type that a registered client may use. */ +@JsonSerialize( + using = OAuthClientRegistrationGrantType.OAuthClientRegistrationGrantTypeSerializer.class) +public class OAuthClientRegistrationGrantType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("authorization_code", "refresh_token")); + + public static final OAuthClientRegistrationGrantType AUTHORIZATION_CODE = + new OAuthClientRegistrationGrantType("authorization_code"); + public static final OAuthClientRegistrationGrantType REFRESH_TOKEN = + new OAuthClientRegistrationGrantType("refresh_token"); + + OAuthClientRegistrationGrantType(String value) { + super(value, allowedValues); + } + + public static class OAuthClientRegistrationGrantTypeSerializer + extends StdSerializer { + public OAuthClientRegistrationGrantTypeSerializer(Class t) { + super(t); + } + + public OAuthClientRegistrationGrantTypeSerializer() { + this(null); + } + + @Override + public void serialize( + OAuthClientRegistrationGrantType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OAuthClientRegistrationGrantType fromValue(String value) { + return new OAuthClientRegistrationGrantType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationRequest.java b/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationRequest.java new file mode 100644 index 00000000000..f3930a72c81 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationRequest.java @@ -0,0 +1,465 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Request payload for OAuth2 dynamic client registration as defined by RFC 7591. */ +@JsonPropertyOrder({ + OAuthClientRegistrationRequest.JSON_PROPERTY_CLIENT_NAME, + OAuthClientRegistrationRequest.JSON_PROPERTY_CLIENT_URI, + OAuthClientRegistrationRequest.JSON_PROPERTY_GRANT_TYPES, + OAuthClientRegistrationRequest.JSON_PROPERTY_JWKS_URI, + OAuthClientRegistrationRequest.JSON_PROPERTY_LOGO_URI, + OAuthClientRegistrationRequest.JSON_PROPERTY_POLICY_URI, + OAuthClientRegistrationRequest.JSON_PROPERTY_REDIRECT_URIS, + OAuthClientRegistrationRequest.JSON_PROPERTY_RESPONSE_TYPES, + OAuthClientRegistrationRequest.JSON_PROPERTY_SCOPE, + OAuthClientRegistrationRequest.JSON_PROPERTY_TOKEN_ENDPOINT_AUTH_METHOD, + OAuthClientRegistrationRequest.JSON_PROPERTY_TOS_URI +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OAuthClientRegistrationRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CLIENT_NAME = "client_name"; + private String clientName; + + public static final String JSON_PROPERTY_CLIENT_URI = "client_uri"; + private String clientUri; + + public static final String JSON_PROPERTY_GRANT_TYPES = "grant_types"; + private List grantTypes = null; + + public static final String JSON_PROPERTY_JWKS_URI = "jwks_uri"; + private String jwksUri; + + public static final String JSON_PROPERTY_LOGO_URI = "logo_uri"; + private String logoUri; + + public static final String JSON_PROPERTY_POLICY_URI = "policy_uri"; + private String policyUri; + + public static final String JSON_PROPERTY_REDIRECT_URIS = "redirect_uris"; + private List redirectUris = new ArrayList<>(); + + public static final String JSON_PROPERTY_RESPONSE_TYPES = "response_types"; + private List responseTypes = null; + + public static final String JSON_PROPERTY_SCOPE = "scope"; + private String scope; + + public static final String JSON_PROPERTY_TOKEN_ENDPOINT_AUTH_METHOD = + "token_endpoint_auth_method"; + private String tokenEndpointAuthMethod; + + public static final String JSON_PROPERTY_TOS_URI = "tos_uri"; + private String tosUri; + + public OAuthClientRegistrationRequest() {} + + @JsonCreator + public OAuthClientRegistrationRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_CLIENT_NAME) String clientName, + @JsonProperty(required = true, value = JSON_PROPERTY_REDIRECT_URIS) + List redirectUris) { + this.clientName = clientName; + this.redirectUris = redirectUris; + } + + public OAuthClientRegistrationRequest clientName(String clientName) { + this.clientName = clientName; + return this; + } + + /** + * Human-readable name of the client. Control characters are rejected. + * + * @return clientName + */ + @JsonProperty(JSON_PROPERTY_CLIENT_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getClientName() { + return clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + + public OAuthClientRegistrationRequest clientUri(String clientUri) { + this.clientUri = clientUri; + return this; + } + + /** + * URL of the home page of the client. + * + * @return clientUri + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CLIENT_URI) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getClientUri() { + return clientUri; + } + + public void setClientUri(String clientUri) { + this.clientUri = clientUri; + } + + public OAuthClientRegistrationRequest grantTypes( + List grantTypes) { + this.grantTypes = grantTypes; + return this; + } + + public OAuthClientRegistrationRequest addGrantTypesItem( + OAuthClientRegistrationGrantType grantTypesItem) { + if (this.grantTypes == null) { + this.grantTypes = new ArrayList<>(); + } + this.grantTypes.add(grantTypesItem); + this.unparsed |= !grantTypesItem.isValid(); + return this; + } + + /** + * OAuth 2.0 grant types the client may use. Defaults to authorization_code and + * refresh_token when omitted. + * + * @return grantTypes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GRANT_TYPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getGrantTypes() { + return grantTypes; + } + + public void setGrantTypes(List grantTypes) { + this.grantTypes = grantTypes; + } + + public OAuthClientRegistrationRequest jwksUri(String jwksUri) { + this.jwksUri = jwksUri; + return this; + } + + /** + * URL referencing the client's JSON Web Key Set. + * + * @return jwksUri + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_JWKS_URI) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getJwksUri() { + return jwksUri; + } + + public void setJwksUri(String jwksUri) { + this.jwksUri = jwksUri; + } + + public OAuthClientRegistrationRequest logoUri(String logoUri) { + this.logoUri = logoUri; + return this; + } + + /** + * URL referencing a logo for the client. + * + * @return logoUri + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LOGO_URI) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLogoUri() { + return logoUri; + } + + public void setLogoUri(String logoUri) { + this.logoUri = logoUri; + } + + public OAuthClientRegistrationRequest policyUri(String policyUri) { + this.policyUri = policyUri; + return this; + } + + /** + * URL pointing to the client's privacy policy. + * + * @return policyUri + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_POLICY_URI) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPolicyUri() { + return policyUri; + } + + public void setPolicyUri(String policyUri) { + this.policyUri = policyUri; + } + + public OAuthClientRegistrationRequest redirectUris(List redirectUris) { + this.redirectUris = redirectUris; + return this; + } + + public OAuthClientRegistrationRequest addRedirectUrisItem(String redirectUrisItem) { + this.redirectUris.add(redirectUrisItem); + return this; + } + + /** + * Array of redirection URI strings used by the client in redirect-based flows. + * + * @return redirectUris + */ + @JsonProperty(JSON_PROPERTY_REDIRECT_URIS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRedirectUris() { + return redirectUris; + } + + public void setRedirectUris(List redirectUris) { + this.redirectUris = redirectUris; + } + + public OAuthClientRegistrationRequest responseTypes( + List responseTypes) { + this.responseTypes = responseTypes; + return this; + } + + public OAuthClientRegistrationRequest addResponseTypesItem( + OAuthClientRegistrationResponseType responseTypesItem) { + if (this.responseTypes == null) { + this.responseTypes = new ArrayList<>(); + } + this.responseTypes.add(responseTypesItem); + this.unparsed |= !responseTypesItem.isValid(); + return this; + } + + /** + * OAuth 2.0 response types the client may use. Only code is supported. + * + * @return responseTypes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESPONSE_TYPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getResponseTypes() { + return responseTypes; + } + + public void setResponseTypes(List responseTypes) { + this.responseTypes = responseTypes; + } + + public OAuthClientRegistrationRequest scope(String scope) { + this.scope = scope; + return this; + } + + /** + * Space-separated list of scope values the client may request. + * + * @return scope + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getScope() { + return scope; + } + + public void setScope(String scope) { + this.scope = scope; + } + + public OAuthClientRegistrationRequest tokenEndpointAuthMethod(String tokenEndpointAuthMethod) { + this.tokenEndpointAuthMethod = tokenEndpointAuthMethod; + return this; + } + + /** + * Requested authentication method for the token endpoint. Only none is supported. + * + * @return tokenEndpointAuthMethod + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOKEN_ENDPOINT_AUTH_METHOD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTokenEndpointAuthMethod() { + return tokenEndpointAuthMethod; + } + + public void setTokenEndpointAuthMethod(String tokenEndpointAuthMethod) { + this.tokenEndpointAuthMethod = tokenEndpointAuthMethod; + } + + public OAuthClientRegistrationRequest tosUri(String tosUri) { + this.tosUri = tosUri; + return this; + } + + /** + * URL pointing to the client's terms of service. + * + * @return tosUri + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOS_URI) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTosUri() { + return tosUri; + } + + public void setTosUri(String tosUri) { + this.tosUri = tosUri; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OAuthClientRegistrationRequest + */ + @JsonAnySetter + public OAuthClientRegistrationRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OAuthClientRegistrationRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OAuthClientRegistrationRequest oAuthClientRegistrationRequest = + (OAuthClientRegistrationRequest) o; + return Objects.equals(this.clientName, oAuthClientRegistrationRequest.clientName) + && Objects.equals(this.clientUri, oAuthClientRegistrationRequest.clientUri) + && Objects.equals(this.grantTypes, oAuthClientRegistrationRequest.grantTypes) + && Objects.equals(this.jwksUri, oAuthClientRegistrationRequest.jwksUri) + && Objects.equals(this.logoUri, oAuthClientRegistrationRequest.logoUri) + && Objects.equals(this.policyUri, oAuthClientRegistrationRequest.policyUri) + && Objects.equals(this.redirectUris, oAuthClientRegistrationRequest.redirectUris) + && Objects.equals(this.responseTypes, oAuthClientRegistrationRequest.responseTypes) + && Objects.equals(this.scope, oAuthClientRegistrationRequest.scope) + && Objects.equals( + this.tokenEndpointAuthMethod, oAuthClientRegistrationRequest.tokenEndpointAuthMethod) + && Objects.equals(this.tosUri, oAuthClientRegistrationRequest.tosUri) + && Objects.equals( + this.additionalProperties, oAuthClientRegistrationRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + clientName, + clientUri, + grantTypes, + jwksUri, + logoUri, + policyUri, + redirectUris, + responseTypes, + scope, + tokenEndpointAuthMethod, + tosUri, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OAuthClientRegistrationRequest {\n"); + sb.append(" clientName: ").append(toIndentedString(clientName)).append("\n"); + sb.append(" clientUri: ").append(toIndentedString(clientUri)).append("\n"); + sb.append(" grantTypes: ").append(toIndentedString(grantTypes)).append("\n"); + sb.append(" jwksUri: ").append(toIndentedString(jwksUri)).append("\n"); + sb.append(" logoUri: ").append(toIndentedString(logoUri)).append("\n"); + sb.append(" policyUri: ").append(toIndentedString(policyUri)).append("\n"); + sb.append(" redirectUris: ").append(toIndentedString(redirectUris)).append("\n"); + sb.append(" responseTypes: ").append(toIndentedString(responseTypes)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" tokenEndpointAuthMethod: ") + .append(toIndentedString(tokenEndpointAuthMethod)) + .append("\n"); + sb.append(" tosUri: ").append(toIndentedString(tosUri)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationResponse.java b/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationResponse.java new file mode 100644 index 00000000000..c94ae40ce70 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationResponse.java @@ -0,0 +1,325 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Response payload for a successful OAuth2 dynamic client registration as defined by RFC 7591. */ +@JsonPropertyOrder({ + OAuthClientRegistrationResponse.JSON_PROPERTY_CLIENT_ID, + OAuthClientRegistrationResponse.JSON_PROPERTY_CLIENT_NAME, + OAuthClientRegistrationResponse.JSON_PROPERTY_GRANT_TYPES, + OAuthClientRegistrationResponse.JSON_PROPERTY_REDIRECT_URIS, + OAuthClientRegistrationResponse.JSON_PROPERTY_RESPONSE_TYPES, + OAuthClientRegistrationResponse.JSON_PROPERTY_TOKEN_ENDPOINT_AUTH_METHOD +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OAuthClientRegistrationResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CLIENT_ID = "client_id"; + private UUID clientId; + + public static final String JSON_PROPERTY_CLIENT_NAME = "client_name"; + private String clientName; + + public static final String JSON_PROPERTY_GRANT_TYPES = "grant_types"; + private List grantTypes = new ArrayList<>(); + + public static final String JSON_PROPERTY_REDIRECT_URIS = "redirect_uris"; + private List redirectUris = new ArrayList<>(); + + public static final String JSON_PROPERTY_RESPONSE_TYPES = "response_types"; + private List responseTypes = new ArrayList<>(); + + public static final String JSON_PROPERTY_TOKEN_ENDPOINT_AUTH_METHOD = + "token_endpoint_auth_method"; + private String tokenEndpointAuthMethod; + + public OAuthClientRegistrationResponse() {} + + @JsonCreator + public OAuthClientRegistrationResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_CLIENT_ID) UUID clientId, + @JsonProperty(required = true, value = JSON_PROPERTY_CLIENT_NAME) String clientName, + @JsonProperty(required = true, value = JSON_PROPERTY_GRANT_TYPES) + List grantTypes, + @JsonProperty(required = true, value = JSON_PROPERTY_REDIRECT_URIS) List redirectUris, + @JsonProperty(required = true, value = JSON_PROPERTY_RESPONSE_TYPES) + List responseTypes, + @JsonProperty(required = true, value = JSON_PROPERTY_TOKEN_ENDPOINT_AUTH_METHOD) + String tokenEndpointAuthMethod) { + this.clientId = clientId; + this.clientName = clientName; + this.grantTypes = grantTypes; + this.redirectUris = redirectUris; + this.responseTypes = responseTypes; + this.tokenEndpointAuthMethod = tokenEndpointAuthMethod; + } + + public OAuthClientRegistrationResponse clientId(UUID clientId) { + this.clientId = clientId; + return this; + } + + /** + * Unique identifier assigned to the registered client. + * + * @return clientId + */ + @JsonProperty(JSON_PROPERTY_CLIENT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getClientId() { + return clientId; + } + + public void setClientId(UUID clientId) { + this.clientId = clientId; + } + + public OAuthClientRegistrationResponse clientName(String clientName) { + this.clientName = clientName; + return this; + } + + /** + * Human-readable name of the client. + * + * @return clientName + */ + @JsonProperty(JSON_PROPERTY_CLIENT_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getClientName() { + return clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + + public OAuthClientRegistrationResponse grantTypes( + List grantTypes) { + this.grantTypes = grantTypes; + return this; + } + + public OAuthClientRegistrationResponse addGrantTypesItem( + OAuthClientRegistrationGrantType grantTypesItem) { + this.grantTypes.add(grantTypesItem); + this.unparsed |= !grantTypesItem.isValid(); + return this; + } + + /** + * OAuth 2.0 grant types registered for the client. + * + * @return grantTypes + */ + @JsonProperty(JSON_PROPERTY_GRANT_TYPES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getGrantTypes() { + return grantTypes; + } + + public void setGrantTypes(List grantTypes) { + this.grantTypes = grantTypes; + } + + public OAuthClientRegistrationResponse redirectUris(List redirectUris) { + this.redirectUris = redirectUris; + return this; + } + + public OAuthClientRegistrationResponse addRedirectUrisItem(String redirectUrisItem) { + this.redirectUris.add(redirectUrisItem); + return this; + } + + /** + * Redirection URIs registered for the client. + * + * @return redirectUris + */ + @JsonProperty(JSON_PROPERTY_REDIRECT_URIS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRedirectUris() { + return redirectUris; + } + + public void setRedirectUris(List redirectUris) { + this.redirectUris = redirectUris; + } + + public OAuthClientRegistrationResponse responseTypes( + List responseTypes) { + this.responseTypes = responseTypes; + return this; + } + + public OAuthClientRegistrationResponse addResponseTypesItem( + OAuthClientRegistrationResponseType responseTypesItem) { + this.responseTypes.add(responseTypesItem); + this.unparsed |= !responseTypesItem.isValid(); + return this; + } + + /** + * OAuth 2.0 response types registered for the client. + * + * @return responseTypes + */ + @JsonProperty(JSON_PROPERTY_RESPONSE_TYPES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getResponseTypes() { + return responseTypes; + } + + public void setResponseTypes(List responseTypes) { + this.responseTypes = responseTypes; + } + + public OAuthClientRegistrationResponse tokenEndpointAuthMethod(String tokenEndpointAuthMethod) { + this.tokenEndpointAuthMethod = tokenEndpointAuthMethod; + return this; + } + + /** + * Authentication method registered for the token endpoint. Always none. + * + * @return tokenEndpointAuthMethod + */ + @JsonProperty(JSON_PROPERTY_TOKEN_ENDPOINT_AUTH_METHOD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTokenEndpointAuthMethod() { + return tokenEndpointAuthMethod; + } + + public void setTokenEndpointAuthMethod(String tokenEndpointAuthMethod) { + this.tokenEndpointAuthMethod = tokenEndpointAuthMethod; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OAuthClientRegistrationResponse + */ + @JsonAnySetter + public OAuthClientRegistrationResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OAuthClientRegistrationResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OAuthClientRegistrationResponse oAuthClientRegistrationResponse = + (OAuthClientRegistrationResponse) o; + return Objects.equals(this.clientId, oAuthClientRegistrationResponse.clientId) + && Objects.equals(this.clientName, oAuthClientRegistrationResponse.clientName) + && Objects.equals(this.grantTypes, oAuthClientRegistrationResponse.grantTypes) + && Objects.equals(this.redirectUris, oAuthClientRegistrationResponse.redirectUris) + && Objects.equals(this.responseTypes, oAuthClientRegistrationResponse.responseTypes) + && Objects.equals( + this.tokenEndpointAuthMethod, oAuthClientRegistrationResponse.tokenEndpointAuthMethod) + && Objects.equals( + this.additionalProperties, oAuthClientRegistrationResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + clientId, + clientName, + grantTypes, + redirectUris, + responseTypes, + tokenEndpointAuthMethod, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OAuthClientRegistrationResponse {\n"); + sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n"); + sb.append(" clientName: ").append(toIndentedString(clientName)).append("\n"); + sb.append(" grantTypes: ").append(toIndentedString(grantTypes)).append("\n"); + sb.append(" redirectUris: ").append(toIndentedString(redirectUris)).append("\n"); + sb.append(" responseTypes: ").append(toIndentedString(responseTypes)).append("\n"); + sb.append(" tokenEndpointAuthMethod: ") + .append(toIndentedString(tokenEndpointAuthMethod)) + .append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationResponseType.java b/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationResponseType.java new file mode 100644 index 00000000000..88dcd37fa6a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OAuthClientRegistrationResponseType.java @@ -0,0 +1,58 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** OAuth 2.0 response type that a registered client may use. */ +@JsonSerialize( + using = OAuthClientRegistrationResponseType.OAuthClientRegistrationResponseTypeSerializer.class) +public class OAuthClientRegistrationResponseType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("code")); + + public static final OAuthClientRegistrationResponseType CODE = + new OAuthClientRegistrationResponseType("code"); + + OAuthClientRegistrationResponseType(String value) { + super(value, allowedValues); + } + + public static class OAuthClientRegistrationResponseTypeSerializer + extends StdSerializer { + public OAuthClientRegistrationResponseTypeSerializer( + Class t) { + super(t); + } + + public OAuthClientRegistrationResponseTypeSerializer() { + this(null); + } + + @Override + public void serialize( + OAuthClientRegistrationResponseType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OAuthClientRegistrationResponseType fromValue(String value) { + return new OAuthClientRegistrationResponseType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OAuthOidcScope.java b/src/main/java/com/datadog/api/client/v2/model/OAuthOidcScope.java new file mode 100644 index 00000000000..b6e806250ed --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OAuthOidcScope.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** OIDC scope a client may be restricted to. */ +@JsonSerialize(using = OAuthOidcScope.OAuthOidcScopeSerializer.class) +public class OAuthOidcScope extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("openid", "profile", "email", "offline_access")); + + public static final OAuthOidcScope OPENID = new OAuthOidcScope("openid"); + public static final OAuthOidcScope PROFILE = new OAuthOidcScope("profile"); + public static final OAuthOidcScope EMAIL = new OAuthOidcScope("email"); + public static final OAuthOidcScope OFFLINE_ACCESS = new OAuthOidcScope("offline_access"); + + OAuthOidcScope(String value) { + super(value, allowedValues); + } + + public static class OAuthOidcScopeSerializer extends StdSerializer { + public OAuthOidcScopeSerializer(Class t) { + super(t); + } + + public OAuthOidcScopeSerializer() { + this(null); + } + + @Override + public void serialize(OAuthOidcScope value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static OAuthOidcScope fromValue(String value) { + return new OAuthOidcScope(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestriction.java b/src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestriction.java new file mode 100644 index 00000000000..6aba1109382 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestriction.java @@ -0,0 +1,188 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Allowlist of OIDC and permission scopes enforced for the OAuth2 client. */ +@JsonPropertyOrder({ + OAuthScopesRestriction.JSON_PROPERTY_OIDC_SCOPES, + OAuthScopesRestriction.JSON_PROPERTY_PERMISSION_SCOPES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OAuthScopesRestriction { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_OIDC_SCOPES = "oidc_scopes"; + private List oidcScopes = new ArrayList<>(); + + public static final String JSON_PROPERTY_PERMISSION_SCOPES = "permission_scopes"; + private List permissionScopes = new ArrayList<>(); + + public OAuthScopesRestriction() {} + + @JsonCreator + public OAuthScopesRestriction( + @JsonProperty(required = true, value = JSON_PROPERTY_OIDC_SCOPES) + List oidcScopes, + @JsonProperty(required = true, value = JSON_PROPERTY_PERMISSION_SCOPES) + List permissionScopes) { + this.oidcScopes = oidcScopes; + this.permissionScopes = permissionScopes; + } + + public OAuthScopesRestriction oidcScopes(List oidcScopes) { + this.oidcScopes = oidcScopes; + return this; + } + + public OAuthScopesRestriction addOidcScopesItem(OAuthOidcScope oidcScopesItem) { + this.oidcScopes.add(oidcScopesItem); + this.unparsed |= !oidcScopesItem.isValid(); + return this; + } + + /** + * OIDC scopes the client is restricted to. + * + * @return oidcScopes + */ + @JsonProperty(JSON_PROPERTY_OIDC_SCOPES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getOidcScopes() { + return oidcScopes; + } + + public void setOidcScopes(List oidcScopes) { + this.oidcScopes = oidcScopes; + } + + public OAuthScopesRestriction permissionScopes(List permissionScopes) { + this.permissionScopes = permissionScopes; + return this; + } + + public OAuthScopesRestriction addPermissionScopesItem(String permissionScopesItem) { + this.permissionScopes.add(permissionScopesItem); + return this; + } + + /** + * Datadog permission scopes the client is restricted to. + * + * @return permissionScopes + */ + @JsonProperty(JSON_PROPERTY_PERMISSION_SCOPES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getPermissionScopes() { + return permissionScopes; + } + + public void setPermissionScopes(List permissionScopes) { + this.permissionScopes = permissionScopes; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OAuthScopesRestriction + */ + @JsonAnySetter + public OAuthScopesRestriction putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OAuthScopesRestriction object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OAuthScopesRestriction oAuthScopesRestriction = (OAuthScopesRestriction) o; + return Objects.equals(this.oidcScopes, oAuthScopesRestriction.oidcScopes) + && Objects.equals(this.permissionScopes, oAuthScopesRestriction.permissionScopes) + && Objects.equals(this.additionalProperties, oAuthScopesRestriction.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(oidcScopes, permissionScopes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OAuthScopesRestriction {\n"); + sb.append(" oidcScopes: ").append(toIndentedString(oidcScopes)).append("\n"); + sb.append(" permissionScopes: ").append(toIndentedString(permissionScopes)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CostTagMetadataMonthsResponse.java b/src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestrictionResponse.java similarity index 69% rename from src/main/java/com/datadog/api/client/v2/model/CostTagMetadataMonthsResponse.java rename to src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestrictionResponse.java index e42a485bcee..db5c5756cd6 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CostTagMetadataMonthsResponse.java +++ b/src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestrictionResponse.java @@ -13,58 +13,47 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Objects; -/** - * List of months that have Cloud Cost Management tag metadata for the requested provider, ordered - * most-recent first and capped at 36 months. - */ -@JsonPropertyOrder({CostTagMetadataMonthsResponse.JSON_PROPERTY_DATA}) +/** Response payload describing the scopes restriction of an OAuth2 client. */ +@JsonPropertyOrder({OAuthScopesRestrictionResponse.JSON_PROPERTY_DATA}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class CostTagMetadataMonthsResponse { +public class OAuthScopesRestrictionResponse { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_DATA = "data"; - private List data = new ArrayList<>(); + private OAuthScopesRestrictionResponseData data; - public CostTagMetadataMonthsResponse() {} + public OAuthScopesRestrictionResponse() {} @JsonCreator - public CostTagMetadataMonthsResponse( - @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + public OAuthScopesRestrictionResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + OAuthScopesRestrictionResponseData data) { this.data = data; + this.unparsed |= data.unparsed; } - public CostTagMetadataMonthsResponse data(List data) { + public OAuthScopesRestrictionResponse data(OAuthScopesRestrictionResponseData data) { this.data = data; - for (CostTagMetadataMonth item : data) { - this.unparsed |= item.unparsed; - } - return this; - } - - public CostTagMetadataMonthsResponse addDataItem(CostTagMetadataMonth dataItem) { - this.data.add(dataItem); - this.unparsed |= dataItem.unparsed; + this.unparsed |= data.unparsed; return this; } /** - * List of months that have tag metadata available. + * Data object of an OAuth2 client scopes restriction response. * * @return data */ @JsonProperty(JSON_PROPERTY_DATA) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getData() { + public OAuthScopesRestrictionResponseData getData() { return data; } - public void setData(List data) { + public void setData(OAuthScopesRestrictionResponseData data) { this.data = data; } @@ -80,10 +69,10 @@ public void setData(List data) { * * @param key The arbitrary key to set * @param value The associated value - * @return CostTagMetadataMonthsResponse + * @return OAuthScopesRestrictionResponse */ @JsonAnySetter - public CostTagMetadataMonthsResponse putAdditionalProperty(String key, Object value) { + public OAuthScopesRestrictionResponse putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -114,7 +103,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this CostTagMetadataMonthsResponse object is equal to o. */ + /** Return true if this OAuthScopesRestrictionResponse object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -123,10 +112,11 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - CostTagMetadataMonthsResponse costTagMetadataMonthsResponse = (CostTagMetadataMonthsResponse) o; - return Objects.equals(this.data, costTagMetadataMonthsResponse.data) + OAuthScopesRestrictionResponse oAuthScopesRestrictionResponse = + (OAuthScopesRestrictionResponse) o; + return Objects.equals(this.data, oAuthScopesRestrictionResponse.data) && Objects.equals( - this.additionalProperties, costTagMetadataMonthsResponse.additionalProperties); + this.additionalProperties, oAuthScopesRestrictionResponse.additionalProperties); } @Override @@ -137,7 +127,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class CostTagMetadataMonthsResponse {\n"); + sb.append("class OAuthScopesRestrictionResponse {\n"); sb.append(" data: ").append(toIndentedString(data)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestrictionResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestrictionResponseAttributes.java new file mode 100644 index 00000000000..19e3469cce1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestrictionResponseAttributes.java @@ -0,0 +1,204 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes of an OAuth2 client scopes restriction. */ +@JsonPropertyOrder({ + OAuthScopesRestrictionResponseAttributes.JSON_PROPERTY_REQUIRED_PERMISSION_SCOPES, + OAuthScopesRestrictionResponseAttributes.JSON_PROPERTY_SCOPES_RESTRICTION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OAuthScopesRestrictionResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_REQUIRED_PERMISSION_SCOPES = + "required_permission_scopes"; + private List requiredPermissionScopes = new ArrayList<>(); + + public static final String JSON_PROPERTY_SCOPES_RESTRICTION = "scopes_restriction"; + private OAuthScopesRestriction scopesRestriction; + + public OAuthScopesRestrictionResponseAttributes() {} + + @JsonCreator + public OAuthScopesRestrictionResponseAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_REQUIRED_PERMISSION_SCOPES) + List requiredPermissionScopes, + @JsonProperty(required = true, value = JSON_PROPERTY_SCOPES_RESTRICTION) + OAuthScopesRestriction scopesRestriction) { + this.requiredPermissionScopes = requiredPermissionScopes; + if (requiredPermissionScopes != null) {} + this.scopesRestriction = scopesRestriction; + if (scopesRestriction != null) { + this.unparsed |= scopesRestriction.unparsed; + } + } + + public OAuthScopesRestrictionResponseAttributes requiredPermissionScopes( + List requiredPermissionScopes) { + this.requiredPermissionScopes = requiredPermissionScopes; + return this; + } + + public OAuthScopesRestrictionResponseAttributes addRequiredPermissionScopesItem( + String requiredPermissionScopesItem) { + this.requiredPermissionScopes.add(requiredPermissionScopesItem); + return this; + } + + /** + * Permission scopes automatically required for this client (for example, mobile-app permission + * scopes). Returns null when no scopes are required. + * + * @return requiredPermissionScopes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REQUIRED_PERMISSION_SCOPES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRequiredPermissionScopes() { + return requiredPermissionScopes; + } + + public void setRequiredPermissionScopes(List requiredPermissionScopes) { + this.requiredPermissionScopes = requiredPermissionScopes; + } + + public OAuthScopesRestrictionResponseAttributes scopesRestriction( + OAuthScopesRestriction scopesRestriction) { + this.scopesRestriction = scopesRestriction; + if (scopesRestriction != null) { + this.unparsed |= scopesRestriction.unparsed; + } + return this; + } + + /** + * Allowlist of OIDC and permission scopes enforced for the OAuth2 client. + * + * @return scopesRestriction + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCOPES_RESTRICTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OAuthScopesRestriction getScopesRestriction() { + return scopesRestriction; + } + + public void setScopesRestriction(OAuthScopesRestriction scopesRestriction) { + this.scopesRestriction = scopesRestriction; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OAuthScopesRestrictionResponseAttributes + */ + @JsonAnySetter + public OAuthScopesRestrictionResponseAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OAuthScopesRestrictionResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OAuthScopesRestrictionResponseAttributes oAuthScopesRestrictionResponseAttributes = + (OAuthScopesRestrictionResponseAttributes) o; + return Objects.equals( + this.requiredPermissionScopes, + oAuthScopesRestrictionResponseAttributes.requiredPermissionScopes) + && Objects.equals( + this.scopesRestriction, oAuthScopesRestrictionResponseAttributes.scopesRestriction) + && Objects.equals( + this.additionalProperties, + oAuthScopesRestrictionResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(requiredPermissionScopes, scopesRestriction, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OAuthScopesRestrictionResponseAttributes {\n"); + sb.append(" requiredPermissionScopes: ") + .append(toIndentedString(requiredPermissionScopes)) + .append("\n"); + sb.append(" scopesRestriction: ").append(toIndentedString(scopesRestriction)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestrictionResponseData.java b/src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestrictionResponseData.java new file mode 100644 index 00000000000..a9b84072a20 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestrictionResponseData.java @@ -0,0 +1,213 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Data object of an OAuth2 client scopes restriction response. */ +@JsonPropertyOrder({ + OAuthScopesRestrictionResponseData.JSON_PROPERTY_ATTRIBUTES, + OAuthScopesRestrictionResponseData.JSON_PROPERTY_ID, + OAuthScopesRestrictionResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OAuthScopesRestrictionResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private OAuthScopesRestrictionResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private OAuthScopesRestrictionType type = OAuthScopesRestrictionType.SCOPES_RESTRICTION; + + public OAuthScopesRestrictionResponseData() {} + + @JsonCreator + public OAuthScopesRestrictionResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + OAuthScopesRestrictionResponseAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) OAuthScopesRestrictionType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public OAuthScopesRestrictionResponseData attributes( + OAuthScopesRestrictionResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of an OAuth2 client scopes restriction. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OAuthScopesRestrictionResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(OAuthScopesRestrictionResponseAttributes attributes) { + this.attributes = attributes; + } + + public OAuthScopesRestrictionResponseData id(UUID id) { + this.id = id; + return this; + } + + /** + * UUID of the OAuth2 client this restriction applies to. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public OAuthScopesRestrictionResponseData type(OAuthScopesRestrictionType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * JSON:API resource type for an OAuth2 client scopes restriction. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OAuthScopesRestrictionType getType() { + return type; + } + + public void setType(OAuthScopesRestrictionType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OAuthScopesRestrictionResponseData + */ + @JsonAnySetter + public OAuthScopesRestrictionResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OAuthScopesRestrictionResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OAuthScopesRestrictionResponseData oAuthScopesRestrictionResponseData = + (OAuthScopesRestrictionResponseData) o; + return Objects.equals(this.attributes, oAuthScopesRestrictionResponseData.attributes) + && Objects.equals(this.id, oAuthScopesRestrictionResponseData.id) + && Objects.equals(this.type, oAuthScopesRestrictionResponseData.type) + && Objects.equals( + this.additionalProperties, oAuthScopesRestrictionResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OAuthScopesRestrictionResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CostTagMetadataMonthType.java b/src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestrictionType.java similarity index 53% rename from src/main/java/com/datadog/api/client/v2/model/CostTagMetadataMonthType.java rename to src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestrictionType.java index 94cd58a5cf0..508de8c3c98 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CostTagMetadataMonthType.java +++ b/src/main/java/com/datadog/api/client/v2/model/OAuthScopesRestrictionType.java @@ -18,40 +18,40 @@ import java.util.HashSet; import java.util.Set; -/** Type of the Cloud Cost Management tag metadata month resource. */ -@JsonSerialize(using = CostTagMetadataMonthType.CostTagMetadataMonthTypeSerializer.class) -public class CostTagMetadataMonthType extends ModelEnum { +/** JSON:API resource type for an OAuth2 client scopes restriction. */ +@JsonSerialize(using = OAuthScopesRestrictionType.OAuthScopesRestrictionTypeSerializer.class) +public class OAuthScopesRestrictionType extends ModelEnum { private static final Set allowedValues = - new HashSet(Arrays.asList("cost_tag_metadata_month")); + new HashSet(Arrays.asList("scopes_restriction")); - public static final CostTagMetadataMonthType COST_TAG_METADATA_MONTH = - new CostTagMetadataMonthType("cost_tag_metadata_month"); + public static final OAuthScopesRestrictionType SCOPES_RESTRICTION = + new OAuthScopesRestrictionType("scopes_restriction"); - CostTagMetadataMonthType(String value) { + OAuthScopesRestrictionType(String value) { super(value, allowedValues); } - public static class CostTagMetadataMonthTypeSerializer - extends StdSerializer { - public CostTagMetadataMonthTypeSerializer(Class t) { + public static class OAuthScopesRestrictionTypeSerializer + extends StdSerializer { + public OAuthScopesRestrictionTypeSerializer(Class t) { super(t); } - public CostTagMetadataMonthTypeSerializer() { + public OAuthScopesRestrictionTypeSerializer() { this(null); } @Override public void serialize( - CostTagMetadataMonthType value, JsonGenerator jgen, SerializerProvider provider) + OAuthScopesRestrictionType value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeObject(value.value); } } @JsonCreator - public static CostTagMetadataMonthType fromValue(String value) { - return new CostTagMetadataMonthType(value); + public static OAuthScopesRestrictionType fromValue(String value) { + return new OAuthScopesRestrictionType(value); } } diff --git a/src/main/java/com/datadog/api/client/v2/model/CostTagMetadataMonth.java b/src/main/java/com/datadog/api/client/v2/model/UpsertOAuthScopesRestrictionData.java similarity index 59% rename from src/main/java/com/datadog/api/client/v2/model/CostTagMetadataMonth.java rename to src/main/java/com/datadog/api/client/v2/model/UpsertOAuthScopesRestrictionData.java index 59b82384051..e776f317ec0 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CostTagMetadataMonth.java +++ b/src/main/java/com/datadog/api/client/v2/model/UpsertOAuthScopesRestrictionData.java @@ -17,67 +17,73 @@ import java.util.Map; import java.util.Objects; -/** A month that has Cloud Cost Management tag metadata available for a given provider. */ -@JsonPropertyOrder({CostTagMetadataMonth.JSON_PROPERTY_ID, CostTagMetadataMonth.JSON_PROPERTY_TYPE}) +/** Data object of an upsert OAuth2 scopes restriction request. */ +@JsonPropertyOrder({ + UpsertOAuthScopesRestrictionData.JSON_PROPERTY_ATTRIBUTES, + UpsertOAuthScopesRestrictionData.JSON_PROPERTY_TYPE +}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class CostTagMetadataMonth { +public class UpsertOAuthScopesRestrictionData { @JsonIgnore public boolean unparsed = false; - public static final String JSON_PROPERTY_ID = "id"; - private String id; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UpsertOAuthScopesRestrictionDataAttributes attributes; public static final String JSON_PROPERTY_TYPE = "type"; - private CostTagMetadataMonthType type = CostTagMetadataMonthType.COST_TAG_METADATA_MONTH; + private UpsertOAuthScopesRestrictionType type = + UpsertOAuthScopesRestrictionType.UPSERT_SCOPES_RESTRICTION; - public CostTagMetadataMonth() {} + public UpsertOAuthScopesRestrictionData() {} @JsonCreator - public CostTagMetadataMonth( - @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, - @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CostTagMetadataMonthType type) { - this.id = id; + public UpsertOAuthScopesRestrictionData( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + UpsertOAuthScopesRestrictionType type) { this.type = type; this.unparsed |= !type.isValid(); } - public CostTagMetadataMonth id(String id) { - this.id = id; + public UpsertOAuthScopesRestrictionData attributes( + UpsertOAuthScopesRestrictionDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; return this; } /** - * The month, in YYYY-MM format. + * Attributes of an upsert OAuth2 scopes restriction request. * - * @return id + * @return attributes */ - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getId() { - return id; + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UpsertOAuthScopesRestrictionDataAttributes getAttributes() { + return attributes; } - public void setId(String id) { - this.id = id; + public void setAttributes(UpsertOAuthScopesRestrictionDataAttributes attributes) { + this.attributes = attributes; } - public CostTagMetadataMonth type(CostTagMetadataMonthType type) { + public UpsertOAuthScopesRestrictionData type(UpsertOAuthScopesRestrictionType type) { this.type = type; this.unparsed |= !type.isValid(); return this; } /** - * Type of the Cloud Cost Management tag metadata month resource. + * JSON:API resource type for an upsert OAuth2 client scopes restriction request. * * @return type */ @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public CostTagMetadataMonthType getType() { + public UpsertOAuthScopesRestrictionType getType() { return type; } - public void setType(CostTagMetadataMonthType type) { + public void setType(UpsertOAuthScopesRestrictionType type) { if (!type.isValid()) { this.unparsed = true; } @@ -96,10 +102,10 @@ public void setType(CostTagMetadataMonthType type) { * * @param key The arbitrary key to set * @param value The associated value - * @return CostTagMetadataMonth + * @return UpsertOAuthScopesRestrictionData */ @JsonAnySetter - public CostTagMetadataMonth putAdditionalProperty(String key, Object value) { + public UpsertOAuthScopesRestrictionData putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -130,7 +136,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this CostTagMetadataMonth object is equal to o. */ + /** Return true if this UpsertOAuthScopesRestrictionData object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -139,22 +145,24 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - CostTagMetadataMonth costTagMetadataMonth = (CostTagMetadataMonth) o; - return Objects.equals(this.id, costTagMetadataMonth.id) - && Objects.equals(this.type, costTagMetadataMonth.type) - && Objects.equals(this.additionalProperties, costTagMetadataMonth.additionalProperties); + UpsertOAuthScopesRestrictionData upsertOAuthScopesRestrictionData = + (UpsertOAuthScopesRestrictionData) o; + return Objects.equals(this.attributes, upsertOAuthScopesRestrictionData.attributes) + && Objects.equals(this.type, upsertOAuthScopesRestrictionData.type) + && Objects.equals( + this.additionalProperties, upsertOAuthScopesRestrictionData.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, type, additionalProperties); + return Objects.hash(attributes, type, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class CostTagMetadataMonth {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("class UpsertOAuthScopesRestrictionData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/UpsertOAuthScopesRestrictionDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/UpsertOAuthScopesRestrictionDataAttributes.java new file mode 100644 index 00000000000..fe96f0090b6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpsertOAuthScopesRestrictionDataAttributes.java @@ -0,0 +1,192 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes of an upsert OAuth2 scopes restriction request. */ +@JsonPropertyOrder({ + UpsertOAuthScopesRestrictionDataAttributes.JSON_PROPERTY_OIDC_SCOPES, + UpsertOAuthScopesRestrictionDataAttributes.JSON_PROPERTY_PERMISSION_SCOPES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpsertOAuthScopesRestrictionDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_OIDC_SCOPES = "oidc_scopes"; + private List oidcScopes = null; + + public static final String JSON_PROPERTY_PERMISSION_SCOPES = "permission_scopes"; + private List permissionScopes = null; + + public UpsertOAuthScopesRestrictionDataAttributes oidcScopes(List oidcScopes) { + this.oidcScopes = oidcScopes; + return this; + } + + public UpsertOAuthScopesRestrictionDataAttributes addOidcScopesItem( + OAuthOidcScope oidcScopesItem) { + if (this.oidcScopes == null) { + this.oidcScopes = new ArrayList<>(); + } + this.oidcScopes.add(oidcScopesItem); + this.unparsed |= !oidcScopesItem.isValid(); + return this; + } + + /** + * OIDC scopes the client is allowed to request. + * + * @return oidcScopes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OIDC_SCOPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getOidcScopes() { + return oidcScopes; + } + + public void setOidcScopes(List oidcScopes) { + this.oidcScopes = oidcScopes; + } + + public UpsertOAuthScopesRestrictionDataAttributes permissionScopes( + List permissionScopes) { + this.permissionScopes = permissionScopes; + return this; + } + + public UpsertOAuthScopesRestrictionDataAttributes addPermissionScopesItem( + String permissionScopesItem) { + if (this.permissionScopes == null) { + this.permissionScopes = new ArrayList<>(); + } + this.permissionScopes.add(permissionScopesItem); + return this; + } + + /** + * Datadog permission scopes the client is allowed to request. Each value must be a valid + * permission name. + * + * @return permissionScopes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PERMISSION_SCOPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getPermissionScopes() { + return permissionScopes; + } + + public void setPermissionScopes(List permissionScopes) { + this.permissionScopes = permissionScopes; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return UpsertOAuthScopesRestrictionDataAttributes + */ + @JsonAnySetter + public UpsertOAuthScopesRestrictionDataAttributes putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this UpsertOAuthScopesRestrictionDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpsertOAuthScopesRestrictionDataAttributes upsertOAuthScopesRestrictionDataAttributes = + (UpsertOAuthScopesRestrictionDataAttributes) o; + return Objects.equals(this.oidcScopes, upsertOAuthScopesRestrictionDataAttributes.oidcScopes) + && Objects.equals( + this.permissionScopes, upsertOAuthScopesRestrictionDataAttributes.permissionScopes) + && Objects.equals( + this.additionalProperties, + upsertOAuthScopesRestrictionDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(oidcScopes, permissionScopes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpsertOAuthScopesRestrictionDataAttributes {\n"); + sb.append(" oidcScopes: ").append(toIndentedString(oidcScopes)).append("\n"); + sb.append(" permissionScopes: ").append(toIndentedString(permissionScopes)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpsertOAuthScopesRestrictionRequest.java b/src/main/java/com/datadog/api/client/v2/model/UpsertOAuthScopesRestrictionRequest.java new file mode 100644 index 00000000000..0708a864f4f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpsertOAuthScopesRestrictionRequest.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request payload for creating or updating the scopes restriction of an OAuth2 client. */ +@JsonPropertyOrder({UpsertOAuthScopesRestrictionRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpsertOAuthScopesRestrictionRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private UpsertOAuthScopesRestrictionData data; + + public UpsertOAuthScopesRestrictionRequest() {} + + @JsonCreator + public UpsertOAuthScopesRestrictionRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + UpsertOAuthScopesRestrictionData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public UpsertOAuthScopesRestrictionRequest data(UpsertOAuthScopesRestrictionData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data object of an upsert OAuth2 scopes restriction request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UpsertOAuthScopesRestrictionData getData() { + return data; + } + + public void setData(UpsertOAuthScopesRestrictionData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return UpsertOAuthScopesRestrictionRequest + */ + @JsonAnySetter + public UpsertOAuthScopesRestrictionRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this UpsertOAuthScopesRestrictionRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpsertOAuthScopesRestrictionRequest upsertOAuthScopesRestrictionRequest = + (UpsertOAuthScopesRestrictionRequest) o; + return Objects.equals(this.data, upsertOAuthScopesRestrictionRequest.data) + && Objects.equals( + this.additionalProperties, upsertOAuthScopesRestrictionRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpsertOAuthScopesRestrictionRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpsertOAuthScopesRestrictionType.java b/src/main/java/com/datadog/api/client/v2/model/UpsertOAuthScopesRestrictionType.java new file mode 100644 index 00000000000..496c21c8947 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpsertOAuthScopesRestrictionType.java @@ -0,0 +1,58 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** JSON:API resource type for an upsert OAuth2 client scopes restriction request. */ +@JsonSerialize( + using = UpsertOAuthScopesRestrictionType.UpsertOAuthScopesRestrictionTypeSerializer.class) +public class UpsertOAuthScopesRestrictionType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("upsert_scopes_restriction")); + + public static final UpsertOAuthScopesRestrictionType UPSERT_SCOPES_RESTRICTION = + new UpsertOAuthScopesRestrictionType("upsert_scopes_restriction"); + + UpsertOAuthScopesRestrictionType(String value) { + super(value, allowedValues); + } + + public static class UpsertOAuthScopesRestrictionTypeSerializer + extends StdSerializer { + public UpsertOAuthScopesRestrictionTypeSerializer(Class t) { + super(t); + } + + public UpsertOAuthScopesRestrictionTypeSerializer() { + this(null); + } + + @Override + public void serialize( + UpsertOAuthScopesRestrictionType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static UpsertOAuthScopesRestrictionType fromValue(String value) { + return new UpsertOAuthScopesRestrictionType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature b/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature index b41928f4cb9..17779e4599e 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/cloud_cost_management.feature @@ -606,22 +606,6 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-cost-management - Scenario: List Cloud Cost Management tag metadata months returns "Bad Request" response - Given operation "ListCostTagMetadataMonths" enabled - And new "ListCostTagMetadataMonths" request - And request contains "filter[provider]" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/cloud-cost-management - Scenario: List Cloud Cost Management tag metadata months returns "OK" response - Given operation "ListCostTagMetadataMonths" enabled - And new "ListCostTagMetadataMonths" request - And request contains "filter[provider]" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-cost-management Scenario: List Cloud Cost Management tag sources returns "Bad Request" response Given operation "ListCostTagKeySources" enabled diff --git a/src/test/resources/com/datadog/api/client/v2/api/oauth2_client_public.feature b/src/test/resources/com/datadog/api/client/v2/api/oauth2_client_public.feature new file mode 100644 index 00000000000..a5c7d195efa --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 09d6acff288..b55e20fd7eb 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -1898,12 +1898,6 @@ "type": "safe" } }, - "ListCostTagMetadataMonths": { - "tag": "Cloud Cost Management", - "undo": { - "type": "safe" - } - }, "ListCostTagMetadataOrchestrators": { "tag": "Cloud Cost Management", "undo": { @@ -4672,6 +4666,30 @@ "type": "safe" } }, + "DeleteScopesRestriction": { + "tag": "OAuth2 Client Public", + "undo": { + "type": "idempotent" + } + }, + "GetScopesRestriction": { + "tag": "OAuth2 Client Public", + "undo": { + "type": "safe" + } + }, + "UpsertScopesRestriction": { + "tag": "OAuth2 Client Public", + "undo": { + "type": "idempotent" + } + }, + "RegisterOAuthClient": { + "tag": "OAuth2 Client Public", + "undo": { + "type": "idempotent" + } + }, "ListPipelines": { "tag": "Observability Pipelines", "undo": {