From b21b74d4be69e3be03dcfed384188b2a0558404c Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 27 May 2026 21:08:34 +0000 Subject: [PATCH] Regenerate client from commit 8292e96 of spec repo --- .generator/schemas/v2/openapi.yaml | 708 +++++------------- ...st-management_ListCostTagMetadataMonths.rs | 18 + ...2-client-public_DeleteScopesRestriction.rs | 21 - ...uth2-client-public_GetScopesRestriction.rs | 21 - ...auth2-client-public_RegisterOAuthClient.rs | 35 - ...2-client-public_UpsertScopesRestriction.rs | 40 - src/datadog/configuration.rs | 5 +- .../api/api_cloud_cost_management.rs | 132 ++++ .../api/api_o_auth2_client_public.rs | 661 ---------------- src/datadogV2/api/mod.rs | 1 - src/datadogV2/mod.rs | 1 - src/datadogV2/model/mod.rs | 42 +- ...ta.rs => model_cost_tag_metadata_month.rs} | 53 +- ... => model_cost_tag_metadata_month_type.rs} | 14 +- ...odel_cost_tag_metadata_months_response.rs} | 31 +- .../model_o_auth_client_registration_error.rs | 104 --- ...l_o_auth_client_registration_grant_type.rs | 51 -- ...odel_o_auth_client_registration_request.rs | 273 ------- ...del_o_auth_client_registration_response.rs | 163 ---- .../model/model_o_auth_oidc_scope.rs | 57 -- .../model/model_o_auth_scopes_restriction.rs | 109 --- ..._scopes_restriction_response_attributes.rs | 114 --- ...bility_pipeline_config_destination_item.rs | 11 + ...pipeline_splunk_hec_metrics_destination.rs | 310 ++++++++ ...nk_hec_metrics_destination_compression.rs} | 17 +- ...ne_splunk_hec_metrics_destination_type.rs} | 14 +- ...l_upsert_o_auth_scopes_restriction_data.rs | 125 ---- ...auth_scopes_restriction_data_attributes.rs | 125 ---- ...psert_o_auth_scopes_restriction_request.rs | 95 --- .../features/v2/cloud_cost_management.feature | 16 + .../features/v2/oauth2_client_public.feature | 100 --- tests/scenarios/features/v2/undo.json | 30 +- tests/scenarios/function_mappings.rs | 170 +---- 33 files changed, 776 insertions(+), 2891 deletions(-) create mode 100644 examples/v2_cloud-cost-management_ListCostTagMetadataMonths.rs delete mode 100644 examples/v2_oauth2-client-public_DeleteScopesRestriction.rs delete mode 100644 examples/v2_oauth2-client-public_GetScopesRestriction.rs delete mode 100644 examples/v2_oauth2-client-public_RegisterOAuthClient.rs delete mode 100644 examples/v2_oauth2-client-public_UpsertScopesRestriction.rs delete mode 100644 src/datadogV2/api/api_o_auth2_client_public.rs rename src/datadogV2/model/{model_o_auth_scopes_restriction_response_data.rs => model_cost_tag_metadata_month.rs} (61%) rename src/datadogV2/model/{model_o_auth_client_registration_response_type.rs => model_cost_tag_metadata_month_type.rs} (76%) rename src/datadogV2/model/{model_o_auth_scopes_restriction_response.rs => model_cost_tag_metadata_months_response.rs} (72%) delete mode 100644 src/datadogV2/model/model_o_auth_client_registration_error.rs delete mode 100644 src/datadogV2/model/model_o_auth_client_registration_grant_type.rs delete mode 100644 src/datadogV2/model/model_o_auth_client_registration_request.rs delete mode 100644 src/datadogV2/model/model_o_auth_client_registration_response.rs delete mode 100644 src/datadogV2/model/model_o_auth_oidc_scope.rs delete mode 100644 src/datadogV2/model/model_o_auth_scopes_restriction.rs delete mode 100644 src/datadogV2/model/model_o_auth_scopes_restriction_response_attributes.rs create mode 100644 src/datadogV2/model/model_observability_pipeline_splunk_hec_metrics_destination.rs rename src/datadogV2/model/{model_upsert_o_auth_scopes_restriction_type.rs => model_observability_pipeline_splunk_hec_metrics_destination_compression.rs} (70%) rename src/datadogV2/model/{model_o_auth_scopes_restriction_type.rs => model_observability_pipeline_splunk_hec_metrics_destination_type.rs} (72%) delete mode 100644 src/datadogV2/model/model_upsert_o_auth_scopes_restriction_data.rs delete mode 100644 src/datadogV2/model/model_upsert_o_auth_scopes_restriction_data_attributes.rs delete mode 100644 src/datadogV2/model/model_upsert_o_auth_scopes_restriction_request.rs delete mode 100644 tests/scenarios/features/v2/oauth2_client_public.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 453a74bab7..4afc8ca399 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1026,15 +1026,6 @@ 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" @@ -19906,6 +19897,45 @@ 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. @@ -54605,256 +54635,6 @@ 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: @@ -55844,6 +55624,7 @@ components: - $ref: "#/components/schemas/ObservabilityPipelineSyslogNgDestination" - $ref: "#/components/schemas/ObservabilityPipelineDatabricksZerobusDestination" - $ref: "#/components/schemas/ObservabilityPipelineDatadogMetricsDestination" + - $ref: "#/components/schemas/ObservabilityPipelineSplunkHecMetricsDestination" ObservabilityPipelineConfigPipelineType: default: logs description: The type of data being ingested. Defaults to `logs` if not specified. @@ -59965,6 +59746,81 @@ components: type: string x-enum-varnames: - SPLUNK_HEC + ObservabilityPipelineSplunkHecMetricsDestination: + description: |- + The `splunk_hec_metrics` destination forwards metrics to Splunk using the HTTP Event Collector (HEC). + + **Supported pipeline types:** metrics + properties: + buffer: + $ref: "#/components/schemas/ObservabilityPipelineBufferOptions" + compression: + $ref: "#/components/schemas/ObservabilityPipelineSplunkHecMetricsDestinationCompression" + default_namespace: + description: Optional default namespace for metrics sent to Splunk HEC. + example: "custom_namespace" + type: string + endpoint_url_key: + description: Name of the environment variable or secret that holds the Splunk HEC endpoint URL. + example: SPLUNK_HEC_ENDPOINT_URL + type: string + id: + description: The unique identifier for this component. Used in other parts of the pipeline to reference this component (for example, as the `input` to downstream components). + example: splunk-hec-metrics-destination + type: string + index: + description: Optional name of the Splunk index where metrics are written. + example: "metrics" + type: string + inputs: + description: A list of component IDs whose output is used as the `input` for this component. + example: ["metrics-filter-processor"] + items: + description: The ID of a component whose output is used as input for this destination. + type: string + type: array + source: + description: The Splunk source field value for metric events. + example: "observability_pipelines" + type: string + sourcetype: + description: The Splunk sourcetype to assign to metric events. + example: "custom_sourcetype" + type: string + tls: + $ref: "#/components/schemas/ObservabilityPipelineTls" + token_key: + description: Name of the environment variable or secret that holds the Splunk HEC token. + example: SPLUNK_HEC_TOKEN + type: string + type: + $ref: "#/components/schemas/ObservabilityPipelineSplunkHecMetricsDestinationType" + required: + - id + - type + - inputs + type: object + x-pipeline-types: [metrics] + ObservabilityPipelineSplunkHecMetricsDestinationCompression: + default: none + description: Compression algorithm applied when sending metrics to Splunk HEC. + enum: + - none + - gzip + example: none + type: string + x-enum-varnames: + - NONE + - GZIP + ObservabilityPipelineSplunkHecMetricsDestinationType: + default: splunk_hec_metrics + description: The destination type. Always `splunk_hec_metrics`. + enum: + - splunk_hec_metrics + example: splunk_hec_metrics + type: string + x-enum-varnames: + - SPLUNK_HEC_METRICS ObservabilityPipelineSplunkHecSource: description: |- The `splunk_hec` source implements the Splunk HTTP Event Collector (HEC) API. @@ -92399,57 +92255,6 @@ 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: @@ -111445,6 +111250,68 @@ 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. @@ -134520,223 +134387,6 @@ 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. @@ -168153,10 +167803,6 @@ 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.rs b/examples/v2_cloud-cost-management_ListCostTagMetadataMonths.rs new file mode 100644 index 0000000000..c61712504b --- /dev/null +++ b/examples/v2_cloud-cost-management_ListCostTagMetadataMonths.rs @@ -0,0 +1,18 @@ +// List Cloud Cost Management tag metadata months returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_cloud_cost_management::CloudCostManagementAPI; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.ListCostTagMetadataMonths", true); + let api = CloudCostManagementAPI::with_config(configuration); + let resp = api + .list_cost_tag_metadata_months("filter[provider]".to_string()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_oauth2-client-public_DeleteScopesRestriction.rs b/examples/v2_oauth2-client-public_DeleteScopesRestriction.rs deleted file mode 100644 index a9d827e10b..0000000000 --- a/examples/v2_oauth2-client-public_DeleteScopesRestriction.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Delete an OAuth2 client scopes restriction returns "No Content" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_o_auth2_client_public::OAuth2ClientPublicAPI; -use uuid::Uuid; - -#[tokio::main] -async fn main() { - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.DeleteScopesRestriction", true); - let api = OAuth2ClientPublicAPI::with_config(configuration); - let resp = api - .delete_scopes_restriction( - Uuid::parse_str("fafa8e1c-36a5-11f0-a83d-da7ad0900001").expect("invalid UUID"), - ) - .await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/examples/v2_oauth2-client-public_GetScopesRestriction.rs b/examples/v2_oauth2-client-public_GetScopesRestriction.rs deleted file mode 100644 index afc94ee3a4..0000000000 --- a/examples/v2_oauth2-client-public_GetScopesRestriction.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Get an OAuth2 client scopes restriction returns "OK" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_o_auth2_client_public::OAuth2ClientPublicAPI; -use uuid::Uuid; - -#[tokio::main] -async fn main() { - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.GetScopesRestriction", true); - let api = OAuth2ClientPublicAPI::with_config(configuration); - let resp = api - .get_scopes_restriction( - Uuid::parse_str("fafa8e1c-36a5-11f0-a83d-da7ad0900001").expect("invalid UUID"), - ) - .await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/examples/v2_oauth2-client-public_RegisterOAuthClient.rs b/examples/v2_oauth2-client-public_RegisterOAuthClient.rs deleted file mode 100644 index d8bf20ba9f..0000000000 --- a/examples/v2_oauth2-client-public_RegisterOAuthClient.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Register an OAuth2 client returns "Created" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_o_auth2_client_public::OAuth2ClientPublicAPI; -use datadog_api_client::datadogV2::model::OAuthClientRegistrationGrantType; -use datadog_api_client::datadogV2::model::OAuthClientRegistrationRequest; -use datadog_api_client::datadogV2::model::OAuthClientRegistrationResponseType; - -#[tokio::main] -async fn main() { - let body = OAuthClientRegistrationRequest::new( - "Example MCP Client".to_string(), - vec!["https://example.com/oauth/callback".to_string()], - ) - .client_uri("https://example.com".to_string()) - .grant_types(vec![ - OAuthClientRegistrationGrantType::AUTHORIZATION_CODE, - OAuthClientRegistrationGrantType::REFRESH_TOKEN, - ]) - .jwks_uri("https://example.com/.well-known/jwks.json".to_string()) - .logo_uri("https://example.com/logo.png".to_string()) - .policy_uri("https://example.com/privacy".to_string()) - .response_types(vec![OAuthClientRegistrationResponseType::CODE]) - .scope("openid profile".to_string()) - .token_endpoint_auth_method("none".to_string()) - .tos_uri("https://example.com/tos".to_string()); - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.RegisterOAuthClient", true); - let api = OAuth2ClientPublicAPI::with_config(configuration); - let resp = api.register_o_auth_client(body).await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/examples/v2_oauth2-client-public_UpsertScopesRestriction.rs b/examples/v2_oauth2-client-public_UpsertScopesRestriction.rs deleted file mode 100644 index e72b58b130..0000000000 --- a/examples/v2_oauth2-client-public_UpsertScopesRestriction.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Upsert an OAuth2 client scopes restriction returns "OK" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_o_auth2_client_public::OAuth2ClientPublicAPI; -use datadog_api_client::datadogV2::model::OAuthOidcScope; -use datadog_api_client::datadogV2::model::UpsertOAuthScopesRestrictionData; -use datadog_api_client::datadogV2::model::UpsertOAuthScopesRestrictionDataAttributes; -use datadog_api_client::datadogV2::model::UpsertOAuthScopesRestrictionRequest; -use datadog_api_client::datadogV2::model::UpsertOAuthScopesRestrictionType; -use uuid::Uuid; - -#[tokio::main] -async fn main() { - let body = UpsertOAuthScopesRestrictionRequest::new( - UpsertOAuthScopesRestrictionData::new( - UpsertOAuthScopesRestrictionType::UPSERT_SCOPES_RESTRICTION, - ) - .attributes( - UpsertOAuthScopesRestrictionDataAttributes::new() - .oidc_scopes(vec![OAuthOidcScope::OPENID, OAuthOidcScope::EMAIL]) - .permission_scopes(vec![ - "dashboards_read".to_string(), - "metrics_read".to_string(), - ]), - ), - ); - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.UpsertScopesRestriction", true); - let api = OAuth2ClientPublicAPI::with_config(configuration); - let resp = api - .upsert_scopes_restriction( - Uuid::parse_str("fafa8e1c-36a5-11f0-a83d-da7ad0900001").expect("invalid UUID"), - body, - ) - .await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index 974031b947..0ad7b82e04 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -401,6 +401,7 @@ impl Default for Configuration { ("v2.list_cost_tag_key_sources".to_owned(), false), ("v2.list_cost_tag_metadata".to_owned(), false), ("v2.list_cost_tag_metadata_metrics".to_owned(), false), + ("v2.list_cost_tag_metadata_months".to_owned(), false), ("v2.list_cost_tag_metadata_orchestrators".to_owned(), false), ("v2.search_cost_recommendations".to_owned(), false), ("v2.create_dashboard_secure_embed".to_owned(), false), @@ -540,10 +541,6 @@ impl Default for Configuration { false, ), ("v2.validate_monitor_user_template".to_owned(), false), - ("v2.delete_scopes_restriction".to_owned(), false), - ("v2.get_scopes_restriction".to_owned(), false), - ("v2.register_o_auth_client".to_owned(), false), - ("v2.upsert_scopes_restriction".to_owned(), false), ("v2.bulk_update_org_group_memberships".to_owned(), false), ("v2.create_org_group".to_owned(), false), ("v2.create_org_group_policy".to_owned(), false), diff --git a/src/datadogV2/api/api_cloud_cost_management.rs b/src/datadogV2/api/api_cloud_cost_management.rs index 02449cd055..555456f553 100644 --- a/src/datadogV2/api/api_cloud_cost_management.rs +++ b/src/datadogV2/api/api_cloud_cost_management.rs @@ -875,6 +875,14 @@ pub enum ListCostTagMetadataMetricsError { UnknownValue(serde_json::Value), } +/// ListCostTagMetadataMonthsError is a struct for typed errors of method [`CloudCostManagementAPI::list_cost_tag_metadata_months`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListCostTagMetadataMonthsError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// ListCostTagMetadataOrchestratorsError is a struct for typed errors of method [`CloudCostManagementAPI::list_cost_tag_metadata_orchestrators`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -6163,6 +6171,130 @@ impl CloudCostManagementAPI { } } + /// List months that have Cloud Cost Management tag metadata for a given provider, + /// ordered most-recent first. The response is capped at 36 months. + pub async fn list_cost_tag_metadata_months( + &self, + filter_provider: String, + ) -> Result< + crate::datadogV2::model::CostTagMetadataMonthsResponse, + datadog::Error, + > { + match self + .list_cost_tag_metadata_months_with_http_info(filter_provider) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// List months that have Cloud Cost Management tag metadata for a given provider, + /// ordered most-recent first. The response is capped at 36 months. + pub async fn list_cost_tag_metadata_months_with_http_info( + &self, + filter_provider: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_cost_tag_metadata_months"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_cost_tag_metadata_months' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/cost/tag_metadata/months", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + local_req_builder = + local_req_builder.query(&[("filter[provider]", &filter_provider.to_string())]); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + /// List container orchestrators (for example, `kubernetes`, `ecs`) detected in Cloud Cost Management data for the requested period. pub async fn list_cost_tag_metadata_orchestrators( &self, diff --git a/src/datadogV2/api/api_o_auth2_client_public.rs b/src/datadogV2/api/api_o_auth2_client_public.rs deleted file mode 100644 index 459d5c5f1e..0000000000 --- a/src/datadogV2/api/api_o_auth2_client_public.rs +++ /dev/null @@ -1,661 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use crate::datadog; -use flate2::{ - write::{GzEncoder, ZlibEncoder}, - Compression, -}; -use log::warn; -use reqwest::header::{HeaderMap, HeaderValue}; -use serde::{Deserialize, Serialize}; -use std::io::Write; - -/// DeleteScopesRestrictionError is a struct for typed errors of method [`OAuth2ClientPublicAPI::delete_scopes_restriction`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteScopesRestrictionError { - JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// GetScopesRestrictionError is a struct for typed errors of method [`OAuth2ClientPublicAPI::get_scopes_restriction`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetScopesRestrictionError { - JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// RegisterOAuthClientError is a struct for typed errors of method [`OAuth2ClientPublicAPI::register_o_auth_client`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum RegisterOAuthClientError { - OAuthClientRegistrationError(crate::datadogV2::model::OAuthClientRegistrationError), - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// UpsertScopesRestrictionError is a struct for typed errors of method [`OAuth2ClientPublicAPI::upsert_scopes_restriction`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum UpsertScopesRestrictionError { - JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// Configure OAuth2 clients for Datadog. -/// Supports RFC 7591 Dynamic Client Registration and management of OAuth2 client scopes restrictions. -#[derive(Debug, Clone)] -pub struct OAuth2ClientPublicAPI { - config: datadog::Configuration, - client: reqwest_middleware::ClientWithMiddleware, -} - -impl Default for OAuth2ClientPublicAPI { - fn default() -> Self { - Self::with_config(datadog::Configuration::default()) - } -} - -impl OAuth2ClientPublicAPI { - pub fn new() -> Self { - Self::default() - } - pub fn with_config(config: datadog::Configuration) -> Self { - let reqwest_client_builder = { - let builder = reqwest::Client::builder(); - #[cfg(not(target_arch = "wasm32"))] - let builder = if let Some(proxy_url) = &config.proxy_url { - builder.proxy(reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL")) - } else { - builder - }; - builder - }; - - let middleware_client_builder = { - let builder = - reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); - #[cfg(feature = "retry")] - let builder = if config.enable_retry { - struct RetryableStatus; - impl reqwest_retry::RetryableStrategy for RetryableStatus { - fn handle( - &self, - res: &Result, - ) -> Option { - match res { - Ok(success) => reqwest_retry::default_on_request_success(success), - Err(_) => None, - } - } - } - let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() - .build_with_max_retries(config.max_retries); - - let retry_middleware = - reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( - backoff_policy, - RetryableStatus, - ); - - builder.with(retry_middleware) - } else { - builder - }; - builder - }; - - let client = middleware_client_builder.build(); - - Self { config, client } - } - - pub fn with_client_and_config( - config: datadog::Configuration, - client: reqwest_middleware::ClientWithMiddleware, - ) -> Self { - Self { config, client } - } - - /// Delete the scopes restriction configured for the OAuth2 client. - pub async fn delete_scopes_restriction( - &self, - client_uuid: uuid::Uuid, - ) -> Result<(), datadog::Error> { - match self - .delete_scopes_restriction_with_http_info(client_uuid) - .await - { - Ok(_) => Ok(()), - Err(err) => Err(err), - } - } - - /// Delete the scopes restriction configured for the OAuth2 client. - pub async fn delete_scopes_restriction_with_http_info( - &self, - client_uuid: uuid::Uuid, - ) -> Result, datadog::Error> { - let local_configuration = &self.config; - let operation_id = "v2.delete_scopes_restriction"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_scopes_restriction' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/oauth2/clients/{client_uuid}/scopes_restriction", - local_configuration.get_operation_host(operation_id), - client_uuid = datadog::urlencode(client_uuid.to_string()) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("*/*")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) - } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// Get the scopes restriction configured for the OAuth2 client. - pub async fn get_scopes_restriction( - &self, - client_uuid: uuid::Uuid, - ) -> Result< - crate::datadogV2::model::OAuthScopesRestrictionResponse, - datadog::Error, - > { - match self - .get_scopes_restriction_with_http_info(client_uuid) - .await - { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// Get the scopes restriction configured for the OAuth2 client. - pub async fn get_scopes_restriction_with_http_info( - &self, - client_uuid: uuid::Uuid, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.get_scopes_restriction"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_scopes_restriction' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/oauth2/clients/{client_uuid}/scopes_restriction", - local_configuration.get_operation_host(operation_id), - client_uuid = datadog::urlencode(client_uuid.to_string()) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// Register an OAuth2 client using the Dynamic Client Registration protocol defined in RFC 7591. - pub async fn register_o_auth_client( - &self, - body: crate::datadogV2::model::OAuthClientRegistrationRequest, - ) -> Result< - crate::datadogV2::model::OAuthClientRegistrationResponse, - datadog::Error, - > { - match self.register_o_auth_client_with_http_info(body).await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// Register an OAuth2 client using the Dynamic Client Registration protocol defined in RFC 7591. - pub async fn register_o_auth_client_with_http_info( - &self, - body: crate::datadogV2::model::OAuthClientRegistrationRequest, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.register_o_auth_client"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.register_o_auth_client' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/oauth2/register", - local_configuration.get_operation_host(operation_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - #[cfg(feature = "zstd")] - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// Create or update the scopes restriction configured for the OAuth2 client. - pub async fn upsert_scopes_restriction( - &self, - client_uuid: uuid::Uuid, - body: crate::datadogV2::model::UpsertOAuthScopesRestrictionRequest, - ) -> Result< - crate::datadogV2::model::OAuthScopesRestrictionResponse, - datadog::Error, - > { - match self - .upsert_scopes_restriction_with_http_info(client_uuid, body) - .await - { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// Create or update the scopes restriction configured for the OAuth2 client. - pub async fn upsert_scopes_restriction_with_http_info( - &self, - client_uuid: uuid::Uuid, - body: crate::datadogV2::model::UpsertOAuthScopesRestrictionRequest, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.upsert_scopes_restriction"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.upsert_scopes_restriction' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/oauth2/clients/{client_uuid}/scopes_restriction", - local_configuration.get_operation_host(operation_id), - client_uuid = datadog::urlencode(client_uuid.to_string()) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - #[cfg(feature = "zstd")] - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } -} diff --git a/src/datadogV2/api/mod.rs b/src/datadogV2/api/mod.rs index bc2661dc38..30a01d16a5 100644 --- a/src/datadogV2/api/mod.rs +++ b/src/datadogV2/api/mod.rs @@ -69,7 +69,6 @@ pub mod api_microsoft_teams_integration; pub mod api_model_lab_api; pub mod api_monitors; pub mod api_network_device_monitoring; -pub mod api_o_auth2_client_public; pub mod api_observability_pipelines; pub mod api_oci_integration; pub mod api_okta_integration; diff --git a/src/datadogV2/mod.rs b/src/datadogV2/mod.rs index ecaff62f33..7fd082f0d0 100644 --- a/src/datadogV2/mod.rs +++ b/src/datadogV2/mod.rs @@ -70,7 +70,6 @@ pub use self::api::api_microsoft_teams_integration; pub use self::api::api_model_lab_api; pub use self::api::api_monitors; pub use self::api::api_network_device_monitoring; -pub use self::api::api_o_auth2_client_public; pub use self::api::api_observability_pipelines; pub use self::api::api_oci_integration; pub use self::api::api_okta_integration; diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 465ec5b5fb..a2569be9e4 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -2992,6 +2992,12 @@ pub mod model_cost_metric; pub use self::model_cost_metric::CostMetric; pub mod model_cost_metric_type; pub use self::model_cost_metric_type::CostMetricType; +pub mod model_cost_tag_metadata_months_response; +pub use self::model_cost_tag_metadata_months_response::CostTagMetadataMonthsResponse; +pub mod model_cost_tag_metadata_month; +pub use self::model_cost_tag_metadata_month::CostTagMetadataMonth; +pub mod model_cost_tag_metadata_month_type; +pub use self::model_cost_tag_metadata_month_type::CostTagMetadataMonthType; pub mod model_cost_orchestrators_response; pub use self::model_cost_orchestrators_response::CostOrchestratorsResponse; pub mod model_cost_orchestrator; @@ -6152,36 +6158,6 @@ pub mod model_dns_metric_key; pub use self::model_dns_metric_key::DnsMetricKey; pub mod model_single_aggregated_dns_response_data_type; pub use self::model_single_aggregated_dns_response_data_type::SingleAggregatedDnsResponseDataType; -pub mod model_o_auth_scopes_restriction_response; -pub use self::model_o_auth_scopes_restriction_response::OAuthScopesRestrictionResponse; -pub mod model_o_auth_scopes_restriction_response_data; -pub use self::model_o_auth_scopes_restriction_response_data::OAuthScopesRestrictionResponseData; -pub mod model_o_auth_scopes_restriction_response_attributes; -pub use self::model_o_auth_scopes_restriction_response_attributes::OAuthScopesRestrictionResponseAttributes; -pub mod model_o_auth_scopes_restriction; -pub use self::model_o_auth_scopes_restriction::OAuthScopesRestriction; -pub mod model_o_auth_oidc_scope; -pub use self::model_o_auth_oidc_scope::OAuthOidcScope; -pub mod model_o_auth_scopes_restriction_type; -pub use self::model_o_auth_scopes_restriction_type::OAuthScopesRestrictionType; -pub mod model_upsert_o_auth_scopes_restriction_request; -pub use self::model_upsert_o_auth_scopes_restriction_request::UpsertOAuthScopesRestrictionRequest; -pub mod model_upsert_o_auth_scopes_restriction_data; -pub use self::model_upsert_o_auth_scopes_restriction_data::UpsertOAuthScopesRestrictionData; -pub mod model_upsert_o_auth_scopes_restriction_data_attributes; -pub use self::model_upsert_o_auth_scopes_restriction_data_attributes::UpsertOAuthScopesRestrictionDataAttributes; -pub mod model_upsert_o_auth_scopes_restriction_type; -pub use self::model_upsert_o_auth_scopes_restriction_type::UpsertOAuthScopesRestrictionType; -pub mod model_o_auth_client_registration_request; -pub use self::model_o_auth_client_registration_request::OAuthClientRegistrationRequest; -pub mod model_o_auth_client_registration_grant_type; -pub use self::model_o_auth_client_registration_grant_type::OAuthClientRegistrationGrantType; -pub mod model_o_auth_client_registration_response_type; -pub use self::model_o_auth_client_registration_response_type::OAuthClientRegistrationResponseType; -pub mod model_o_auth_client_registration_response; -pub use self::model_o_auth_client_registration_response::OAuthClientRegistrationResponse; -pub mod model_o_auth_client_registration_error; -pub use self::model_o_auth_client_registration_error::OAuthClientRegistrationError; pub mod model_list_pipelines_response; pub use self::model_list_pipelines_response::ListPipelinesResponse; pub mod model_observability_pipeline_data; @@ -6422,6 +6398,12 @@ pub mod model_observability_pipeline_datadog_metrics_destination; pub use self::model_observability_pipeline_datadog_metrics_destination::ObservabilityPipelineDatadogMetricsDestination; pub mod model_observability_pipeline_datadog_metrics_destination_type; pub use self::model_observability_pipeline_datadog_metrics_destination_type::ObservabilityPipelineDatadogMetricsDestinationType; +pub mod model_observability_pipeline_splunk_hec_metrics_destination; +pub use self::model_observability_pipeline_splunk_hec_metrics_destination::ObservabilityPipelineSplunkHecMetricsDestination; +pub mod model_observability_pipeline_splunk_hec_metrics_destination_compression; +pub use self::model_observability_pipeline_splunk_hec_metrics_destination_compression::ObservabilityPipelineSplunkHecMetricsDestinationCompression; +pub mod model_observability_pipeline_splunk_hec_metrics_destination_type; +pub use self::model_observability_pipeline_splunk_hec_metrics_destination_type::ObservabilityPipelineSplunkHecMetricsDestinationType; pub mod model_observability_pipeline_config_destination_item; pub use self::model_observability_pipeline_config_destination_item::ObservabilityPipelineConfigDestinationItem; pub mod model_observability_pipeline_config_pipeline_type; diff --git a/src/datadogV2/model/model_o_auth_scopes_restriction_response_data.rs b/src/datadogV2/model/model_cost_tag_metadata_month.rs similarity index 61% rename from src/datadogV2/model/model_o_auth_scopes_restriction_response_data.rs rename to src/datadogV2/model/model_cost_tag_metadata_month.rs index 911cc20ecf..afff20d30f 100644 --- a/src/datadogV2/model/model_o_auth_scopes_restriction_response_data.rs +++ b/src/datadogV2/model/model_cost_tag_metadata_month.rs @@ -6,20 +6,17 @@ use serde::{Deserialize, Deserializer, Serialize}; use serde_with::skip_serializing_none; use std::fmt::{self, Formatter}; -/// Data object of an OAuth2 client scopes restriction response. +/// A month that has Cloud Cost Management tag metadata available for a given provider. #[non_exhaustive] #[skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize)] -pub struct OAuthScopesRestrictionResponseData { - /// Attributes of an OAuth2 client scopes restriction. - #[serde(rename = "attributes")] - pub attributes: crate::datadogV2::model::OAuthScopesRestrictionResponseAttributes, - /// UUID of the OAuth2 client this restriction applies to. +pub struct CostTagMetadataMonth { + /// The month, in `YYYY-MM` format. #[serde(rename = "id")] - pub id: uuid::Uuid, - /// JSON:API resource type for an OAuth2 client scopes restriction. + pub id: String, + /// Type of the Cloud Cost Management tag metadata month resource. #[serde(rename = "type")] - pub type_: crate::datadogV2::model::OAuthScopesRestrictionType, + pub type_: crate::datadogV2::model::CostTagMetadataMonthType, #[serde(flatten)] pub additional_properties: std::collections::BTreeMap, #[serde(skip)] @@ -27,14 +24,12 @@ pub struct OAuthScopesRestrictionResponseData { pub(crate) _unparsed: bool, } -impl OAuthScopesRestrictionResponseData { +impl CostTagMetadataMonth { pub fn new( - attributes: crate::datadogV2::model::OAuthScopesRestrictionResponseAttributes, - id: uuid::Uuid, - type_: crate::datadogV2::model::OAuthScopesRestrictionType, - ) -> OAuthScopesRestrictionResponseData { - OAuthScopesRestrictionResponseData { - attributes, + id: String, + type_: crate::datadogV2::model::CostTagMetadataMonthType, + ) -> CostTagMetadataMonth { + CostTagMetadataMonth { id, type_, additional_properties: std::collections::BTreeMap::new(), @@ -51,14 +46,14 @@ impl OAuthScopesRestrictionResponseData { } } -impl<'de> Deserialize<'de> for OAuthScopesRestrictionResponseData { +impl<'de> Deserialize<'de> for CostTagMetadataMonth { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>, { - struct OAuthScopesRestrictionResponseDataVisitor; - impl<'a> Visitor<'a> for OAuthScopesRestrictionResponseDataVisitor { - type Value = OAuthScopesRestrictionResponseData; + struct CostTagMetadataMonthVisitor; + impl<'a> Visitor<'a> for CostTagMetadataMonthVisitor { + type Value = CostTagMetadataMonth; fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { f.write_str("a mapping") @@ -68,11 +63,8 @@ impl<'de> Deserialize<'de> for OAuthScopesRestrictionResponseData { where M: MapAccess<'a>, { - let mut attributes: Option< - crate::datadogV2::model::OAuthScopesRestrictionResponseAttributes, - > = None; - let mut id: Option = None; - let mut type_: Option = None; + let mut id: Option = None; + let mut type_: Option = None; let mut additional_properties: std::collections::BTreeMap< String, serde_json::Value, @@ -81,9 +73,6 @@ impl<'de> Deserialize<'de> for OAuthScopesRestrictionResponseData { while let Some((k, v)) = map.next_entry::()? { match k.as_str() { - "attributes" => { - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } "id" => { id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } @@ -91,7 +80,7 @@ impl<'de> Deserialize<'de> for OAuthScopesRestrictionResponseData { type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); if let Some(ref _type_) = type_ { match _type_ { - crate::datadogV2::model::OAuthScopesRestrictionType::UnparsedObject(_type_) => { + crate::datadogV2::model::CostTagMetadataMonthType::UnparsedObject(_type_) => { _unparsed = true; }, _ => {} @@ -105,12 +94,10 @@ impl<'de> Deserialize<'de> for OAuthScopesRestrictionResponseData { } } } - let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; let id = id.ok_or_else(|| M::Error::missing_field("id"))?; let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - let content = OAuthScopesRestrictionResponseData { - attributes, + let content = CostTagMetadataMonth { id, type_, additional_properties, @@ -121,6 +108,6 @@ impl<'de> Deserialize<'de> for OAuthScopesRestrictionResponseData { } } - deserializer.deserialize_any(OAuthScopesRestrictionResponseDataVisitor) + deserializer.deserialize_any(CostTagMetadataMonthVisitor) } } diff --git a/src/datadogV2/model/model_o_auth_client_registration_response_type.rs b/src/datadogV2/model/model_cost_tag_metadata_month_type.rs similarity index 76% rename from src/datadogV2/model/model_o_auth_client_registration_response_type.rs rename to src/datadogV2/model/model_cost_tag_metadata_month_type.rs index 5f239dec92..17be4bf386 100644 --- a/src/datadogV2/model/model_o_auth_client_registration_response_type.rs +++ b/src/datadogV2/model/model_cost_tag_metadata_month_type.rs @@ -6,21 +6,21 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[non_exhaustive] #[derive(Clone, Debug, Eq, PartialEq)] -pub enum OAuthClientRegistrationResponseType { - CODE, +pub enum CostTagMetadataMonthType { + COST_TAG_METADATA_MONTH, UnparsedObject(crate::datadog::UnparsedObject), } -impl ToString for OAuthClientRegistrationResponseType { +impl ToString for CostTagMetadataMonthType { fn to_string(&self) -> String { match self { - Self::CODE => String::from("code"), + Self::COST_TAG_METADATA_MONTH => String::from("cost_tag_metadata_month"), Self::UnparsedObject(v) => v.value.to_string(), } } } -impl Serialize for OAuthClientRegistrationResponseType { +impl Serialize for CostTagMetadataMonthType { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -32,14 +32,14 @@ impl Serialize for OAuthClientRegistrationResponseType { } } -impl<'de> Deserialize<'de> for OAuthClientRegistrationResponseType { +impl<'de> Deserialize<'de> for CostTagMetadataMonthType { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>, { let s: String = String::deserialize(deserializer)?; Ok(match s.as_str() { - "code" => Self::CODE, + "cost_tag_metadata_month" => Self::COST_TAG_METADATA_MONTH, _ => Self::UnparsedObject(crate::datadog::UnparsedObject { value: serde_json::Value::String(s.into()), }), diff --git a/src/datadogV2/model/model_o_auth_scopes_restriction_response.rs b/src/datadogV2/model/model_cost_tag_metadata_months_response.rs similarity index 72% rename from src/datadogV2/model/model_o_auth_scopes_restriction_response.rs rename to src/datadogV2/model/model_cost_tag_metadata_months_response.rs index 362a8cf7a3..381255ab89 100644 --- a/src/datadogV2/model/model_o_auth_scopes_restriction_response.rs +++ b/src/datadogV2/model/model_cost_tag_metadata_months_response.rs @@ -6,14 +6,14 @@ use serde::{Deserialize, Deserializer, Serialize}; use serde_with::skip_serializing_none; use std::fmt::{self, Formatter}; -/// Response payload describing the scopes restriction of an OAuth2 client. +/// List of months that have Cloud Cost Management tag metadata for the requested provider, ordered most-recent first and capped at 36 months. #[non_exhaustive] #[skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize)] -pub struct OAuthScopesRestrictionResponse { - /// Data object of an OAuth2 client scopes restriction response. +pub struct CostTagMetadataMonthsResponse { + /// List of months that have tag metadata available. #[serde(rename = "data")] - pub data: crate::datadogV2::model::OAuthScopesRestrictionResponseData, + pub data: Vec, #[serde(flatten)] pub additional_properties: std::collections::BTreeMap, #[serde(skip)] @@ -21,11 +21,11 @@ pub struct OAuthScopesRestrictionResponse { pub(crate) _unparsed: bool, } -impl OAuthScopesRestrictionResponse { +impl CostTagMetadataMonthsResponse { pub fn new( - data: crate::datadogV2::model::OAuthScopesRestrictionResponseData, - ) -> OAuthScopesRestrictionResponse { - OAuthScopesRestrictionResponse { + data: Vec, + ) -> CostTagMetadataMonthsResponse { + CostTagMetadataMonthsResponse { data, additional_properties: std::collections::BTreeMap::new(), _unparsed: false, @@ -41,14 +41,14 @@ impl OAuthScopesRestrictionResponse { } } -impl<'de> Deserialize<'de> for OAuthScopesRestrictionResponse { +impl<'de> Deserialize<'de> for CostTagMetadataMonthsResponse { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>, { - struct OAuthScopesRestrictionResponseVisitor; - impl<'a> Visitor<'a> for OAuthScopesRestrictionResponseVisitor { - type Value = OAuthScopesRestrictionResponse; + struct CostTagMetadataMonthsResponseVisitor; + impl<'a> Visitor<'a> for CostTagMetadataMonthsResponseVisitor { + type Value = CostTagMetadataMonthsResponse; fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { f.write_str("a mapping") @@ -58,8 +58,7 @@ impl<'de> Deserialize<'de> for OAuthScopesRestrictionResponse { where M: MapAccess<'a>, { - let mut data: Option = - None; + let mut data: Option> = None; let mut additional_properties: std::collections::BTreeMap< String, serde_json::Value, @@ -80,7 +79,7 @@ impl<'de> Deserialize<'de> for OAuthScopesRestrictionResponse { } let data = data.ok_or_else(|| M::Error::missing_field("data"))?; - let content = OAuthScopesRestrictionResponse { + let content = CostTagMetadataMonthsResponse { data, additional_properties, _unparsed, @@ -90,6 +89,6 @@ impl<'de> Deserialize<'de> for OAuthScopesRestrictionResponse { } } - deserializer.deserialize_any(OAuthScopesRestrictionResponseVisitor) + deserializer.deserialize_any(CostTagMetadataMonthsResponseVisitor) } } diff --git a/src/datadogV2/model/model_o_auth_client_registration_error.rs b/src/datadogV2/model/model_o_auth_client_registration_error.rs deleted file mode 100644 index 5a64c0983e..0000000000 --- a/src/datadogV2/model/model_o_auth_client_registration_error.rs +++ /dev/null @@ -1,104 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// Error payload returned by OAuth2 dynamic client registration as defined by RFC 7591. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct OAuthClientRegistrationError { - /// Single ASCII error code per RFC 7591, such as `invalid_request` or `invalid_client_metadata`. - #[serde(rename = "error")] - pub error: String, - /// Human-readable description of the error. - #[serde(rename = "error_description")] - pub error_description: String, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl OAuthClientRegistrationError { - pub fn new(error: String, error_description: String) -> OAuthClientRegistrationError { - OAuthClientRegistrationError { - error, - error_description, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for OAuthClientRegistrationError { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct OAuthClientRegistrationErrorVisitor; - impl<'a> Visitor<'a> for OAuthClientRegistrationErrorVisitor { - type Value = OAuthClientRegistrationError; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut error: Option = None; - let mut error_description: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "error" => { - error = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "error_description" => { - error_description = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let error = error.ok_or_else(|| M::Error::missing_field("error"))?; - let error_description = error_description - .ok_or_else(|| M::Error::missing_field("error_description"))?; - - let content = OAuthClientRegistrationError { - error, - error_description, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(OAuthClientRegistrationErrorVisitor) - } -} diff --git a/src/datadogV2/model/model_o_auth_client_registration_grant_type.rs b/src/datadogV2/model/model_o_auth_client_registration_grant_type.rs deleted file mode 100644 index 90cab933e9..0000000000 --- a/src/datadogV2/model/model_o_auth_client_registration_grant_type.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum OAuthClientRegistrationGrantType { - AUTHORIZATION_CODE, - REFRESH_TOKEN, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for OAuthClientRegistrationGrantType { - fn to_string(&self) -> String { - match self { - Self::AUTHORIZATION_CODE => String::from("authorization_code"), - Self::REFRESH_TOKEN => String::from("refresh_token"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for OAuthClientRegistrationGrantType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for OAuthClientRegistrationGrantType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "authorization_code" => Self::AUTHORIZATION_CODE, - "refresh_token" => Self::REFRESH_TOKEN, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_o_auth_client_registration_request.rs b/src/datadogV2/model/model_o_auth_client_registration_request.rs deleted file mode 100644 index b1242d22d7..0000000000 --- a/src/datadogV2/model/model_o_auth_client_registration_request.rs +++ /dev/null @@ -1,273 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// Request payload for OAuth2 dynamic client registration as defined by RFC 7591. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct OAuthClientRegistrationRequest { - /// Human-readable name of the client. Control characters are rejected. - #[serde(rename = "client_name")] - pub client_name: String, - /// URL of the home page of the client. - #[serde(rename = "client_uri")] - pub client_uri: Option, - /// OAuth 2.0 grant types the client may use. - /// Defaults to `authorization_code` and `refresh_token` when omitted. - #[serde(rename = "grant_types")] - pub grant_types: Option>, - /// URL referencing the client's JSON Web Key Set. - #[serde(rename = "jwks_uri")] - pub jwks_uri: Option, - /// URL referencing a logo for the client. - #[serde(rename = "logo_uri")] - pub logo_uri: Option, - /// URL pointing to the client's privacy policy. - #[serde(rename = "policy_uri")] - pub policy_uri: Option, - /// Array of redirection URI strings used by the client in redirect-based flows. - #[serde(rename = "redirect_uris")] - pub redirect_uris: Vec, - /// OAuth 2.0 response types the client may use. Only `code` is supported. - #[serde(rename = "response_types")] - pub response_types: Option>, - /// Space-separated list of scope values the client may request. - #[serde(rename = "scope")] - pub scope: Option, - /// Requested authentication method for the token endpoint. Only `none` is supported. - #[serde(rename = "token_endpoint_auth_method")] - pub token_endpoint_auth_method: Option, - /// URL pointing to the client's terms of service. - #[serde(rename = "tos_uri")] - pub tos_uri: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl OAuthClientRegistrationRequest { - pub fn new(client_name: String, redirect_uris: Vec) -> OAuthClientRegistrationRequest { - OAuthClientRegistrationRequest { - client_name, - client_uri: None, - grant_types: None, - jwks_uri: None, - logo_uri: None, - policy_uri: None, - redirect_uris, - response_types: None, - scope: None, - token_endpoint_auth_method: None, - tos_uri: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn client_uri(mut self, value: String) -> Self { - self.client_uri = Some(value); - self - } - - pub fn grant_types( - mut self, - value: Vec, - ) -> Self { - self.grant_types = Some(value); - self - } - - pub fn jwks_uri(mut self, value: String) -> Self { - self.jwks_uri = Some(value); - self - } - - pub fn logo_uri(mut self, value: String) -> Self { - self.logo_uri = Some(value); - self - } - - pub fn policy_uri(mut self, value: String) -> Self { - self.policy_uri = Some(value); - self - } - - pub fn response_types( - mut self, - value: Vec, - ) -> Self { - self.response_types = Some(value); - self - } - - pub fn scope(mut self, value: String) -> Self { - self.scope = Some(value); - self - } - - pub fn token_endpoint_auth_method(mut self, value: String) -> Self { - self.token_endpoint_auth_method = Some(value); - self - } - - pub fn tos_uri(mut self, value: String) -> Self { - self.tos_uri = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for OAuthClientRegistrationRequest { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct OAuthClientRegistrationRequestVisitor; - impl<'a> Visitor<'a> for OAuthClientRegistrationRequestVisitor { - type Value = OAuthClientRegistrationRequest; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut client_name: Option = None; - let mut client_uri: Option = None; - let mut grant_types: Option< - Vec, - > = None; - let mut jwks_uri: Option = None; - let mut logo_uri: Option = None; - let mut policy_uri: Option = None; - let mut redirect_uris: Option> = None; - let mut response_types: Option< - Vec, - > = None; - let mut scope: Option = None; - let mut token_endpoint_auth_method: Option = None; - let mut tos_uri: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "client_name" => { - client_name = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "client_uri" => { - if v.is_null() { - continue; - } - client_uri = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "grant_types" => { - if v.is_null() { - continue; - } - grant_types = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "jwks_uri" => { - if v.is_null() { - continue; - } - jwks_uri = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "logo_uri" => { - if v.is_null() { - continue; - } - logo_uri = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "policy_uri" => { - if v.is_null() { - continue; - } - policy_uri = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "redirect_uris" => { - redirect_uris = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "response_types" => { - if v.is_null() { - continue; - } - response_types = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "scope" => { - if v.is_null() { - continue; - } - scope = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "token_endpoint_auth_method" => { - if v.is_null() { - continue; - } - token_endpoint_auth_method = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "tos_uri" => { - if v.is_null() { - continue; - } - tos_uri = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let client_name = - client_name.ok_or_else(|| M::Error::missing_field("client_name"))?; - let redirect_uris = - redirect_uris.ok_or_else(|| M::Error::missing_field("redirect_uris"))?; - - let content = OAuthClientRegistrationRequest { - client_name, - client_uri, - grant_types, - jwks_uri, - logo_uri, - policy_uri, - redirect_uris, - response_types, - scope, - token_endpoint_auth_method, - tos_uri, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(OAuthClientRegistrationRequestVisitor) - } -} diff --git a/src/datadogV2/model/model_o_auth_client_registration_response.rs b/src/datadogV2/model/model_o_auth_client_registration_response.rs deleted file mode 100644 index d395dff952..0000000000 --- a/src/datadogV2/model/model_o_auth_client_registration_response.rs +++ /dev/null @@ -1,163 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// Response payload for a successful OAuth2 dynamic client registration as defined by RFC 7591. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct OAuthClientRegistrationResponse { - /// Unique identifier assigned to the registered client. - #[serde(rename = "client_id")] - pub client_id: uuid::Uuid, - /// Human-readable name of the client. - #[serde(rename = "client_name")] - pub client_name: String, - /// OAuth 2.0 grant types registered for the client. - #[serde(rename = "grant_types")] - pub grant_types: Vec, - /// Redirection URIs registered for the client. - #[serde(rename = "redirect_uris")] - pub redirect_uris: Vec, - /// OAuth 2.0 response types registered for the client. - #[serde(rename = "response_types")] - pub response_types: Vec, - /// Authentication method registered for the token endpoint. Always `none`. - #[serde(rename = "token_endpoint_auth_method")] - pub token_endpoint_auth_method: String, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl OAuthClientRegistrationResponse { - pub fn new( - client_id: uuid::Uuid, - client_name: String, - grant_types: Vec, - redirect_uris: Vec, - response_types: Vec, - token_endpoint_auth_method: String, - ) -> OAuthClientRegistrationResponse { - OAuthClientRegistrationResponse { - client_id, - client_name, - grant_types, - redirect_uris, - response_types, - token_endpoint_auth_method, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for OAuthClientRegistrationResponse { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct OAuthClientRegistrationResponseVisitor; - impl<'a> Visitor<'a> for OAuthClientRegistrationResponseVisitor { - type Value = OAuthClientRegistrationResponse; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut client_id: Option = None; - let mut client_name: Option = None; - let mut grant_types: Option< - Vec, - > = None; - let mut redirect_uris: Option> = None; - let mut response_types: Option< - Vec, - > = None; - let mut token_endpoint_auth_method: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "client_id" => { - client_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "client_name" => { - client_name = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "grant_types" => { - grant_types = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "redirect_uris" => { - redirect_uris = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "response_types" => { - response_types = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "token_endpoint_auth_method" => { - token_endpoint_auth_method = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let client_id = client_id.ok_or_else(|| M::Error::missing_field("client_id"))?; - let client_name = - client_name.ok_or_else(|| M::Error::missing_field("client_name"))?; - let grant_types = - grant_types.ok_or_else(|| M::Error::missing_field("grant_types"))?; - let redirect_uris = - redirect_uris.ok_or_else(|| M::Error::missing_field("redirect_uris"))?; - let response_types = - response_types.ok_or_else(|| M::Error::missing_field("response_types"))?; - let token_endpoint_auth_method = token_endpoint_auth_method - .ok_or_else(|| M::Error::missing_field("token_endpoint_auth_method"))?; - - let content = OAuthClientRegistrationResponse { - client_id, - client_name, - grant_types, - redirect_uris, - response_types, - token_endpoint_auth_method, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(OAuthClientRegistrationResponseVisitor) - } -} diff --git a/src/datadogV2/model/model_o_auth_oidc_scope.rs b/src/datadogV2/model/model_o_auth_oidc_scope.rs deleted file mode 100644 index fa3316e31f..0000000000 --- a/src/datadogV2/model/model_o_auth_oidc_scope.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum OAuthOidcScope { - OPENID, - PROFILE, - EMAIL, - OFFLINE_ACCESS, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for OAuthOidcScope { - fn to_string(&self) -> String { - match self { - Self::OPENID => String::from("openid"), - Self::PROFILE => String::from("profile"), - Self::EMAIL => String::from("email"), - Self::OFFLINE_ACCESS => String::from("offline_access"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for OAuthOidcScope { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for OAuthOidcScope { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "openid" => Self::OPENID, - "profile" => Self::PROFILE, - "email" => Self::EMAIL, - "offline_access" => Self::OFFLINE_ACCESS, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_o_auth_scopes_restriction.rs b/src/datadogV2/model/model_o_auth_scopes_restriction.rs deleted file mode 100644 index 60a2a65447..0000000000 --- a/src/datadogV2/model/model_o_auth_scopes_restriction.rs +++ /dev/null @@ -1,109 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// Allowlist of OIDC and permission scopes enforced for the OAuth2 client. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct OAuthScopesRestriction { - /// OIDC scopes the client is restricted to. - #[serde(rename = "oidc_scopes")] - pub oidc_scopes: Vec, - /// Datadog permission scopes the client is restricted to. - #[serde(rename = "permission_scopes")] - pub permission_scopes: Vec, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl OAuthScopesRestriction { - pub fn new( - oidc_scopes: Vec, - permission_scopes: Vec, - ) -> OAuthScopesRestriction { - OAuthScopesRestriction { - oidc_scopes, - permission_scopes, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for OAuthScopesRestriction { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct OAuthScopesRestrictionVisitor; - impl<'a> Visitor<'a> for OAuthScopesRestrictionVisitor { - type Value = OAuthScopesRestriction; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut oidc_scopes: Option> = None; - let mut permission_scopes: Option> = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "oidc_scopes" => { - oidc_scopes = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "permission_scopes" => { - permission_scopes = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let oidc_scopes = - oidc_scopes.ok_or_else(|| M::Error::missing_field("oidc_scopes"))?; - let permission_scopes = permission_scopes - .ok_or_else(|| M::Error::missing_field("permission_scopes"))?; - - let content = OAuthScopesRestriction { - oidc_scopes, - permission_scopes, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(OAuthScopesRestrictionVisitor) - } -} diff --git a/src/datadogV2/model/model_o_auth_scopes_restriction_response_attributes.rs b/src/datadogV2/model/model_o_auth_scopes_restriction_response_attributes.rs deleted file mode 100644 index 39d8080818..0000000000 --- a/src/datadogV2/model/model_o_auth_scopes_restriction_response_attributes.rs +++ /dev/null @@ -1,114 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// Attributes of an OAuth2 client scopes restriction. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct OAuthScopesRestrictionResponseAttributes { - /// Permission scopes automatically required for this client (for example, mobile-app permission scopes). - /// Returns `null` when no scopes are required. - #[serialize_always] - #[serde(rename = "required_permission_scopes")] - pub required_permission_scopes: Option>, - /// Allowlist of OIDC and permission scopes enforced for the OAuth2 client. - #[serialize_always] - #[serde(rename = "scopes_restriction")] - pub scopes_restriction: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl OAuthScopesRestrictionResponseAttributes { - pub fn new( - required_permission_scopes: Option>, - scopes_restriction: Option, - ) -> OAuthScopesRestrictionResponseAttributes { - OAuthScopesRestrictionResponseAttributes { - required_permission_scopes, - scopes_restriction, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for OAuthScopesRestrictionResponseAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct OAuthScopesRestrictionResponseAttributesVisitor; - impl<'a> Visitor<'a> for OAuthScopesRestrictionResponseAttributesVisitor { - type Value = OAuthScopesRestrictionResponseAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut required_permission_scopes: Option>> = None; - let mut scopes_restriction: Option< - Option, - > = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "required_permission_scopes" => { - required_permission_scopes = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "scopes_restriction" => { - scopes_restriction = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let required_permission_scopes = required_permission_scopes - .ok_or_else(|| M::Error::missing_field("required_permission_scopes"))?; - let scopes_restriction = scopes_restriction - .ok_or_else(|| M::Error::missing_field("scopes_restriction"))?; - - let content = OAuthScopesRestrictionResponseAttributes { - required_permission_scopes, - scopes_restriction, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(OAuthScopesRestrictionResponseAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_observability_pipeline_config_destination_item.rs b/src/datadogV2/model/model_observability_pipeline_config_destination_item.rs index f0ee7f0f85..b8f3455016 100644 --- a/src/datadogV2/model/model_observability_pipeline_config_destination_item.rs +++ b/src/datadogV2/model/model_observability_pipeline_config_destination_item.rs @@ -79,6 +79,9 @@ pub enum ObservabilityPipelineConfigDestinationItem { ObservabilityPipelineDatadogMetricsDestination( Box, ), + ObservabilityPipelineSplunkHecMetricsDestination( + Box, + ), UnparsedObject(crate::datadog::UnparsedObject), } @@ -290,6 +293,14 @@ impl<'de> Deserialize<'de> for ObservabilityPipelineConfigDestinationItem { return Ok(ObservabilityPipelineConfigDestinationItem::ObservabilityPipelineDatadogMetricsDestination(_v)); } } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(ObservabilityPipelineConfigDestinationItem::ObservabilityPipelineSplunkHecMetricsDestination(_v)); + } + } return Ok(ObservabilityPipelineConfigDestinationItem::UnparsedObject( crate::datadog::UnparsedObject { value }, diff --git a/src/datadogV2/model/model_observability_pipeline_splunk_hec_metrics_destination.rs b/src/datadogV2/model/model_observability_pipeline_splunk_hec_metrics_destination.rs new file mode 100644 index 0000000000..b976fb44d9 --- /dev/null +++ b/src/datadogV2/model/model_observability_pipeline_splunk_hec_metrics_destination.rs @@ -0,0 +1,310 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The `splunk_hec_metrics` destination forwards metrics to Splunk using the HTTP Event Collector (HEC). +/// +/// **Supported pipeline types:** metrics +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct ObservabilityPipelineSplunkHecMetricsDestination { + /// Configuration for buffer settings on destination components. + #[serde(rename = "buffer")] + pub buffer: Option, + /// Compression algorithm applied when sending metrics to Splunk HEC. + #[serde(rename = "compression")] + pub compression: Option< + crate::datadogV2::model::ObservabilityPipelineSplunkHecMetricsDestinationCompression, + >, + /// Optional default namespace for metrics sent to Splunk HEC. + #[serde(rename = "default_namespace")] + pub default_namespace: Option, + /// Name of the environment variable or secret that holds the Splunk HEC endpoint URL. + #[serde(rename = "endpoint_url_key")] + pub endpoint_url_key: Option, + /// The unique identifier for this component. Used in other parts of the pipeline to reference this component (for example, as the `input` to downstream components). + #[serde(rename = "id")] + pub id: String, + /// Optional name of the Splunk index where metrics are written. + #[serde(rename = "index")] + pub index: Option, + /// A list of component IDs whose output is used as the `input` for this component. + #[serde(rename = "inputs")] + pub inputs: Vec, + /// The Splunk source field value for metric events. + #[serde(rename = "source")] + pub source: Option, + /// The Splunk sourcetype to assign to metric events. + #[serde(rename = "sourcetype")] + pub sourcetype: Option, + /// Configuration for enabling TLS encryption between the pipeline component and external services. + #[serde(rename = "tls")] + pub tls: Option, + /// Name of the environment variable or secret that holds the Splunk HEC token. + #[serde(rename = "token_key")] + pub token_key: Option, + /// The destination type. Always `splunk_hec_metrics`. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::ObservabilityPipelineSplunkHecMetricsDestinationType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl ObservabilityPipelineSplunkHecMetricsDestination { + pub fn new( + id: String, + inputs: Vec, + type_: crate::datadogV2::model::ObservabilityPipelineSplunkHecMetricsDestinationType, + ) -> ObservabilityPipelineSplunkHecMetricsDestination { + ObservabilityPipelineSplunkHecMetricsDestination { + buffer: None, + compression: None, + default_namespace: None, + endpoint_url_key: None, + id, + index: None, + inputs, + source: None, + sourcetype: None, + tls: None, + token_key: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn buffer( + mut self, + value: crate::datadogV2::model::ObservabilityPipelineBufferOptions, + ) -> Self { + self.buffer = Some(value); + self + } + + pub fn compression( + mut self, + value: crate::datadogV2::model::ObservabilityPipelineSplunkHecMetricsDestinationCompression, + ) -> Self { + self.compression = Some(value); + self + } + + pub fn default_namespace(mut self, value: String) -> Self { + self.default_namespace = Some(value); + self + } + + pub fn endpoint_url_key(mut self, value: String) -> Self { + self.endpoint_url_key = Some(value); + self + } + + pub fn index(mut self, value: String) -> Self { + self.index = Some(value); + self + } + + pub fn source(mut self, value: String) -> Self { + self.source = Some(value); + self + } + + pub fn sourcetype(mut self, value: String) -> Self { + self.sourcetype = Some(value); + self + } + + pub fn tls(mut self, value: crate::datadogV2::model::ObservabilityPipelineTls) -> Self { + self.tls = Some(value); + self + } + + pub fn token_key(mut self, value: String) -> Self { + self.token_key = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for ObservabilityPipelineSplunkHecMetricsDestination { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct ObservabilityPipelineSplunkHecMetricsDestinationVisitor; + impl<'a> Visitor<'a> for ObservabilityPipelineSplunkHecMetricsDestinationVisitor { + type Value = ObservabilityPipelineSplunkHecMetricsDestination; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut buffer: Option< + crate::datadogV2::model::ObservabilityPipelineBufferOptions, + > = None; + let mut compression: Option = None; + let mut default_namespace: Option = None; + let mut endpoint_url_key: Option = None; + let mut id: Option = None; + let mut index: Option = None; + let mut inputs: Option> = None; + let mut source: Option = None; + let mut sourcetype: Option = None; + let mut tls: Option = None; + let mut token_key: Option = None; + let mut type_: Option< + crate::datadogV2::model::ObservabilityPipelineSplunkHecMetricsDestinationType, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "buffer" => { + if v.is_null() { + continue; + } + buffer = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _buffer) = buffer { + match _buffer { + crate::datadogV2::model::ObservabilityPipelineBufferOptions::UnparsedObject(_buffer) => { + _unparsed = true; + }, + _ => {} + } + } + } + "compression" => { + if v.is_null() { + continue; + } + compression = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _compression) = compression { + match _compression { + crate::datadogV2::model::ObservabilityPipelineSplunkHecMetricsDestinationCompression::UnparsedObject(_compression) => { + _unparsed = true; + }, + _ => {} + } + } + } + "default_namespace" => { + if v.is_null() { + continue; + } + default_namespace = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "endpoint_url_key" => { + if v.is_null() { + continue; + } + endpoint_url_key = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "index" => { + if v.is_null() { + continue; + } + index = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "inputs" => { + inputs = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "source" => { + if v.is_null() { + continue; + } + source = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "sourcetype" => { + if v.is_null() { + continue; + } + sourcetype = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tls" => { + if v.is_null() { + continue; + } + tls = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "token_key" => { + if v.is_null() { + continue; + } + token_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::ObservabilityPipelineSplunkHecMetricsDestinationType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let inputs = inputs.ok_or_else(|| M::Error::missing_field("inputs"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = ObservabilityPipelineSplunkHecMetricsDestination { + buffer, + compression, + default_namespace, + endpoint_url_key, + id, + index, + inputs, + source, + sourcetype, + tls, + token_key, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(ObservabilityPipelineSplunkHecMetricsDestinationVisitor) + } +} diff --git a/src/datadogV2/model/model_upsert_o_auth_scopes_restriction_type.rs b/src/datadogV2/model/model_observability_pipeline_splunk_hec_metrics_destination_compression.rs similarity index 70% rename from src/datadogV2/model/model_upsert_o_auth_scopes_restriction_type.rs rename to src/datadogV2/model/model_observability_pipeline_splunk_hec_metrics_destination_compression.rs index 3c2ac0a4b3..8493bb03c3 100644 --- a/src/datadogV2/model/model_upsert_o_auth_scopes_restriction_type.rs +++ b/src/datadogV2/model/model_observability_pipeline_splunk_hec_metrics_destination_compression.rs @@ -6,21 +6,23 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[non_exhaustive] #[derive(Clone, Debug, Eq, PartialEq)] -pub enum UpsertOAuthScopesRestrictionType { - UPSERT_SCOPES_RESTRICTION, +pub enum ObservabilityPipelineSplunkHecMetricsDestinationCompression { + NONE, + GZIP, UnparsedObject(crate::datadog::UnparsedObject), } -impl ToString for UpsertOAuthScopesRestrictionType { +impl ToString for ObservabilityPipelineSplunkHecMetricsDestinationCompression { fn to_string(&self) -> String { match self { - Self::UPSERT_SCOPES_RESTRICTION => String::from("upsert_scopes_restriction"), + Self::NONE => String::from("none"), + Self::GZIP => String::from("gzip"), Self::UnparsedObject(v) => v.value.to_string(), } } } -impl Serialize for UpsertOAuthScopesRestrictionType { +impl Serialize for ObservabilityPipelineSplunkHecMetricsDestinationCompression { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -32,14 +34,15 @@ impl Serialize for UpsertOAuthScopesRestrictionType { } } -impl<'de> Deserialize<'de> for UpsertOAuthScopesRestrictionType { +impl<'de> Deserialize<'de> for ObservabilityPipelineSplunkHecMetricsDestinationCompression { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>, { let s: String = String::deserialize(deserializer)?; Ok(match s.as_str() { - "upsert_scopes_restriction" => Self::UPSERT_SCOPES_RESTRICTION, + "none" => Self::NONE, + "gzip" => Self::GZIP, _ => Self::UnparsedObject(crate::datadog::UnparsedObject { value: serde_json::Value::String(s.into()), }), diff --git a/src/datadogV2/model/model_o_auth_scopes_restriction_type.rs b/src/datadogV2/model/model_observability_pipeline_splunk_hec_metrics_destination_type.rs similarity index 72% rename from src/datadogV2/model/model_o_auth_scopes_restriction_type.rs rename to src/datadogV2/model/model_observability_pipeline_splunk_hec_metrics_destination_type.rs index 7ddf0715b2..35d8053346 100644 --- a/src/datadogV2/model/model_o_auth_scopes_restriction_type.rs +++ b/src/datadogV2/model/model_observability_pipeline_splunk_hec_metrics_destination_type.rs @@ -6,21 +6,21 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[non_exhaustive] #[derive(Clone, Debug, Eq, PartialEq)] -pub enum OAuthScopesRestrictionType { - SCOPES_RESTRICTION, +pub enum ObservabilityPipelineSplunkHecMetricsDestinationType { + SPLUNK_HEC_METRICS, UnparsedObject(crate::datadog::UnparsedObject), } -impl ToString for OAuthScopesRestrictionType { +impl ToString for ObservabilityPipelineSplunkHecMetricsDestinationType { fn to_string(&self) -> String { match self { - Self::SCOPES_RESTRICTION => String::from("scopes_restriction"), + Self::SPLUNK_HEC_METRICS => String::from("splunk_hec_metrics"), Self::UnparsedObject(v) => v.value.to_string(), } } } -impl Serialize for OAuthScopesRestrictionType { +impl Serialize for ObservabilityPipelineSplunkHecMetricsDestinationType { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -32,14 +32,14 @@ impl Serialize for OAuthScopesRestrictionType { } } -impl<'de> Deserialize<'de> for OAuthScopesRestrictionType { +impl<'de> Deserialize<'de> for ObservabilityPipelineSplunkHecMetricsDestinationType { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>, { let s: String = String::deserialize(deserializer)?; Ok(match s.as_str() { - "scopes_restriction" => Self::SCOPES_RESTRICTION, + "splunk_hec_metrics" => Self::SPLUNK_HEC_METRICS, _ => Self::UnparsedObject(crate::datadog::UnparsedObject { value: serde_json::Value::String(s.into()), }), diff --git a/src/datadogV2/model/model_upsert_o_auth_scopes_restriction_data.rs b/src/datadogV2/model/model_upsert_o_auth_scopes_restriction_data.rs deleted file mode 100644 index b1b309d567..0000000000 --- a/src/datadogV2/model/model_upsert_o_auth_scopes_restriction_data.rs +++ /dev/null @@ -1,125 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// Data object of an upsert OAuth2 scopes restriction request. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct UpsertOAuthScopesRestrictionData { - /// Attributes of an upsert OAuth2 scopes restriction request. - #[serde(rename = "attributes")] - pub attributes: Option, - /// JSON:API resource type for an upsert OAuth2 client scopes restriction request. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::UpsertOAuthScopesRestrictionType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl UpsertOAuthScopesRestrictionData { - pub fn new( - type_: crate::datadogV2::model::UpsertOAuthScopesRestrictionType, - ) -> UpsertOAuthScopesRestrictionData { - UpsertOAuthScopesRestrictionData { - attributes: None, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn attributes( - mut self, - value: crate::datadogV2::model::UpsertOAuthScopesRestrictionDataAttributes, - ) -> Self { - self.attributes = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for UpsertOAuthScopesRestrictionData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct UpsertOAuthScopesRestrictionDataVisitor; - impl<'a> Visitor<'a> for UpsertOAuthScopesRestrictionDataVisitor { - type Value = UpsertOAuthScopesRestrictionData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option< - crate::datadogV2::model::UpsertOAuthScopesRestrictionDataAttributes, - > = None; - let mut type_: Option = - None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - if v.is_null() { - continue; - } - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::UpsertOAuthScopesRestrictionType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = UpsertOAuthScopesRestrictionData { - attributes, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(UpsertOAuthScopesRestrictionDataVisitor) - } -} diff --git a/src/datadogV2/model/model_upsert_o_auth_scopes_restriction_data_attributes.rs b/src/datadogV2/model/model_upsert_o_auth_scopes_restriction_data_attributes.rs deleted file mode 100644 index 2e26ce93f3..0000000000 --- a/src/datadogV2/model/model_upsert_o_auth_scopes_restriction_data_attributes.rs +++ /dev/null @@ -1,125 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// Attributes of an upsert OAuth2 scopes restriction request. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct UpsertOAuthScopesRestrictionDataAttributes { - /// OIDC scopes the client is allowed to request. - #[serde(rename = "oidc_scopes")] - pub oidc_scopes: Option>, - /// Datadog permission scopes the client is allowed to request. - /// Each value must be a valid permission name. - #[serde(rename = "permission_scopes")] - pub permission_scopes: Option>, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl UpsertOAuthScopesRestrictionDataAttributes { - pub fn new() -> UpsertOAuthScopesRestrictionDataAttributes { - UpsertOAuthScopesRestrictionDataAttributes { - oidc_scopes: None, - permission_scopes: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn oidc_scopes(mut self, value: Vec) -> Self { - self.oidc_scopes = Some(value); - self - } - - pub fn permission_scopes(mut self, value: Vec) -> Self { - self.permission_scopes = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for UpsertOAuthScopesRestrictionDataAttributes { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for UpsertOAuthScopesRestrictionDataAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct UpsertOAuthScopesRestrictionDataAttributesVisitor; - impl<'a> Visitor<'a> for UpsertOAuthScopesRestrictionDataAttributesVisitor { - type Value = UpsertOAuthScopesRestrictionDataAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut oidc_scopes: Option> = None; - let mut permission_scopes: Option> = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "oidc_scopes" => { - if v.is_null() { - continue; - } - oidc_scopes = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "permission_scopes" => { - if v.is_null() { - continue; - } - permission_scopes = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = UpsertOAuthScopesRestrictionDataAttributes { - oidc_scopes, - permission_scopes, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(UpsertOAuthScopesRestrictionDataAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_upsert_o_auth_scopes_restriction_request.rs b/src/datadogV2/model/model_upsert_o_auth_scopes_restriction_request.rs deleted file mode 100644 index 36fe7710b1..0000000000 --- a/src/datadogV2/model/model_upsert_o_auth_scopes_restriction_request.rs +++ /dev/null @@ -1,95 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// Request payload for creating or updating the scopes restriction of an OAuth2 client. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct UpsertOAuthScopesRestrictionRequest { - /// Data object of an upsert OAuth2 scopes restriction request. - #[serde(rename = "data")] - pub data: crate::datadogV2::model::UpsertOAuthScopesRestrictionData, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl UpsertOAuthScopesRestrictionRequest { - pub fn new( - data: crate::datadogV2::model::UpsertOAuthScopesRestrictionData, - ) -> UpsertOAuthScopesRestrictionRequest { - UpsertOAuthScopesRestrictionRequest { - data, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for UpsertOAuthScopesRestrictionRequest { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct UpsertOAuthScopesRestrictionRequestVisitor; - impl<'a> Visitor<'a> for UpsertOAuthScopesRestrictionRequestVisitor { - type Value = UpsertOAuthScopesRestrictionRequest; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option = - None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let data = data.ok_or_else(|| M::Error::missing_field("data"))?; - - let content = UpsertOAuthScopesRestrictionRequest { - data, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(UpsertOAuthScopesRestrictionRequestVisitor) - } -} diff --git a/tests/scenarios/features/v2/cloud_cost_management.feature b/tests/scenarios/features/v2/cloud_cost_management.feature index 17779e4599..b41928f4cb 100644 --- a/tests/scenarios/features/v2/cloud_cost_management.feature +++ b/tests/scenarios/features/v2/cloud_cost_management.feature @@ -606,6 +606,22 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-cost-management + Scenario: List Cloud Cost Management tag metadata months returns "Bad Request" response + Given operation "ListCostTagMetadataMonths" enabled + And new "ListCostTagMetadataMonths" request + And request contains "filter[provider]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/cloud-cost-management + Scenario: List Cloud Cost Management tag metadata months returns "OK" response + Given operation "ListCostTagMetadataMonths" enabled + And new "ListCostTagMetadataMonths" request + And request contains "filter[provider]" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/cloud-cost-management Scenario: List Cloud Cost Management tag sources returns "Bad Request" response Given operation "ListCostTagKeySources" enabled diff --git a/tests/scenarios/features/v2/oauth2_client_public.feature b/tests/scenarios/features/v2/oauth2_client_public.feature deleted file mode 100644 index a5c7d195ef..0000000000 --- a/tests/scenarios/features/v2/oauth2_client_public.feature +++ /dev/null @@ -1,100 +0,0 @@ -@endpoint(oauth2-client-public) @endpoint(oauth2-client-public-v2) -Feature: OAuth2 Client Public - Configure OAuth2 clients for Datadog. Supports RFC 7591 Dynamic Client - Registration and management of OAuth2 client scopes restrictions. - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "OAuth2ClientPublic" API - - @generated @skip @team:DataDog/delegated-auth-login - Scenario: Delete an OAuth2 client scopes restriction returns "Bad Request" response - Given operation "DeleteScopesRestriction" enabled - And new "DeleteScopesRestriction" request - And request contains "client_uuid" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/delegated-auth-login - Scenario: Delete an OAuth2 client scopes restriction returns "No Content" response - Given operation "DeleteScopesRestriction" enabled - And new "DeleteScopesRestriction" request - And request contains "client_uuid" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 204 No Content - - @generated @skip @team:DataDog/delegated-auth-login - Scenario: Delete an OAuth2 client scopes restriction returns "Not Found" response - Given operation "DeleteScopesRestriction" enabled - And new "DeleteScopesRestriction" request - And request contains "client_uuid" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/delegated-auth-login - Scenario: Get an OAuth2 client scopes restriction returns "Bad Request" response - Given operation "GetScopesRestriction" enabled - And new "GetScopesRestriction" request - And request contains "client_uuid" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/delegated-auth-login - Scenario: Get an OAuth2 client scopes restriction returns "Not Found" response - Given operation "GetScopesRestriction" enabled - And new "GetScopesRestriction" request - And request contains "client_uuid" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/delegated-auth-login - Scenario: Get an OAuth2 client scopes restriction returns "OK" response - Given operation "GetScopesRestriction" enabled - And new "GetScopesRestriction" request - And request contains "client_uuid" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:DataDog/delegated-auth-login - Scenario: Register an OAuth2 client returns "Bad Request" response - Given operation "RegisterOAuthClient" enabled - And new "RegisterOAuthClient" request - And body with value {"client_name": "Example MCP Client", "client_uri": "https://example.com", "grant_types": ["authorization_code", "refresh_token"], "jwks_uri": "https://example.com/.well-known/jwks.json", "logo_uri": "https://example.com/logo.png", "policy_uri": "https://example.com/privacy", "redirect_uris": ["https://example.com/oauth/callback"], "response_types": ["code"], "scope": "openid profile", "token_endpoint_auth_method": "none", "tos_uri": "https://example.com/tos"} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/delegated-auth-login - Scenario: Register an OAuth2 client returns "Created" response - Given operation "RegisterOAuthClient" enabled - And new "RegisterOAuthClient" request - And body with value {"client_name": "Example MCP Client", "client_uri": "https://example.com", "grant_types": ["authorization_code", "refresh_token"], "jwks_uri": "https://example.com/.well-known/jwks.json", "logo_uri": "https://example.com/logo.png", "policy_uri": "https://example.com/privacy", "redirect_uris": ["https://example.com/oauth/callback"], "response_types": ["code"], "scope": "openid profile", "token_endpoint_auth_method": "none", "tos_uri": "https://example.com/tos"} - When the request is sent - Then the response status is 201 Created - - @generated @skip @team:DataDog/delegated-auth-login - Scenario: Upsert an OAuth2 client scopes restriction returns "Bad Request" response - Given operation "UpsertScopesRestriction" enabled - And new "UpsertScopesRestriction" request - And request contains "client_uuid" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"oidc_scopes": ["openid", "email"], "permission_scopes": ["dashboards_read", "metrics_read"]}, "type": "upsert_scopes_restriction"}} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/delegated-auth-login - Scenario: Upsert an OAuth2 client scopes restriction returns "Not Found" response - Given operation "UpsertScopesRestriction" enabled - And new "UpsertScopesRestriction" request - And request contains "client_uuid" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"oidc_scopes": ["openid", "email"], "permission_scopes": ["dashboards_read", "metrics_read"]}, "type": "upsert_scopes_restriction"}} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/delegated-auth-login - Scenario: Upsert an OAuth2 client scopes restriction returns "OK" response - Given operation "UpsertScopesRestriction" enabled - And new "UpsertScopesRestriction" request - And request contains "client_uuid" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"oidc_scopes": ["openid", "email"], "permission_scopes": ["dashboards_read", "metrics_read"]}, "type": "upsert_scopes_restriction"}} - When the request is sent - Then the response status is 200 OK diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index b55e20fd7e..09d6acff28 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -1898,6 +1898,12 @@ "type": "safe" } }, + "ListCostTagMetadataMonths": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, "ListCostTagMetadataOrchestrators": { "tag": "Cloud Cost Management", "undo": { @@ -4666,30 +4672,6 @@ "type": "safe" } }, - "DeleteScopesRestriction": { - "tag": "OAuth2 Client Public", - "undo": { - "type": "idempotent" - } - }, - "GetScopesRestriction": { - "tag": "OAuth2 Client Public", - "undo": { - "type": "safe" - } - }, - "UpsertScopesRestriction": { - "tag": "OAuth2 Client Public", - "undo": { - "type": "idempotent" - } - }, - "RegisterOAuthClient": { - "tag": "OAuth2 Client Public", - "undo": { - "type": "idempotent" - } - }, "ListPipelines": { "tag": "Observability Pipelines", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index f35ab1b758..086cd188c0 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -145,8 +145,6 @@ pub struct ApiInstances { Option, pub v2_api_cloud_network_monitoring: Option, - pub v2_api_o_auth2_client_public: - Option, pub v2_api_observability_pipelines: Option, pub v2_api_on_call: Option, @@ -979,14 +977,6 @@ pub fn initialize_api_instance(world: &mut DatadogWorld, api: String) { world.http_client.as_ref().unwrap().clone() )); } - "OAuth2ClientPublic" => { - world.api_instances.v2_api_o_auth2_client_public = Some( - datadogV2::api_o_auth2_client_public::OAuth2ClientPublicAPI::with_client_and_config( - world.config.clone(), - world.http_client.as_ref().unwrap().clone(), - ), - ); - } "ObservabilityPipelines" => { world.api_instances.v2_api_observability_pipelines = Some(datadogV2::api_observability_pipelines::ObservabilityPipelinesAPI::with_client_and_config( world.config.clone(), @@ -3896,6 +3886,10 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { "v2.ListCostTagMetadataMetrics".into(), test_v2_list_cost_tag_metadata_metrics, ); + world.function_mappings.insert( + "v2.ListCostTagMetadataMonths".into(), + test_v2_list_cost_tag_metadata_months, + ); world.function_mappings.insert( "v2.ListCostTagMetadataOrchestrators".into(), test_v2_list_cost_tag_metadata_orchestrators, @@ -5268,22 +5262,6 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { world .function_mappings .insert("v2.GetAggregatedDns".into(), test_v2_get_aggregated_dns); - world.function_mappings.insert( - "v2.DeleteScopesRestriction".into(), - test_v2_delete_scopes_restriction, - ); - world.function_mappings.insert( - "v2.GetScopesRestriction".into(), - test_v2_get_scopes_restriction, - ); - world.function_mappings.insert( - "v2.UpsertScopesRestriction".into(), - test_v2_upsert_scopes_restriction, - ); - world.function_mappings.insert( - "v2.RegisterOAuthClient".into(), - test_v2_register_o_auth_client, - ); world .function_mappings .insert("v2.ListPipelines".into(), test_v2_list_pipelines); @@ -29706,6 +29684,36 @@ fn test_v2_list_cost_tag_metadata_metrics( world.response.code = response.status.as_u16(); } +fn test_v2_list_cost_tag_metadata_months( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_cloud_cost_management + .as_ref() + .expect("api instance not found"); + let filter_provider = + serde_json::from_value(_parameters.get("filter[provider]").unwrap().clone()).unwrap(); + let response = match block_on(api.list_cost_tag_metadata_months_with_http_info(filter_provider)) + { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_list_cost_tag_metadata_orchestrators( world: &mut DatadogWorld, _parameters: &HashMap, @@ -41162,116 +41170,6 @@ fn test_v2_get_aggregated_dns(world: &mut DatadogWorld, _parameters: &HashMap, -) { - let api = world - .api_instances - .v2_api_o_auth2_client_public - .as_ref() - .expect("api instance not found"); - let client_uuid = - serde_json::from_value(_parameters.get("client_uuid").unwrap().clone()).unwrap(); - let response = match block_on(api.delete_scopes_restriction_with_http_info(client_uuid)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - -fn test_v2_get_scopes_restriction(world: &mut DatadogWorld, _parameters: &HashMap) { - let api = world - .api_instances - .v2_api_o_auth2_client_public - .as_ref() - .expect("api instance not found"); - let client_uuid = - serde_json::from_value(_parameters.get("client_uuid").unwrap().clone()).unwrap(); - let response = match block_on(api.get_scopes_restriction_with_http_info(client_uuid)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - -fn test_v2_upsert_scopes_restriction( - world: &mut DatadogWorld, - _parameters: &HashMap, -) { - let api = world - .api_instances - .v2_api_o_auth2_client_public - .as_ref() - .expect("api instance not found"); - let client_uuid = - serde_json::from_value(_parameters.get("client_uuid").unwrap().clone()).unwrap(); - let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); - let response = match block_on(api.upsert_scopes_restriction_with_http_info(client_uuid, body)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - -fn test_v2_register_o_auth_client(world: &mut DatadogWorld, _parameters: &HashMap) { - let api = world - .api_instances - .v2_api_o_auth2_client_public - .as_ref() - .expect("api instance not found"); - let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); - let response = match block_on(api.register_o_auth_client_with_http_info(body)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - fn test_v2_list_pipelines(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances