diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4b6dc560f..838214385 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -347,6 +347,14 @@ components: required: true schema: type: string + DashboardIDPathParameter: + description: The ID of the dashboard. + example: "abc-def-ghi" + in: path + name: dashboard_id + required: true + schema: + type: string DatasetID: description: The ID of a defined dataset. example: "0879ce27-29a1-481f-a12e-bc2a48ec9ae1" @@ -1151,6 +1159,14 @@ components: items: $ref: "#/components/schemas/SearchIssuesIncludeQueryParameterItem" type: array + SecureEmbedTokenPathParameter: + description: The share token identifying the secure embed. + example: "s3cur3t0k3n-abcdef123456" + in: path + name: token + required: true + schema: + type: string SecurityFilterID: description: The ID of the security filter. in: path @@ -46179,7 +46195,7 @@ components: $ref: "#/components/schemas/ObservabilityPipelineParseGrokProcessorRuleMatchRule" type: array source: - description: The value of the source field in log events to be processed by the Grok rules. + description: The name of the field in the log event to apply the Grok rules to. example: "message" type: string support_rules: @@ -57993,6 +58009,469 @@ components: type: string x-enum-varnames: - SECRET_RULE + SecureEmbedCreateRequest: + description: Request to create a secure embed shared dashboard. + properties: + data: + $ref: "#/components/schemas/SecureEmbedCreateRequestData" + required: + - data + type: object + SecureEmbedCreateRequestAttributes: + description: Attributes for creating a secure embed shared dashboard. + properties: + global_time: + $ref: "#/components/schemas/SecureEmbedGlobalTime" + global_time_selectable: + description: Whether viewers can change the time range. + example: true + type: boolean + selectable_template_vars: + description: Template variables viewers can modify. + items: + $ref: "#/components/schemas/SecureEmbedSelectableTemplateVariable" + type: array + status: + $ref: "#/components/schemas/SecureEmbedStatus" + title: + description: Display title for the shared dashboard. + example: "Q1 Metrics Dashboard" + type: string + viewing_preferences: + $ref: "#/components/schemas/SecureEmbedViewingPreferences" + required: + - status + - title + - global_time_selectable + - selectable_template_vars + - viewing_preferences + - global_time + type: object + SecureEmbedCreateRequestData: + description: Data object for creating a secure embed. + properties: + attributes: + $ref: "#/components/schemas/SecureEmbedCreateRequestAttributes" + type: + $ref: "#/components/schemas/SecureEmbedRequestType" + required: + - type + - attributes + type: object + SecureEmbedCreateResponse: + description: Response for creating a secure embed shared dashboard. + properties: + data: + $ref: "#/components/schemas/SecureEmbedCreateResponseData" + required: + - data + type: object + SecureEmbedCreateResponseAttributes: + description: Attributes of a newly created secure embed shared dashboard. + properties: + created_at: + description: Creation timestamp. + example: "2026-03-11T18:30:00.000000" + readOnly: true + type: string + credential: + description: >- + The secret credential used for HMAC signing. Returned only on creation. Store securely — it cannot be retrieved again. + example: "A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6Q7r8S9t0U1v2" + readOnly: true + type: string + dashboard_id: + description: The source dashboard ID. + example: "abc-def-ghi" + readOnly: true + type: string + global_time: + $ref: "#/components/schemas/SecureEmbedGlobalTime" + global_time_selectable: + description: Whether time range is viewer-selectable. + example: true + type: boolean + id: + description: Internal share ID. + example: "12345" + readOnly: true + type: string + selectable_template_vars: + description: Template variables with their configuration. + items: + $ref: "#/components/schemas/SecureEmbedSelectableTemplateVariable" + type: array + share_type: + $ref: "#/components/schemas/SecureEmbedShareType" + status: + $ref: "#/components/schemas/SecureEmbedStatus" + title: + description: Display title. + example: "Q1 Metrics Dashboard" + type: string + token: + description: Public share token. + example: "s3cur3t0k3n-abcdef123456" + readOnly: true + type: string + url: + description: CDN URL for the shared dashboard. + example: "https://p.datadoghq.com/sb/secure-embed/s3cur3t0k3n-abcdef123456" + readOnly: true + type: string + viewing_preferences: + $ref: "#/components/schemas/SecureEmbedViewingPreferences" + type: object + SecureEmbedCreateResponseData: + description: Data object for a secure embed create response. + properties: + attributes: + $ref: "#/components/schemas/SecureEmbedCreateResponseAttributes" + id: + description: Internal share ID. + example: "12345" + type: string + type: + $ref: "#/components/schemas/SecureEmbedCreateResponseType" + required: + - type + - id + - attributes + type: object + SecureEmbedCreateResponseType: + description: Resource type for secure embed create responses. + enum: + - secure_embed_create_response + example: "secure_embed_create_response" + type: string + x-enum-varnames: + - SECURE_EMBED_CREATE_RESPONSE + SecureEmbedGetResponse: + description: Response for getting a secure embed shared dashboard. + properties: + data: + $ref: "#/components/schemas/SecureEmbedGetResponseData" + required: + - data + type: object + SecureEmbedGetResponseAttributes: + description: Attributes of an existing secure embed shared dashboard. + properties: + created_at: + description: Creation timestamp. + example: "2026-03-11T18:30:00.000000" + readOnly: true + type: string + credential_suffix: + description: Last 4 characters of the credential. Defaults to `0000` if unavailable. + example: "ab3f" + readOnly: true + type: string + dashboard_id: + description: The source dashboard ID. + example: "abc-def-ghi" + readOnly: true + type: string + global_time: + $ref: "#/components/schemas/SecureEmbedGlobalTime" + global_time_selectable: + description: Whether time range is viewer-selectable. + example: true + type: boolean + id: + description: Internal share ID. + example: "12345" + readOnly: true + type: string + selectable_template_vars: + description: Template variables with their configuration. + items: + $ref: "#/components/schemas/SecureEmbedSelectableTemplateVariable" + type: array + share_type: + $ref: "#/components/schemas/SecureEmbedShareType" + status: + $ref: "#/components/schemas/SecureEmbedStatus" + title: + description: Display title. + example: "Q1 Metrics Dashboard" + type: string + token: + description: Public share token. + example: "s3cur3t0k3n-abcdef123456" + readOnly: true + type: string + url: + description: CDN URL for the shared dashboard. + example: "https://p.datadoghq.com/sb/secure-embed/s3cur3t0k3n-abcdef123456" + readOnly: true + type: string + viewing_preferences: + $ref: "#/components/schemas/SecureEmbedViewingPreferences" + type: object + SecureEmbedGetResponseData: + description: Data object for a secure embed get response. + properties: + attributes: + $ref: "#/components/schemas/SecureEmbedGetResponseAttributes" + id: + description: Internal share ID. + example: "12345" + type: string + type: + $ref: "#/components/schemas/SecureEmbedGetResponseType" + required: + - type + - id + - attributes + type: object + SecureEmbedGetResponseType: + description: Resource type for secure embed get responses. + enum: + - secure_embed_get_response + example: "secure_embed_get_response" + type: string + x-enum-varnames: + - SECURE_EMBED_GET_RESPONSE + SecureEmbedGlobalTime: + description: Default time range configuration for the secure embed. + properties: + live_span: + $ref: "#/components/schemas/SecureEmbedGlobalTimeLiveSpan" + type: object + SecureEmbedGlobalTimeLiveSpan: + description: Dashboard global time live_span selection. + enum: + - 15m + - 1h + - 4h + - 1d + - 2d + - 1w + - 1mo + - 3mo + example: "1h" + type: string + x-enum-varnames: + - PAST_FIFTEEN_MINUTES + - PAST_ONE_HOUR + - PAST_FOUR_HOURS + - PAST_ONE_DAY + - PAST_TWO_DAYS + - PAST_ONE_WEEK + - PAST_ONE_MONTH + - PAST_THREE_MONTHS + SecureEmbedRequestType: + description: Resource type for secure embed create requests. + enum: + - secure_embed_request + example: "secure_embed_request" + type: string + x-enum-varnames: + - SECURE_EMBED_REQUEST + SecureEmbedSelectableTemplateVariable: + description: A template variable that viewers can modify on the secure embed shared dashboard. + properties: + default_values: + description: Default selected values for the variable. + example: ["1"] + items: + description: A default value for the template variable. + type: string + type: array + name: + description: Name of the template variable. Usually matches the prefix unless you want a different display name. + example: "org_id" + type: string + prefix: + description: Tag prefix for the variable (e.g., `environment`, `service`). + example: "org_id" + type: string + visible_tags: + description: Restrict which tag values are visible to the viewer. + example: ["1"] + items: + description: A visible tag value for the template variable. + type: string + type: array + type: object + SecureEmbedShareType: + description: The type of share. Always `secure_embed`. + enum: + - secure_embed + example: "secure_embed" + type: string + x-enum-varnames: + - SECURE_EMBED + SecureEmbedStatus: + description: The status of the secure embed share. Active means the shared dashboard is available. Paused means it is not. + enum: + - active + - paused + example: "active" + type: string + x-enum-varnames: + - ACTIVE + - PAUSED + SecureEmbedUpdateRequest: + description: Request to update a secure embed shared dashboard. + properties: + data: + $ref: "#/components/schemas/SecureEmbedUpdateRequestData" + required: + - data + type: object + SecureEmbedUpdateRequestAttributes: + description: Attributes for updating a secure embed shared dashboard. All fields are optional. + properties: + global_time: + $ref: "#/components/schemas/SecureEmbedGlobalTime" + global_time_selectable: + description: Updated time selectability. + example: true + type: boolean + selectable_template_vars: + description: Updated template variables. + items: + $ref: "#/components/schemas/SecureEmbedSelectableTemplateVariable" + type: array + status: + $ref: "#/components/schemas/SecureEmbedStatus" + title: + description: Updated title. + example: "Q1 Metrics Dashboard (Updated)" + type: string + viewing_preferences: + $ref: "#/components/schemas/SecureEmbedViewingPreferences" + type: object + SecureEmbedUpdateRequestData: + description: Data object for updating a secure embed. + properties: + attributes: + $ref: "#/components/schemas/SecureEmbedUpdateRequestAttributes" + type: + $ref: "#/components/schemas/SecureEmbedUpdateRequestType" + required: + - type + - attributes + type: object + SecureEmbedUpdateRequestType: + description: Resource type for secure embed update requests. + enum: + - secure_embed_update_request + example: "secure_embed_update_request" + type: string + x-enum-varnames: + - SECURE_EMBED_UPDATE_REQUEST + SecureEmbedUpdateResponse: + description: Response for updating a secure embed shared dashboard. + properties: + data: + $ref: "#/components/schemas/SecureEmbedUpdateResponseData" + required: + - data + type: object + SecureEmbedUpdateResponseAttributes: + description: Attributes of an updated secure embed shared dashboard. + properties: + created_at: + description: Creation timestamp. + example: "2026-03-11T18:30:00.000000" + readOnly: true + type: string + credential_suffix: + description: Last 4 characters of the credential. Defaults to `0000` if unavailable. + example: "ab3f" + readOnly: true + type: string + dashboard_id: + description: The source dashboard ID. + example: "abc-def-ghi" + readOnly: true + type: string + global_time: + $ref: "#/components/schemas/SecureEmbedGlobalTime" + global_time_selectable: + description: Whether time range is viewer-selectable. + example: true + type: boolean + id: + description: Internal share ID. + example: "12345" + readOnly: true + type: string + selectable_template_vars: + description: Template variables with their configuration. + items: + $ref: "#/components/schemas/SecureEmbedSelectableTemplateVariable" + type: array + share_type: + $ref: "#/components/schemas/SecureEmbedShareType" + status: + $ref: "#/components/schemas/SecureEmbedStatus" + title: + description: Display title. + example: "Q1 Metrics Dashboard (Updated)" + type: string + token: + description: Public share token. + example: "s3cur3t0k3n-abcdef123456" + readOnly: true + type: string + url: + description: CDN URL for the shared dashboard. + example: "https://p.datadoghq.com/sb/secure-embed/s3cur3t0k3n-abcdef123456" + readOnly: true + type: string + viewing_preferences: + $ref: "#/components/schemas/SecureEmbedViewingPreferences" + type: object + SecureEmbedUpdateResponseData: + description: Data object for a secure embed update response. + properties: + attributes: + $ref: "#/components/schemas/SecureEmbedUpdateResponseAttributes" + id: + description: Internal share ID. + example: "12345" + type: string + type: + $ref: "#/components/schemas/SecureEmbedUpdateResponseType" + required: + - type + - id + - attributes + type: object + SecureEmbedUpdateResponseType: + description: Resource type for secure embed update responses. + enum: + - secure_embed_update_response + example: "secure_embed_update_response" + type: string + x-enum-varnames: + - SECURE_EMBED_UPDATE_RESPONSE + SecureEmbedViewingPreferences: + description: Display settings for the secure embed shared dashboard. + properties: + high_density: + description: Whether widgets are displayed in high density mode. + example: false + type: boolean + theme: + $ref: "#/components/schemas/SecureEmbedViewingPreferencesTheme" + type: object + SecureEmbedViewingPreferencesTheme: + description: The theme of the shared dashboard view. `system` follows the viewer's system default. + enum: + - system + - light + - dark + example: "system" + type: string + x-enum-varnames: + - SYSTEM + - LIGHT + - DARK SecurityEntityConfigRisks: description: Configuration risks associated with the entity properties: @@ -84245,6 +84724,218 @@ paths: tags: - Dashboard Lists x-codegen-request-body-name: body + /api/v2/dashboard/{dashboard_id}/shared/secure-embed: + post: + description: >- + Create a secure embed share for a dashboard. The response includes a one-time `credential` used for HMAC-SHA256 signing. Store it securely — it cannot be retrieved again. + operationId: CreateDashboardSecureEmbed + parameters: + - $ref: "#/components/parameters/DashboardIDPathParameter" + requestBody: + content: + application/json: + examples: + json-request-body: + value: + data: + attributes: + global_time: + live_span: "1h" + global_time_selectable: true + selectable_template_vars: + - default_values: ["1"] + name: "org_id" + prefix: "org_id" + visible_tags: ["1"] + status: active + title: "Q1 Metrics Dashboard" + viewing_preferences: + high_density: false + theme: "system" + type: secure_embed_request + schema: + $ref: "#/components/schemas/SecureEmbedCreateRequest" + description: Secure embed creation request body. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/SecureEmbedCreateResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Dashboard Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict — max 1000 share URLs per dashboard exceeded + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - dashboards_embed_share + summary: Create a secure embed for a dashboard + tags: + - Dashboard Secure Embed + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - dashboards_embed_share + 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/dashboard/{dashboard_id}/shared/secure-embed/{token}: + delete: + description: >- + Delete a secure embed share for a dashboard. + operationId: DeleteDashboardSecureEmbed + parameters: + - $ref: "#/components/parameters/DashboardIDPathParameter" + - $ref: "#/components/parameters/SecureEmbedTokenPathParameter" + responses: + "204": + description: No Content + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - dashboards_embed_share + summary: Delete a secure embed for a dashboard + tags: + - Dashboard Secure Embed + "x-permission": + operator: OR + permissions: + - dashboards_embed_share + 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: >- + Retrieve an existing secure embed configuration for a dashboard. + operationId: GetDashboardSecureEmbed + parameters: + - $ref: "#/components/parameters/DashboardIDPathParameter" + - $ref: "#/components/parameters/SecureEmbedTokenPathParameter" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/SecureEmbedGetResponse" + description: OK + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - dashboards_read + summary: Get a secure embed for a dashboard + tags: + - Dashboard Secure Embed + "x-permission": + operator: OR + permissions: + - dashboards_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/). + patch: + description: >- + Partially update a secure embed configuration. All fields are optional (PATCH semantics). + operationId: UpdateDashboardSecureEmbed + parameters: + - $ref: "#/components/parameters/DashboardIDPathParameter" + - $ref: "#/components/parameters/SecureEmbedTokenPathParameter" + requestBody: + content: + application/json: + examples: + json-request-body: + value: + data: + attributes: + status: active + title: "Q1 Metrics Dashboard (Updated)" + type: secure_embed_update_request + schema: + $ref: "#/components/schemas/SecureEmbedUpdateRequest" + description: Secure embed update request body. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/SecureEmbedUpdateResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - dashboards_embed_share + summary: Update a secure embed for a dashboard + tags: + - Dashboard Secure Embed + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - dashboards_embed_share + 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/datasets: get: description: Get all datasets that have been configured for an organization. @@ -116463,6 +117154,11 @@ tags: organize, find, and share all of your dashboards with your team and organization. name: Dashboard Lists + - description: >- + Manage securely embedded Datadog dashboards. Secure embeds use HMAC-SHA256 signed sessions for authentication, enabling customers to embed dashboards in their own applications with server-side auth control. Unlike public dashboards (open URL) or invite dashboards (email-based access), secure embeds provide programmatic access control. + + **Requirements:** - Org setting: SharedDashboards > Embed sharing must be enabled. - AuthN: Datadog API key and application key. - Read operations require `dashboards_read` permission. - Write operations require `dashboards_embed_share` permission. + name: Dashboard Secure Embed - description: |- The Data Deletion API allows the user to target and delete data from the allowed products. It's currently enabled for Logs and RUM and depends on `logs_delete_data` and `rum_delete_data` permissions respectively. name: Data Deletion diff --git a/examples/v2_dashboard-secure-embed_CreateDashboardSecureEmbed.rs b/examples/v2_dashboard-secure-embed_CreateDashboardSecureEmbed.rs new file mode 100644 index 000000000..47dd7c0ab --- /dev/null +++ b/examples/v2_dashboard-secure-embed_CreateDashboardSecureEmbed.rs @@ -0,0 +1,45 @@ +// Create a secure embed for a dashboard returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_dashboard_secure_embed::DashboardSecureEmbedAPI; +use datadog_api_client::datadogV2::model::SecureEmbedCreateRequest; +use datadog_api_client::datadogV2::model::SecureEmbedCreateRequestAttributes; +use datadog_api_client::datadogV2::model::SecureEmbedCreateRequestData; +use datadog_api_client::datadogV2::model::SecureEmbedGlobalTime; +use datadog_api_client::datadogV2::model::SecureEmbedGlobalTimeLiveSpan; +use datadog_api_client::datadogV2::model::SecureEmbedRequestType; +use datadog_api_client::datadogV2::model::SecureEmbedSelectableTemplateVariable; +use datadog_api_client::datadogV2::model::SecureEmbedStatus; +use datadog_api_client::datadogV2::model::SecureEmbedViewingPreferences; +use datadog_api_client::datadogV2::model::SecureEmbedViewingPreferencesTheme; + +#[tokio::main] +async fn main() { + let body = SecureEmbedCreateRequest::new(SecureEmbedCreateRequestData::new( + SecureEmbedCreateRequestAttributes::new( + SecureEmbedGlobalTime::new().live_span(SecureEmbedGlobalTimeLiveSpan::PAST_ONE_HOUR), + true, + vec![SecureEmbedSelectableTemplateVariable::new() + .default_values(vec!["1".to_string()]) + .name("org_id".to_string()) + .prefix("org_id".to_string()) + .visible_tags(vec!["1".to_string()])], + SecureEmbedStatus::ACTIVE, + "Q1 Metrics Dashboard".to_string(), + SecureEmbedViewingPreferences::new() + .high_density(false) + .theme(SecureEmbedViewingPreferencesTheme::SYSTEM), + ), + SecureEmbedRequestType::SECURE_EMBED_REQUEST, + )); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.CreateDashboardSecureEmbed", true); + let api = DashboardSecureEmbedAPI::with_config(configuration); + let resp = api + .create_dashboard_secure_embed("dashboard_id".to_string(), body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_dashboard-secure-embed_DeleteDashboardSecureEmbed.rs b/examples/v2_dashboard-secure-embed_DeleteDashboardSecureEmbed.rs new file mode 100644 index 000000000..dbdd95a60 --- /dev/null +++ b/examples/v2_dashboard-secure-embed_DeleteDashboardSecureEmbed.rs @@ -0,0 +1,18 @@ +// Delete a secure embed for a dashboard returns "No Content" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_dashboard_secure_embed::DashboardSecureEmbedAPI; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.DeleteDashboardSecureEmbed", true); + let api = DashboardSecureEmbedAPI::with_config(configuration); + let resp = api + .delete_dashboard_secure_embed("dashboard_id".to_string(), "token".to_string()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_dashboard-secure-embed_GetDashboardSecureEmbed.rs b/examples/v2_dashboard-secure-embed_GetDashboardSecureEmbed.rs new file mode 100644 index 000000000..6889ebc2d --- /dev/null +++ b/examples/v2_dashboard-secure-embed_GetDashboardSecureEmbed.rs @@ -0,0 +1,18 @@ +// Get a secure embed for a dashboard returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_dashboard_secure_embed::DashboardSecureEmbedAPI; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetDashboardSecureEmbed", true); + let api = DashboardSecureEmbedAPI::with_config(configuration); + let resp = api + .get_dashboard_secure_embed("dashboard_id".to_string(), "token".to_string()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_dashboard-secure-embed_UpdateDashboardSecureEmbed.rs b/examples/v2_dashboard-secure-embed_UpdateDashboardSecureEmbed.rs new file mode 100644 index 000000000..00e579533 --- /dev/null +++ b/examples/v2_dashboard-secure-embed_UpdateDashboardSecureEmbed.rs @@ -0,0 +1,49 @@ +// Update a secure embed for a dashboard returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_dashboard_secure_embed::DashboardSecureEmbedAPI; +use datadog_api_client::datadogV2::model::SecureEmbedGlobalTime; +use datadog_api_client::datadogV2::model::SecureEmbedGlobalTimeLiveSpan; +use datadog_api_client::datadogV2::model::SecureEmbedSelectableTemplateVariable; +use datadog_api_client::datadogV2::model::SecureEmbedStatus; +use datadog_api_client::datadogV2::model::SecureEmbedUpdateRequest; +use datadog_api_client::datadogV2::model::SecureEmbedUpdateRequestAttributes; +use datadog_api_client::datadogV2::model::SecureEmbedUpdateRequestData; +use datadog_api_client::datadogV2::model::SecureEmbedUpdateRequestType; +use datadog_api_client::datadogV2::model::SecureEmbedViewingPreferences; +use datadog_api_client::datadogV2::model::SecureEmbedViewingPreferencesTheme; + +#[tokio::main] +async fn main() { + let body = SecureEmbedUpdateRequest::new(SecureEmbedUpdateRequestData::new( + SecureEmbedUpdateRequestAttributes::new() + .global_time( + SecureEmbedGlobalTime::new() + .live_span(SecureEmbedGlobalTimeLiveSpan::PAST_ONE_HOUR), + ) + .global_time_selectable(true) + .selectable_template_vars(vec![SecureEmbedSelectableTemplateVariable::new() + .default_values(vec!["1".to_string()]) + .name("org_id".to_string()) + .prefix("org_id".to_string()) + .visible_tags(vec!["1".to_string()])]) + .status(SecureEmbedStatus::ACTIVE) + .title("Q1 Metrics Dashboard (Updated)".to_string()) + .viewing_preferences( + SecureEmbedViewingPreferences::new() + .high_density(false) + .theme(SecureEmbedViewingPreferencesTheme::SYSTEM), + ), + SecureEmbedUpdateRequestType::SECURE_EMBED_UPDATE_REQUEST, + )); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.UpdateDashboardSecureEmbed", true); + let api = DashboardSecureEmbedAPI::with_config(configuration); + let resp = api + .update_dashboard_secure_embed("dashboard_id".to_string(), "token".to_string(), 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 f07df95ec..7b5c4d177 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -202,6 +202,10 @@ impl Default for Configuration { ), ("v2.get_code_coverage_branch_summary".to_owned(), false), ("v2.get_code_coverage_commit_summary".to_owned(), false), + ("v2.create_dashboard_secure_embed".to_owned(), false), + ("v2.delete_dashboard_secure_embed".to_owned(), false), + ("v2.get_dashboard_secure_embed".to_owned(), false), + ("v2.update_dashboard_secure_embed".to_owned(), false), ("v2.create_dataset".to_owned(), false), ("v2.delete_dataset".to_owned(), false), ("v2.get_all_datasets".to_owned(), false), diff --git a/src/datadogV2/api/api_dashboard_secure_embed.rs b/src/datadogV2/api/api_dashboard_secure_embed.rs new file mode 100644 index 000000000..3bd6264b5 --- /dev/null +++ b/src/datadogV2/api/api_dashboard_secure_embed.rs @@ -0,0 +1,690 @@ +// 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; + +/// CreateDashboardSecureEmbedError is a struct for typed errors of method [`DashboardSecureEmbedAPI::create_dashboard_secure_embed`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateDashboardSecureEmbedError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// DeleteDashboardSecureEmbedError is a struct for typed errors of method [`DashboardSecureEmbedAPI::delete_dashboard_secure_embed`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteDashboardSecureEmbedError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// GetDashboardSecureEmbedError is a struct for typed errors of method [`DashboardSecureEmbedAPI::get_dashboard_secure_embed`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetDashboardSecureEmbedError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// UpdateDashboardSecureEmbedError is a struct for typed errors of method [`DashboardSecureEmbedAPI::update_dashboard_secure_embed`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateDashboardSecureEmbedError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// Manage securely embedded Datadog dashboards. Secure embeds use HMAC-SHA256 signed sessions for authentication, enabling customers to embed dashboards in their own applications with server-side auth control. Unlike public dashboards (open URL) or invite dashboards (email-based access), secure embeds provide programmatic access control. +/// **Requirements:** - Org setting: SharedDashboards > Embed sharing must be enabled. - AuthN: Datadog API key and application key. - Read operations require `dashboards_read` permission. - Write operations require `dashboards_embed_share` permission. +#[derive(Debug, Clone)] +pub struct DashboardSecureEmbedAPI { + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, +} + +impl Default for DashboardSecureEmbedAPI { + fn default() -> Self { + Self::with_config(datadog::Configuration::default()) + } +} + +impl DashboardSecureEmbedAPI { + 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 } + } + + /// Create a secure embed share for a dashboard. The response includes a one-time `credential` used for HMAC-SHA256 signing. Store it securely — it cannot be retrieved again. + pub async fn create_dashboard_secure_embed( + &self, + dashboard_id: String, + body: crate::datadogV2::model::SecureEmbedCreateRequest, + ) -> Result< + crate::datadogV2::model::SecureEmbedCreateResponse, + datadog::Error, + > { + match self + .create_dashboard_secure_embed_with_http_info(dashboard_id, 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 a secure embed share for a dashboard. The response includes a one-time `credential` used for HMAC-SHA256 signing. Store it securely — it cannot be retrieved again. + pub async fn create_dashboard_secure_embed_with_http_info( + &self, + dashboard_id: String, + body: crate::datadogV2::model::SecureEmbedCreateRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.create_dashboard_secure_embed"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.create_dashboard_secure_embed' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/dashboard/{dashboard_id}/shared/secure-embed", + local_configuration.get_operation_host(operation_id), + dashboard_id = datadog::urlencode(dashboard_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 + 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)) + } + } + + /// Delete a secure embed share for a dashboard. + pub async fn delete_dashboard_secure_embed( + &self, + dashboard_id: String, + token: String, + ) -> Result<(), datadog::Error> { + match self + .delete_dashboard_secure_embed_with_http_info(dashboard_id, token) + .await + { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Delete a secure embed share for a dashboard. + pub async fn delete_dashboard_secure_embed_with_http_info( + &self, + dashboard_id: String, + token: String, + ) -> Result, datadog::Error> { + let local_configuration = &self.config; + let operation_id = "v2.delete_dashboard_secure_embed"; + 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_dashboard_secure_embed' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/dashboard/{dashboard_id}/shared/secure-embed/{token}", + local_configuration.get_operation_host(operation_id), + dashboard_id = datadog::urlencode(dashboard_id), + token = datadog::urlencode(token) + ); + 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)) + } + } + + /// Retrieve an existing secure embed configuration for a dashboard. + pub async fn get_dashboard_secure_embed( + &self, + dashboard_id: String, + token: String, + ) -> Result< + crate::datadogV2::model::SecureEmbedGetResponse, + datadog::Error, + > { + match self + .get_dashboard_secure_embed_with_http_info(dashboard_id, token) + .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), + } + } + + /// Retrieve an existing secure embed configuration for a dashboard. + pub async fn get_dashboard_secure_embed_with_http_info( + &self, + dashboard_id: String, + token: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_dashboard_secure_embed"; + 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_dashboard_secure_embed' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/dashboard/{dashboard_id}/shared/secure-embed/{token}", + local_configuration.get_operation_host(operation_id), + dashboard_id = datadog::urlencode(dashboard_id), + token = datadog::urlencode(token) + ); + 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)) + } + } + + /// Partially update a secure embed configuration. All fields are optional (PATCH semantics). + pub async fn update_dashboard_secure_embed( + &self, + dashboard_id: String, + token: String, + body: crate::datadogV2::model::SecureEmbedUpdateRequest, + ) -> Result< + crate::datadogV2::model::SecureEmbedUpdateResponse, + datadog::Error, + > { + match self + .update_dashboard_secure_embed_with_http_info(dashboard_id, token, 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), + } + } + + /// Partially update a secure embed configuration. All fields are optional (PATCH semantics). + pub async fn update_dashboard_secure_embed_with_http_info( + &self, + dashboard_id: String, + token: String, + body: crate::datadogV2::model::SecureEmbedUpdateRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.update_dashboard_secure_embed"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.update_dashboard_secure_embed' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/dashboard/{dashboard_id}/shared/secure-embed/{token}", + local_configuration.get_operation_host(operation_id), + dashboard_id = datadog::urlencode(dashboard_id), + token = datadog::urlencode(token) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::PATCH, 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 49198038b..570ddb5c7 100644 --- a/src/datadogV2/api/mod.rs +++ b/src/datadogV2/api/mod.rs @@ -32,6 +32,7 @@ pub mod api_csm_agents; pub mod api_csm_coverage_analysis; pub mod api_csm_threats; pub mod api_dashboard_lists; +pub mod api_dashboard_secure_embed; pub mod api_data_deletion; pub mod api_datasets; pub mod api_deployment_gates; diff --git a/src/datadogV2/mod.rs b/src/datadogV2/mod.rs index 38f44618a..beda8bbe5 100644 --- a/src/datadogV2/mod.rs +++ b/src/datadogV2/mod.rs @@ -33,6 +33,7 @@ pub use self::api::api_csm_agents; pub use self::api::api_csm_coverage_analysis; pub use self::api::api_csm_threats; pub use self::api::api_dashboard_lists; +pub use self::api::api_dashboard_secure_embed; pub use self::api::api_data_deletion; pub use self::api::api_datasets; pub use self::api::api_deployment_gates; diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 08629f955..e33231489 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -2462,6 +2462,60 @@ pub mod model_dashboard_list_update_items_request; pub use self::model_dashboard_list_update_items_request::DashboardListUpdateItemsRequest; pub mod model_dashboard_list_update_items_response; pub use self::model_dashboard_list_update_items_response::DashboardListUpdateItemsResponse; +pub mod model_secure_embed_create_request; +pub use self::model_secure_embed_create_request::SecureEmbedCreateRequest; +pub mod model_secure_embed_create_request_data; +pub use self::model_secure_embed_create_request_data::SecureEmbedCreateRequestData; +pub mod model_secure_embed_create_request_attributes; +pub use self::model_secure_embed_create_request_attributes::SecureEmbedCreateRequestAttributes; +pub mod model_secure_embed_global_time; +pub use self::model_secure_embed_global_time::SecureEmbedGlobalTime; +pub mod model_secure_embed_global_time_live_span; +pub use self::model_secure_embed_global_time_live_span::SecureEmbedGlobalTimeLiveSpan; +pub mod model_secure_embed_selectable_template_variable; +pub use self::model_secure_embed_selectable_template_variable::SecureEmbedSelectableTemplateVariable; +pub mod model_secure_embed_status; +pub use self::model_secure_embed_status::SecureEmbedStatus; +pub mod model_secure_embed_viewing_preferences; +pub use self::model_secure_embed_viewing_preferences::SecureEmbedViewingPreferences; +pub mod model_secure_embed_viewing_preferences_theme; +pub use self::model_secure_embed_viewing_preferences_theme::SecureEmbedViewingPreferencesTheme; +pub mod model_secure_embed_request_type; +pub use self::model_secure_embed_request_type::SecureEmbedRequestType; +pub mod model_secure_embed_create_response; +pub use self::model_secure_embed_create_response::SecureEmbedCreateResponse; +pub mod model_secure_embed_create_response_data; +pub use self::model_secure_embed_create_response_data::SecureEmbedCreateResponseData; +pub mod model_secure_embed_create_response_attributes; +pub use self::model_secure_embed_create_response_attributes::SecureEmbedCreateResponseAttributes; +pub mod model_secure_embed_share_type; +pub use self::model_secure_embed_share_type::SecureEmbedShareType; +pub mod model_secure_embed_create_response_type; +pub use self::model_secure_embed_create_response_type::SecureEmbedCreateResponseType; +pub mod model_secure_embed_get_response; +pub use self::model_secure_embed_get_response::SecureEmbedGetResponse; +pub mod model_secure_embed_get_response_data; +pub use self::model_secure_embed_get_response_data::SecureEmbedGetResponseData; +pub mod model_secure_embed_get_response_attributes; +pub use self::model_secure_embed_get_response_attributes::SecureEmbedGetResponseAttributes; +pub mod model_secure_embed_get_response_type; +pub use self::model_secure_embed_get_response_type::SecureEmbedGetResponseType; +pub mod model_secure_embed_update_request; +pub use self::model_secure_embed_update_request::SecureEmbedUpdateRequest; +pub mod model_secure_embed_update_request_data; +pub use self::model_secure_embed_update_request_data::SecureEmbedUpdateRequestData; +pub mod model_secure_embed_update_request_attributes; +pub use self::model_secure_embed_update_request_attributes::SecureEmbedUpdateRequestAttributes; +pub mod model_secure_embed_update_request_type; +pub use self::model_secure_embed_update_request_type::SecureEmbedUpdateRequestType; +pub mod model_secure_embed_update_response; +pub use self::model_secure_embed_update_response::SecureEmbedUpdateResponse; +pub mod model_secure_embed_update_response_data; +pub use self::model_secure_embed_update_response_data::SecureEmbedUpdateResponseData; +pub mod model_secure_embed_update_response_attributes; +pub use self::model_secure_embed_update_response_attributes::SecureEmbedUpdateResponseAttributes; +pub mod model_secure_embed_update_response_type; +pub use self::model_secure_embed_update_response_type::SecureEmbedUpdateResponseType; pub mod model_dataset_response_multi; pub use self::model_dataset_response_multi::DatasetResponseMulti; pub mod model_dataset_response; diff --git a/src/datadogV2/model/model_observability_pipeline_parse_grok_processor_rule.rs b/src/datadogV2/model/model_observability_pipeline_parse_grok_processor_rule.rs index 4f9e9164f..4560ad802 100644 --- a/src/datadogV2/model/model_observability_pipeline_parse_grok_processor_rule.rs +++ b/src/datadogV2/model/model_observability_pipeline_parse_grok_processor_rule.rs @@ -17,7 +17,7 @@ pub struct ObservabilityPipelineParseGrokProcessorRule { #[serde(rename = "match_rules")] pub match_rules: Vec, - /// The value of the source field in log events to be processed by the Grok rules. + /// The name of the field in the log event to apply the Grok rules to. #[serde(rename = "source")] pub source: String, /// A list of Grok helper rules that can be referenced by the parsing rules. diff --git a/src/datadogV2/model/model_secure_embed_create_request.rs b/src/datadogV2/model/model_secure_embed_create_request.rs new file mode 100644 index 000000000..f4315192e --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_create_request.rs @@ -0,0 +1,94 @@ +// 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 to create a secure embed shared dashboard. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedCreateRequest { + /// Data object for creating a secure embed. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::SecureEmbedCreateRequestData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedCreateRequest { + pub fn new( + data: crate::datadogV2::model::SecureEmbedCreateRequestData, + ) -> SecureEmbedCreateRequest { + SecureEmbedCreateRequest { + 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 SecureEmbedCreateRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedCreateRequestVisitor; + impl<'a> Visitor<'a> for SecureEmbedCreateRequestVisitor { + type Value = SecureEmbedCreateRequest; + + 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 = SecureEmbedCreateRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedCreateRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_create_request_attributes.rs b/src/datadogV2/model/model_secure_embed_create_request_attributes.rs new file mode 100644 index 000000000..7c8f341ae --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_create_request_attributes.rs @@ -0,0 +1,174 @@ +// 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 for creating a secure embed shared dashboard. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedCreateRequestAttributes { + /// Default time range configuration for the secure embed. + #[serde(rename = "global_time")] + pub global_time: crate::datadogV2::model::SecureEmbedGlobalTime, + /// Whether viewers can change the time range. + #[serde(rename = "global_time_selectable")] + pub global_time_selectable: bool, + /// Template variables viewers can modify. + #[serde(rename = "selectable_template_vars")] + pub selectable_template_vars: + Vec, + /// The status of the secure embed share. Active means the shared dashboard is available. Paused means it is not. + #[serde(rename = "status")] + pub status: crate::datadogV2::model::SecureEmbedStatus, + /// Display title for the shared dashboard. + #[serde(rename = "title")] + pub title: String, + /// Display settings for the secure embed shared dashboard. + #[serde(rename = "viewing_preferences")] + pub viewing_preferences: crate::datadogV2::model::SecureEmbedViewingPreferences, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedCreateRequestAttributes { + pub fn new( + global_time: crate::datadogV2::model::SecureEmbedGlobalTime, + global_time_selectable: bool, + selectable_template_vars: Vec< + crate::datadogV2::model::SecureEmbedSelectableTemplateVariable, + >, + status: crate::datadogV2::model::SecureEmbedStatus, + title: String, + viewing_preferences: crate::datadogV2::model::SecureEmbedViewingPreferences, + ) -> SecureEmbedCreateRequestAttributes { + SecureEmbedCreateRequestAttributes { + global_time, + global_time_selectable, + selectable_template_vars, + status, + title, + viewing_preferences, + 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 SecureEmbedCreateRequestAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedCreateRequestAttributesVisitor; + impl<'a> Visitor<'a> for SecureEmbedCreateRequestAttributesVisitor { + type Value = SecureEmbedCreateRequestAttributes; + + 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 global_time: Option = None; + let mut global_time_selectable: Option = None; + let mut selectable_template_vars: Option< + Vec, + > = None; + let mut status: Option = None; + let mut title: Option = None; + let mut viewing_preferences: Option< + crate::datadogV2::model::SecureEmbedViewingPreferences, + > = 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() { + "global_time" => { + global_time = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "global_time_selectable" => { + global_time_selectable = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "selectable_template_vars" => { + selectable_template_vars = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "status" => { + status = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _status) = status { + match _status { + crate::datadogV2::model::SecureEmbedStatus::UnparsedObject( + _status, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "title" => { + title = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "viewing_preferences" => { + viewing_preferences = + 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 global_time = + global_time.ok_or_else(|| M::Error::missing_field("global_time"))?; + let global_time_selectable = global_time_selectable + .ok_or_else(|| M::Error::missing_field("global_time_selectable"))?; + let selectable_template_vars = selectable_template_vars + .ok_or_else(|| M::Error::missing_field("selectable_template_vars"))?; + let status = status.ok_or_else(|| M::Error::missing_field("status"))?; + let title = title.ok_or_else(|| M::Error::missing_field("title"))?; + let viewing_preferences = viewing_preferences + .ok_or_else(|| M::Error::missing_field("viewing_preferences"))?; + + let content = SecureEmbedCreateRequestAttributes { + global_time, + global_time_selectable, + selectable_template_vars, + status, + title, + viewing_preferences, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedCreateRequestAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_create_request_data.rs b/src/datadogV2/model/model_secure_embed_create_request_data.rs new file mode 100644 index 000000000..fa22efbee --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_create_request_data.rs @@ -0,0 +1,115 @@ +// 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 for creating a secure embed. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedCreateRequestData { + /// Attributes for creating a secure embed shared dashboard. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::SecureEmbedCreateRequestAttributes, + /// Resource type for secure embed create requests. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::SecureEmbedRequestType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedCreateRequestData { + pub fn new( + attributes: crate::datadogV2::model::SecureEmbedCreateRequestAttributes, + type_: crate::datadogV2::model::SecureEmbedRequestType, + ) -> SecureEmbedCreateRequestData { + SecureEmbedCreateRequestData { + attributes, + type_, + 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 SecureEmbedCreateRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedCreateRequestDataVisitor; + impl<'a> Visitor<'a> for SecureEmbedCreateRequestDataVisitor { + type Value = SecureEmbedCreateRequestData; + + 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::SecureEmbedCreateRequestAttributes, + > = 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" => { + 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::SecureEmbedRequestType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = SecureEmbedCreateRequestData { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedCreateRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_create_response.rs b/src/datadogV2/model/model_secure_embed_create_response.rs new file mode 100644 index 000000000..bc6ba0605 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_create_response.rs @@ -0,0 +1,94 @@ +// 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 for creating a secure embed shared dashboard. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedCreateResponse { + /// Data object for a secure embed create response. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::SecureEmbedCreateResponseData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedCreateResponse { + pub fn new( + data: crate::datadogV2::model::SecureEmbedCreateResponseData, + ) -> SecureEmbedCreateResponse { + SecureEmbedCreateResponse { + 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 SecureEmbedCreateResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedCreateResponseVisitor; + impl<'a> Visitor<'a> for SecureEmbedCreateResponseVisitor { + type Value = SecureEmbedCreateResponse; + + 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 = SecureEmbedCreateResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedCreateResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_create_response_attributes.rs b/src/datadogV2/model/model_secure_embed_create_response_attributes.rs new file mode 100644 index 000000000..b929a5c41 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_create_response_attributes.rs @@ -0,0 +1,343 @@ +// 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 a newly created secure embed shared dashboard. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedCreateResponseAttributes { + /// Creation timestamp. + #[serde(rename = "created_at")] + pub created_at: Option, + /// The secret credential used for HMAC signing. Returned only on creation. Store securely — it cannot be retrieved again. + #[serde(rename = "credential")] + pub credential: Option, + /// The source dashboard ID. + #[serde(rename = "dashboard_id")] + pub dashboard_id: Option, + /// Default time range configuration for the secure embed. + #[serde(rename = "global_time")] + pub global_time: Option, + /// Whether time range is viewer-selectable. + #[serde(rename = "global_time_selectable")] + pub global_time_selectable: Option, + /// Internal share ID. + #[serde(rename = "id")] + pub id: Option, + /// Template variables with their configuration. + #[serde(rename = "selectable_template_vars")] + pub selectable_template_vars: + Option>, + /// The type of share. Always `secure_embed`. + #[serde(rename = "share_type")] + pub share_type: Option, + /// The status of the secure embed share. Active means the shared dashboard is available. Paused means it is not. + #[serde(rename = "status")] + pub status: Option, + /// Display title. + #[serde(rename = "title")] + pub title: Option, + /// Public share token. + #[serde(rename = "token")] + pub token: Option, + /// CDN URL for the shared dashboard. + #[serde(rename = "url")] + pub url: Option, + /// Display settings for the secure embed shared dashboard. + #[serde(rename = "viewing_preferences")] + pub viewing_preferences: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedCreateResponseAttributes { + pub fn new() -> SecureEmbedCreateResponseAttributes { + SecureEmbedCreateResponseAttributes { + created_at: None, + credential: None, + dashboard_id: None, + global_time: None, + global_time_selectable: None, + id: None, + selectable_template_vars: None, + share_type: None, + status: None, + title: None, + token: None, + url: None, + viewing_preferences: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_at(mut self, value: String) -> Self { + self.created_at = Some(value); + self + } + + pub fn credential(mut self, value: String) -> Self { + self.credential = Some(value); + self + } + + pub fn dashboard_id(mut self, value: String) -> Self { + self.dashboard_id = Some(value); + self + } + + pub fn global_time(mut self, value: crate::datadogV2::model::SecureEmbedGlobalTime) -> Self { + self.global_time = Some(value); + self + } + + pub fn global_time_selectable(mut self, value: bool) -> Self { + self.global_time_selectable = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn selectable_template_vars( + mut self, + value: Vec, + ) -> Self { + self.selectable_template_vars = Some(value); + self + } + + pub fn share_type(mut self, value: crate::datadogV2::model::SecureEmbedShareType) -> Self { + self.share_type = Some(value); + self + } + + pub fn status(mut self, value: crate::datadogV2::model::SecureEmbedStatus) -> Self { + self.status = Some(value); + self + } + + pub fn title(mut self, value: String) -> Self { + self.title = Some(value); + self + } + + pub fn token(mut self, value: String) -> Self { + self.token = Some(value); + self + } + + pub fn url(mut self, value: String) -> Self { + self.url = Some(value); + self + } + + pub fn viewing_preferences( + mut self, + value: crate::datadogV2::model::SecureEmbedViewingPreferences, + ) -> Self { + self.viewing_preferences = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SecureEmbedCreateResponseAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SecureEmbedCreateResponseAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedCreateResponseAttributesVisitor; + impl<'a> Visitor<'a> for SecureEmbedCreateResponseAttributesVisitor { + type Value = SecureEmbedCreateResponseAttributes; + + 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 created_at: Option = None; + let mut credential: Option = None; + let mut dashboard_id: Option = None; + let mut global_time: Option = None; + let mut global_time_selectable: Option = None; + let mut id: Option = None; + let mut selectable_template_vars: Option< + Vec, + > = None; + let mut share_type: Option = None; + let mut status: Option = None; + let mut title: Option = None; + let mut token: Option = None; + let mut url: Option = None; + let mut viewing_preferences: Option< + crate::datadogV2::model::SecureEmbedViewingPreferences, + > = 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() { + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "credential" => { + if v.is_null() { + continue; + } + credential = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "dashboard_id" => { + if v.is_null() { + continue; + } + dashboard_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "global_time" => { + if v.is_null() { + continue; + } + global_time = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "global_time_selectable" => { + if v.is_null() { + continue; + } + global_time_selectable = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "selectable_template_vars" => { + if v.is_null() { + continue; + } + selectable_template_vars = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "share_type" => { + if v.is_null() { + continue; + } + share_type = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _share_type) = share_type { + match _share_type { + crate::datadogV2::model::SecureEmbedShareType::UnparsedObject(_share_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "status" => { + if v.is_null() { + continue; + } + status = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _status) = status { + match _status { + crate::datadogV2::model::SecureEmbedStatus::UnparsedObject( + _status, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "title" => { + if v.is_null() { + continue; + } + title = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "token" => { + if v.is_null() { + continue; + } + token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "url" => { + if v.is_null() { + continue; + } + url = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "viewing_preferences" => { + if v.is_null() { + continue; + } + viewing_preferences = + 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 = SecureEmbedCreateResponseAttributes { + created_at, + credential, + dashboard_id, + global_time, + global_time_selectable, + id, + selectable_template_vars, + share_type, + status, + title, + token, + url, + viewing_preferences, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedCreateResponseAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_create_response_data.rs b/src/datadogV2/model/model_secure_embed_create_response_data.rs new file mode 100644 index 000000000..65a644580 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_create_response_data.rs @@ -0,0 +1,127 @@ +// 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 for a secure embed create response. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedCreateResponseData { + /// Attributes of a newly created secure embed shared dashboard. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::SecureEmbedCreateResponseAttributes, + /// Internal share ID. + #[serde(rename = "id")] + pub id: String, + /// Resource type for secure embed create responses. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::SecureEmbedCreateResponseType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedCreateResponseData { + pub fn new( + attributes: crate::datadogV2::model::SecureEmbedCreateResponseAttributes, + id: String, + type_: crate::datadogV2::model::SecureEmbedCreateResponseType, + ) -> SecureEmbedCreateResponseData { + SecureEmbedCreateResponseData { + attributes, + id, + type_, + 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 SecureEmbedCreateResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedCreateResponseDataVisitor; + impl<'a> Visitor<'a> for SecureEmbedCreateResponseDataVisitor { + type Value = SecureEmbedCreateResponseData; + + 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::SecureEmbedCreateResponseAttributes, + > = None; + let mut id: Option = 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" => { + 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)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::SecureEmbedCreateResponseType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + 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 = SecureEmbedCreateResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedCreateResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_create_response_type.rs b/src/datadogV2/model/model_secure_embed_create_response_type.rs new file mode 100644 index 000000000..e31561476 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_create_response_type.rs @@ -0,0 +1,48 @@ +// 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 SecureEmbedCreateResponseType { + SECURE_EMBED_CREATE_RESPONSE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecureEmbedCreateResponseType { + fn to_string(&self) -> String { + match self { + Self::SECURE_EMBED_CREATE_RESPONSE => String::from("secure_embed_create_response"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecureEmbedCreateResponseType { + 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 SecureEmbedCreateResponseType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "secure_embed_create_response" => Self::SECURE_EMBED_CREATE_RESPONSE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_secure_embed_get_response.rs b/src/datadogV2/model/model_secure_embed_get_response.rs new file mode 100644 index 000000000..ec26e110e --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_get_response.rs @@ -0,0 +1,94 @@ +// 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 for getting a secure embed shared dashboard. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedGetResponse { + /// Data object for a secure embed get response. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::SecureEmbedGetResponseData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedGetResponse { + pub fn new( + data: crate::datadogV2::model::SecureEmbedGetResponseData, + ) -> SecureEmbedGetResponse { + SecureEmbedGetResponse { + 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 SecureEmbedGetResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedGetResponseVisitor; + impl<'a> Visitor<'a> for SecureEmbedGetResponseVisitor { + type Value = SecureEmbedGetResponse; + + 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 = SecureEmbedGetResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedGetResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_get_response_attributes.rs b/src/datadogV2/model/model_secure_embed_get_response_attributes.rs new file mode 100644 index 000000000..c31457c61 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_get_response_attributes.rs @@ -0,0 +1,344 @@ +// 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 existing secure embed shared dashboard. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedGetResponseAttributes { + /// Creation timestamp. + #[serde(rename = "created_at")] + pub created_at: Option, + /// Last 4 characters of the credential. Defaults to `0000` if unavailable. + #[serde(rename = "credential_suffix")] + pub credential_suffix: Option, + /// The source dashboard ID. + #[serde(rename = "dashboard_id")] + pub dashboard_id: Option, + /// Default time range configuration for the secure embed. + #[serde(rename = "global_time")] + pub global_time: Option, + /// Whether time range is viewer-selectable. + #[serde(rename = "global_time_selectable")] + pub global_time_selectable: Option, + /// Internal share ID. + #[serde(rename = "id")] + pub id: Option, + /// Template variables with their configuration. + #[serde(rename = "selectable_template_vars")] + pub selectable_template_vars: + Option>, + /// The type of share. Always `secure_embed`. + #[serde(rename = "share_type")] + pub share_type: Option, + /// The status of the secure embed share. Active means the shared dashboard is available. Paused means it is not. + #[serde(rename = "status")] + pub status: Option, + /// Display title. + #[serde(rename = "title")] + pub title: Option, + /// Public share token. + #[serde(rename = "token")] + pub token: Option, + /// CDN URL for the shared dashboard. + #[serde(rename = "url")] + pub url: Option, + /// Display settings for the secure embed shared dashboard. + #[serde(rename = "viewing_preferences")] + pub viewing_preferences: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedGetResponseAttributes { + pub fn new() -> SecureEmbedGetResponseAttributes { + SecureEmbedGetResponseAttributes { + created_at: None, + credential_suffix: None, + dashboard_id: None, + global_time: None, + global_time_selectable: None, + id: None, + selectable_template_vars: None, + share_type: None, + status: None, + title: None, + token: None, + url: None, + viewing_preferences: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_at(mut self, value: String) -> Self { + self.created_at = Some(value); + self + } + + pub fn credential_suffix(mut self, value: String) -> Self { + self.credential_suffix = Some(value); + self + } + + pub fn dashboard_id(mut self, value: String) -> Self { + self.dashboard_id = Some(value); + self + } + + pub fn global_time(mut self, value: crate::datadogV2::model::SecureEmbedGlobalTime) -> Self { + self.global_time = Some(value); + self + } + + pub fn global_time_selectable(mut self, value: bool) -> Self { + self.global_time_selectable = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn selectable_template_vars( + mut self, + value: Vec, + ) -> Self { + self.selectable_template_vars = Some(value); + self + } + + pub fn share_type(mut self, value: crate::datadogV2::model::SecureEmbedShareType) -> Self { + self.share_type = Some(value); + self + } + + pub fn status(mut self, value: crate::datadogV2::model::SecureEmbedStatus) -> Self { + self.status = Some(value); + self + } + + pub fn title(mut self, value: String) -> Self { + self.title = Some(value); + self + } + + pub fn token(mut self, value: String) -> Self { + self.token = Some(value); + self + } + + pub fn url(mut self, value: String) -> Self { + self.url = Some(value); + self + } + + pub fn viewing_preferences( + mut self, + value: crate::datadogV2::model::SecureEmbedViewingPreferences, + ) -> Self { + self.viewing_preferences = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SecureEmbedGetResponseAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SecureEmbedGetResponseAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedGetResponseAttributesVisitor; + impl<'a> Visitor<'a> for SecureEmbedGetResponseAttributesVisitor { + type Value = SecureEmbedGetResponseAttributes; + + 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 created_at: Option = None; + let mut credential_suffix: Option = None; + let mut dashboard_id: Option = None; + let mut global_time: Option = None; + let mut global_time_selectable: Option = None; + let mut id: Option = None; + let mut selectable_template_vars: Option< + Vec, + > = None; + let mut share_type: Option = None; + let mut status: Option = None; + let mut title: Option = None; + let mut token: Option = None; + let mut url: Option = None; + let mut viewing_preferences: Option< + crate::datadogV2::model::SecureEmbedViewingPreferences, + > = 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() { + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "credential_suffix" => { + if v.is_null() { + continue; + } + credential_suffix = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "dashboard_id" => { + if v.is_null() { + continue; + } + dashboard_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "global_time" => { + if v.is_null() { + continue; + } + global_time = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "global_time_selectable" => { + if v.is_null() { + continue; + } + global_time_selectable = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "selectable_template_vars" => { + if v.is_null() { + continue; + } + selectable_template_vars = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "share_type" => { + if v.is_null() { + continue; + } + share_type = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _share_type) = share_type { + match _share_type { + crate::datadogV2::model::SecureEmbedShareType::UnparsedObject(_share_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "status" => { + if v.is_null() { + continue; + } + status = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _status) = status { + match _status { + crate::datadogV2::model::SecureEmbedStatus::UnparsedObject( + _status, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "title" => { + if v.is_null() { + continue; + } + title = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "token" => { + if v.is_null() { + continue; + } + token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "url" => { + if v.is_null() { + continue; + } + url = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "viewing_preferences" => { + if v.is_null() { + continue; + } + viewing_preferences = + 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 = SecureEmbedGetResponseAttributes { + created_at, + credential_suffix, + dashboard_id, + global_time, + global_time_selectable, + id, + selectable_template_vars, + share_type, + status, + title, + token, + url, + viewing_preferences, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedGetResponseAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_get_response_data.rs b/src/datadogV2/model/model_secure_embed_get_response_data.rs new file mode 100644 index 000000000..560030f7e --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_get_response_data.rs @@ -0,0 +1,126 @@ +// 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 for a secure embed get response. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedGetResponseData { + /// Attributes of an existing secure embed shared dashboard. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::SecureEmbedGetResponseAttributes, + /// Internal share ID. + #[serde(rename = "id")] + pub id: String, + /// Resource type for secure embed get responses. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::SecureEmbedGetResponseType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedGetResponseData { + pub fn new( + attributes: crate::datadogV2::model::SecureEmbedGetResponseAttributes, + id: String, + type_: crate::datadogV2::model::SecureEmbedGetResponseType, + ) -> SecureEmbedGetResponseData { + SecureEmbedGetResponseData { + attributes, + id, + type_, + 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 SecureEmbedGetResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedGetResponseDataVisitor; + impl<'a> Visitor<'a> for SecureEmbedGetResponseDataVisitor { + type Value = SecureEmbedGetResponseData; + + 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::SecureEmbedGetResponseAttributes, + > = None; + let mut id: Option = 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" => { + 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)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::SecureEmbedGetResponseType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + 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 = SecureEmbedGetResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedGetResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_get_response_type.rs b/src/datadogV2/model/model_secure_embed_get_response_type.rs new file mode 100644 index 000000000..b7daae5a7 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_get_response_type.rs @@ -0,0 +1,48 @@ +// 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 SecureEmbedGetResponseType { + SECURE_EMBED_GET_RESPONSE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecureEmbedGetResponseType { + fn to_string(&self) -> String { + match self { + Self::SECURE_EMBED_GET_RESPONSE => String::from("secure_embed_get_response"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecureEmbedGetResponseType { + 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 SecureEmbedGetResponseType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "secure_embed_get_response" => Self::SECURE_EMBED_GET_RESPONSE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_secure_embed_global_time.rs b/src/datadogV2/model/model_secure_embed_global_time.rs new file mode 100644 index 000000000..ce2b72f9a --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_global_time.rs @@ -0,0 +1,117 @@ +// 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}; + +/// Default time range configuration for the secure embed. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedGlobalTime { + /// Dashboard global time live_span selection. + #[serde(rename = "live_span")] + pub live_span: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedGlobalTime { + pub fn new() -> SecureEmbedGlobalTime { + SecureEmbedGlobalTime { + live_span: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn live_span( + mut self, + value: crate::datadogV2::model::SecureEmbedGlobalTimeLiveSpan, + ) -> Self { + self.live_span = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SecureEmbedGlobalTime { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SecureEmbedGlobalTime { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedGlobalTimeVisitor; + impl<'a> Visitor<'a> for SecureEmbedGlobalTimeVisitor { + type Value = SecureEmbedGlobalTime; + + 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 live_span: 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() { + "live_span" => { + if v.is_null() { + continue; + } + live_span = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _live_span) = live_span { + match _live_span { + crate::datadogV2::model::SecureEmbedGlobalTimeLiveSpan::UnparsedObject(_live_span) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SecureEmbedGlobalTime { + live_span, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedGlobalTimeVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_global_time_live_span.rs b/src/datadogV2/model/model_secure_embed_global_time_live_span.rs new file mode 100644 index 000000000..61e7f63f4 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_global_time_live_span.rs @@ -0,0 +1,69 @@ +// 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 SecureEmbedGlobalTimeLiveSpan { + PAST_FIFTEEN_MINUTES, + PAST_ONE_HOUR, + PAST_FOUR_HOURS, + PAST_ONE_DAY, + PAST_TWO_DAYS, + PAST_ONE_WEEK, + PAST_ONE_MONTH, + PAST_THREE_MONTHS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecureEmbedGlobalTimeLiveSpan { + fn to_string(&self) -> String { + match self { + Self::PAST_FIFTEEN_MINUTES => String::from("15m"), + Self::PAST_ONE_HOUR => String::from("1h"), + Self::PAST_FOUR_HOURS => String::from("4h"), + Self::PAST_ONE_DAY => String::from("1d"), + Self::PAST_TWO_DAYS => String::from("2d"), + Self::PAST_ONE_WEEK => String::from("1w"), + Self::PAST_ONE_MONTH => String::from("1mo"), + Self::PAST_THREE_MONTHS => String::from("3mo"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecureEmbedGlobalTimeLiveSpan { + 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 SecureEmbedGlobalTimeLiveSpan { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "15m" => Self::PAST_FIFTEEN_MINUTES, + "1h" => Self::PAST_ONE_HOUR, + "4h" => Self::PAST_FOUR_HOURS, + "1d" => Self::PAST_ONE_DAY, + "2d" => Self::PAST_TWO_DAYS, + "1w" => Self::PAST_ONE_WEEK, + "1mo" => Self::PAST_ONE_MONTH, + "3mo" => Self::PAST_THREE_MONTHS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_secure_embed_request_type.rs b/src/datadogV2/model/model_secure_embed_request_type.rs new file mode 100644 index 000000000..487435553 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_request_type.rs @@ -0,0 +1,48 @@ +// 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 SecureEmbedRequestType { + SECURE_EMBED_REQUEST, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecureEmbedRequestType { + fn to_string(&self) -> String { + match self { + Self::SECURE_EMBED_REQUEST => String::from("secure_embed_request"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecureEmbedRequestType { + 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 SecureEmbedRequestType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "secure_embed_request" => Self::SECURE_EMBED_REQUEST, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_secure_embed_selectable_template_variable.rs b/src/datadogV2/model/model_secure_embed_selectable_template_variable.rs new file mode 100644 index 000000000..ccfd37f75 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_selectable_template_variable.rs @@ -0,0 +1,158 @@ +// 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}; + +/// A template variable that viewers can modify on the secure embed shared dashboard. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedSelectableTemplateVariable { + /// Default selected values for the variable. + #[serde(rename = "default_values")] + pub default_values: Option>, + /// Name of the template variable. Usually matches the prefix unless you want a different display name. + #[serde(rename = "name")] + pub name: Option, + /// Tag prefix for the variable (e.g., `environment`, `service`). + #[serde(rename = "prefix")] + pub prefix: Option, + /// Restrict which tag values are visible to the viewer. + #[serde(rename = "visible_tags")] + pub visible_tags: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedSelectableTemplateVariable { + pub fn new() -> SecureEmbedSelectableTemplateVariable { + SecureEmbedSelectableTemplateVariable { + default_values: None, + name: None, + prefix: None, + visible_tags: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn default_values(mut self, value: Vec) -> Self { + self.default_values = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn prefix(mut self, value: String) -> Self { + self.prefix = Some(value); + self + } + + pub fn visible_tags(mut self, value: Vec) -> Self { + self.visible_tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SecureEmbedSelectableTemplateVariable { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SecureEmbedSelectableTemplateVariable { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedSelectableTemplateVariableVisitor; + impl<'a> Visitor<'a> for SecureEmbedSelectableTemplateVariableVisitor { + type Value = SecureEmbedSelectableTemplateVariable; + + 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 default_values: Option> = None; + let mut name: Option = None; + let mut prefix: Option = None; + let mut visible_tags: 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() { + "default_values" => { + if v.is_null() { + continue; + } + default_values = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "prefix" => { + if v.is_null() { + continue; + } + prefix = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "visible_tags" => { + if v.is_null() { + continue; + } + visible_tags = + 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 = SecureEmbedSelectableTemplateVariable { + default_values, + name, + prefix, + visible_tags, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedSelectableTemplateVariableVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_share_type.rs b/src/datadogV2/model/model_secure_embed_share_type.rs new file mode 100644 index 000000000..9b8f296fe --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_share_type.rs @@ -0,0 +1,48 @@ +// 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 SecureEmbedShareType { + SECURE_EMBED, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecureEmbedShareType { + fn to_string(&self) -> String { + match self { + Self::SECURE_EMBED => String::from("secure_embed"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecureEmbedShareType { + 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 SecureEmbedShareType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "secure_embed" => Self::SECURE_EMBED, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_secure_embed_status.rs b/src/datadogV2/model/model_secure_embed_status.rs new file mode 100644 index 000000000..5b15d65db --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_status.rs @@ -0,0 +1,51 @@ +// 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 SecureEmbedStatus { + ACTIVE, + PAUSED, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecureEmbedStatus { + fn to_string(&self) -> String { + match self { + Self::ACTIVE => String::from("active"), + Self::PAUSED => String::from("paused"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecureEmbedStatus { + 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 SecureEmbedStatus { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "active" => Self::ACTIVE, + "paused" => Self::PAUSED, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_secure_embed_update_request.rs b/src/datadogV2/model/model_secure_embed_update_request.rs new file mode 100644 index 000000000..5e35c9ead --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_update_request.rs @@ -0,0 +1,94 @@ +// 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 to update a secure embed shared dashboard. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedUpdateRequest { + /// Data object for updating a secure embed. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::SecureEmbedUpdateRequestData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedUpdateRequest { + pub fn new( + data: crate::datadogV2::model::SecureEmbedUpdateRequestData, + ) -> SecureEmbedUpdateRequest { + SecureEmbedUpdateRequest { + 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 SecureEmbedUpdateRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedUpdateRequestVisitor; + impl<'a> Visitor<'a> for SecureEmbedUpdateRequestVisitor { + type Value = SecureEmbedUpdateRequest; + + 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 = SecureEmbedUpdateRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedUpdateRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_update_request_attributes.rs b/src/datadogV2/model/model_secure_embed_update_request_attributes.rs new file mode 100644 index 000000000..38c5ed00e --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_update_request_attributes.rs @@ -0,0 +1,215 @@ +// 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 for updating a secure embed shared dashboard. All fields are optional. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedUpdateRequestAttributes { + /// Default time range configuration for the secure embed. + #[serde(rename = "global_time")] + pub global_time: Option, + /// Updated time selectability. + #[serde(rename = "global_time_selectable")] + pub global_time_selectable: Option, + /// Updated template variables. + #[serde(rename = "selectable_template_vars")] + pub selectable_template_vars: + Option>, + /// The status of the secure embed share. Active means the shared dashboard is available. Paused means it is not. + #[serde(rename = "status")] + pub status: Option, + /// Updated title. + #[serde(rename = "title")] + pub title: Option, + /// Display settings for the secure embed shared dashboard. + #[serde(rename = "viewing_preferences")] + pub viewing_preferences: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedUpdateRequestAttributes { + pub fn new() -> SecureEmbedUpdateRequestAttributes { + SecureEmbedUpdateRequestAttributes { + global_time: None, + global_time_selectable: None, + selectable_template_vars: None, + status: None, + title: None, + viewing_preferences: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn global_time(mut self, value: crate::datadogV2::model::SecureEmbedGlobalTime) -> Self { + self.global_time = Some(value); + self + } + + pub fn global_time_selectable(mut self, value: bool) -> Self { + self.global_time_selectable = Some(value); + self + } + + pub fn selectable_template_vars( + mut self, + value: Vec, + ) -> Self { + self.selectable_template_vars = Some(value); + self + } + + pub fn status(mut self, value: crate::datadogV2::model::SecureEmbedStatus) -> Self { + self.status = Some(value); + self + } + + pub fn title(mut self, value: String) -> Self { + self.title = Some(value); + self + } + + pub fn viewing_preferences( + mut self, + value: crate::datadogV2::model::SecureEmbedViewingPreferences, + ) -> Self { + self.viewing_preferences = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SecureEmbedUpdateRequestAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SecureEmbedUpdateRequestAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedUpdateRequestAttributesVisitor; + impl<'a> Visitor<'a> for SecureEmbedUpdateRequestAttributesVisitor { + type Value = SecureEmbedUpdateRequestAttributes; + + 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 global_time: Option = None; + let mut global_time_selectable: Option = None; + let mut selectable_template_vars: Option< + Vec, + > = None; + let mut status: Option = None; + let mut title: Option = None; + let mut viewing_preferences: Option< + crate::datadogV2::model::SecureEmbedViewingPreferences, + > = 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() { + "global_time" => { + if v.is_null() { + continue; + } + global_time = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "global_time_selectable" => { + if v.is_null() { + continue; + } + global_time_selectable = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "selectable_template_vars" => { + if v.is_null() { + continue; + } + selectable_template_vars = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "status" => { + if v.is_null() { + continue; + } + status = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _status) = status { + match _status { + crate::datadogV2::model::SecureEmbedStatus::UnparsedObject( + _status, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "title" => { + if v.is_null() { + continue; + } + title = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "viewing_preferences" => { + if v.is_null() { + continue; + } + viewing_preferences = + 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 = SecureEmbedUpdateRequestAttributes { + global_time, + global_time_selectable, + selectable_template_vars, + status, + title, + viewing_preferences, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedUpdateRequestAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_update_request_data.rs b/src/datadogV2/model/model_secure_embed_update_request_data.rs new file mode 100644 index 000000000..ef100a563 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_update_request_data.rs @@ -0,0 +1,115 @@ +// 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 for updating a secure embed. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedUpdateRequestData { + /// Attributes for updating a secure embed shared dashboard. All fields are optional. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::SecureEmbedUpdateRequestAttributes, + /// Resource type for secure embed update requests. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::SecureEmbedUpdateRequestType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedUpdateRequestData { + pub fn new( + attributes: crate::datadogV2::model::SecureEmbedUpdateRequestAttributes, + type_: crate::datadogV2::model::SecureEmbedUpdateRequestType, + ) -> SecureEmbedUpdateRequestData { + SecureEmbedUpdateRequestData { + attributes, + type_, + 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 SecureEmbedUpdateRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedUpdateRequestDataVisitor; + impl<'a> Visitor<'a> for SecureEmbedUpdateRequestDataVisitor { + type Value = SecureEmbedUpdateRequestData; + + 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::SecureEmbedUpdateRequestAttributes, + > = 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" => { + 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::SecureEmbedUpdateRequestType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = SecureEmbedUpdateRequestData { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedUpdateRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_update_request_type.rs b/src/datadogV2/model/model_secure_embed_update_request_type.rs new file mode 100644 index 000000000..69a8f6a12 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_update_request_type.rs @@ -0,0 +1,48 @@ +// 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 SecureEmbedUpdateRequestType { + SECURE_EMBED_UPDATE_REQUEST, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecureEmbedUpdateRequestType { + fn to_string(&self) -> String { + match self { + Self::SECURE_EMBED_UPDATE_REQUEST => String::from("secure_embed_update_request"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecureEmbedUpdateRequestType { + 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 SecureEmbedUpdateRequestType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "secure_embed_update_request" => Self::SECURE_EMBED_UPDATE_REQUEST, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_secure_embed_update_response.rs b/src/datadogV2/model/model_secure_embed_update_response.rs new file mode 100644 index 000000000..972eb3f18 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_update_response.rs @@ -0,0 +1,94 @@ +// 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 for updating a secure embed shared dashboard. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedUpdateResponse { + /// Data object for a secure embed update response. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::SecureEmbedUpdateResponseData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedUpdateResponse { + pub fn new( + data: crate::datadogV2::model::SecureEmbedUpdateResponseData, + ) -> SecureEmbedUpdateResponse { + SecureEmbedUpdateResponse { + 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 SecureEmbedUpdateResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedUpdateResponseVisitor; + impl<'a> Visitor<'a> for SecureEmbedUpdateResponseVisitor { + type Value = SecureEmbedUpdateResponse; + + 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 = SecureEmbedUpdateResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedUpdateResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_update_response_attributes.rs b/src/datadogV2/model/model_secure_embed_update_response_attributes.rs new file mode 100644 index 000000000..b3be14712 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_update_response_attributes.rs @@ -0,0 +1,344 @@ +// 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 updated secure embed shared dashboard. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedUpdateResponseAttributes { + /// Creation timestamp. + #[serde(rename = "created_at")] + pub created_at: Option, + /// Last 4 characters of the credential. Defaults to `0000` if unavailable. + #[serde(rename = "credential_suffix")] + pub credential_suffix: Option, + /// The source dashboard ID. + #[serde(rename = "dashboard_id")] + pub dashboard_id: Option, + /// Default time range configuration for the secure embed. + #[serde(rename = "global_time")] + pub global_time: Option, + /// Whether time range is viewer-selectable. + #[serde(rename = "global_time_selectable")] + pub global_time_selectable: Option, + /// Internal share ID. + #[serde(rename = "id")] + pub id: Option, + /// Template variables with their configuration. + #[serde(rename = "selectable_template_vars")] + pub selectable_template_vars: + Option>, + /// The type of share. Always `secure_embed`. + #[serde(rename = "share_type")] + pub share_type: Option, + /// The status of the secure embed share. Active means the shared dashboard is available. Paused means it is not. + #[serde(rename = "status")] + pub status: Option, + /// Display title. + #[serde(rename = "title")] + pub title: Option, + /// Public share token. + #[serde(rename = "token")] + pub token: Option, + /// CDN URL for the shared dashboard. + #[serde(rename = "url")] + pub url: Option, + /// Display settings for the secure embed shared dashboard. + #[serde(rename = "viewing_preferences")] + pub viewing_preferences: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedUpdateResponseAttributes { + pub fn new() -> SecureEmbedUpdateResponseAttributes { + SecureEmbedUpdateResponseAttributes { + created_at: None, + credential_suffix: None, + dashboard_id: None, + global_time: None, + global_time_selectable: None, + id: None, + selectable_template_vars: None, + share_type: None, + status: None, + title: None, + token: None, + url: None, + viewing_preferences: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_at(mut self, value: String) -> Self { + self.created_at = Some(value); + self + } + + pub fn credential_suffix(mut self, value: String) -> Self { + self.credential_suffix = Some(value); + self + } + + pub fn dashboard_id(mut self, value: String) -> Self { + self.dashboard_id = Some(value); + self + } + + pub fn global_time(mut self, value: crate::datadogV2::model::SecureEmbedGlobalTime) -> Self { + self.global_time = Some(value); + self + } + + pub fn global_time_selectable(mut self, value: bool) -> Self { + self.global_time_selectable = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn selectable_template_vars( + mut self, + value: Vec, + ) -> Self { + self.selectable_template_vars = Some(value); + self + } + + pub fn share_type(mut self, value: crate::datadogV2::model::SecureEmbedShareType) -> Self { + self.share_type = Some(value); + self + } + + pub fn status(mut self, value: crate::datadogV2::model::SecureEmbedStatus) -> Self { + self.status = Some(value); + self + } + + pub fn title(mut self, value: String) -> Self { + self.title = Some(value); + self + } + + pub fn token(mut self, value: String) -> Self { + self.token = Some(value); + self + } + + pub fn url(mut self, value: String) -> Self { + self.url = Some(value); + self + } + + pub fn viewing_preferences( + mut self, + value: crate::datadogV2::model::SecureEmbedViewingPreferences, + ) -> Self { + self.viewing_preferences = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SecureEmbedUpdateResponseAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SecureEmbedUpdateResponseAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedUpdateResponseAttributesVisitor; + impl<'a> Visitor<'a> for SecureEmbedUpdateResponseAttributesVisitor { + type Value = SecureEmbedUpdateResponseAttributes; + + 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 created_at: Option = None; + let mut credential_suffix: Option = None; + let mut dashboard_id: Option = None; + let mut global_time: Option = None; + let mut global_time_selectable: Option = None; + let mut id: Option = None; + let mut selectable_template_vars: Option< + Vec, + > = None; + let mut share_type: Option = None; + let mut status: Option = None; + let mut title: Option = None; + let mut token: Option = None; + let mut url: Option = None; + let mut viewing_preferences: Option< + crate::datadogV2::model::SecureEmbedViewingPreferences, + > = 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() { + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "credential_suffix" => { + if v.is_null() { + continue; + } + credential_suffix = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "dashboard_id" => { + if v.is_null() { + continue; + } + dashboard_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "global_time" => { + if v.is_null() { + continue; + } + global_time = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "global_time_selectable" => { + if v.is_null() { + continue; + } + global_time_selectable = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "selectable_template_vars" => { + if v.is_null() { + continue; + } + selectable_template_vars = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "share_type" => { + if v.is_null() { + continue; + } + share_type = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _share_type) = share_type { + match _share_type { + crate::datadogV2::model::SecureEmbedShareType::UnparsedObject(_share_type) => { + _unparsed = true; + }, + _ => {} + } + } + } + "status" => { + if v.is_null() { + continue; + } + status = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _status) = status { + match _status { + crate::datadogV2::model::SecureEmbedStatus::UnparsedObject( + _status, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "title" => { + if v.is_null() { + continue; + } + title = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "token" => { + if v.is_null() { + continue; + } + token = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "url" => { + if v.is_null() { + continue; + } + url = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "viewing_preferences" => { + if v.is_null() { + continue; + } + viewing_preferences = + 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 = SecureEmbedUpdateResponseAttributes { + created_at, + credential_suffix, + dashboard_id, + global_time, + global_time_selectable, + id, + selectable_template_vars, + share_type, + status, + title, + token, + url, + viewing_preferences, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedUpdateResponseAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_update_response_data.rs b/src/datadogV2/model/model_secure_embed_update_response_data.rs new file mode 100644 index 000000000..3e0e3275f --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_update_response_data.rs @@ -0,0 +1,127 @@ +// 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 for a secure embed update response. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedUpdateResponseData { + /// Attributes of an updated secure embed shared dashboard. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::SecureEmbedUpdateResponseAttributes, + /// Internal share ID. + #[serde(rename = "id")] + pub id: String, + /// Resource type for secure embed update responses. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::SecureEmbedUpdateResponseType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedUpdateResponseData { + pub fn new( + attributes: crate::datadogV2::model::SecureEmbedUpdateResponseAttributes, + id: String, + type_: crate::datadogV2::model::SecureEmbedUpdateResponseType, + ) -> SecureEmbedUpdateResponseData { + SecureEmbedUpdateResponseData { + attributes, + id, + type_, + 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 SecureEmbedUpdateResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedUpdateResponseDataVisitor; + impl<'a> Visitor<'a> for SecureEmbedUpdateResponseDataVisitor { + type Value = SecureEmbedUpdateResponseData; + + 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::SecureEmbedUpdateResponseAttributes, + > = None; + let mut id: Option = 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" => { + 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)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::SecureEmbedUpdateResponseType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + 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 = SecureEmbedUpdateResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedUpdateResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_update_response_type.rs b/src/datadogV2/model/model_secure_embed_update_response_type.rs new file mode 100644 index 000000000..d8efe6a78 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_update_response_type.rs @@ -0,0 +1,48 @@ +// 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 SecureEmbedUpdateResponseType { + SECURE_EMBED_UPDATE_RESPONSE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecureEmbedUpdateResponseType { + fn to_string(&self) -> String { + match self { + Self::SECURE_EMBED_UPDATE_RESPONSE => String::from("secure_embed_update_response"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecureEmbedUpdateResponseType { + 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 SecureEmbedUpdateResponseType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "secure_embed_update_response" => Self::SECURE_EMBED_UPDATE_RESPONSE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_secure_embed_viewing_preferences.rs b/src/datadogV2/model/model_secure_embed_viewing_preferences.rs new file mode 100644 index 000000000..258c31896 --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_viewing_preferences.rs @@ -0,0 +1,135 @@ +// 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}; + +/// Display settings for the secure embed shared dashboard. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct SecureEmbedViewingPreferences { + /// Whether widgets are displayed in high density mode. + #[serde(rename = "high_density")] + pub high_density: Option, + /// The theme of the shared dashboard view. `system` follows the viewer's system default. + #[serde(rename = "theme")] + pub theme: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl SecureEmbedViewingPreferences { + pub fn new() -> SecureEmbedViewingPreferences { + SecureEmbedViewingPreferences { + high_density: None, + theme: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn high_density(mut self, value: bool) -> Self { + self.high_density = Some(value); + self + } + + pub fn theme( + mut self, + value: crate::datadogV2::model::SecureEmbedViewingPreferencesTheme, + ) -> Self { + self.theme = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for SecureEmbedViewingPreferences { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for SecureEmbedViewingPreferences { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SecureEmbedViewingPreferencesVisitor; + impl<'a> Visitor<'a> for SecureEmbedViewingPreferencesVisitor { + type Value = SecureEmbedViewingPreferences; + + 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 high_density: Option = None; + let mut theme: 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() { + "high_density" => { + if v.is_null() { + continue; + } + high_density = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "theme" => { + if v.is_null() { + continue; + } + theme = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _theme) = theme { + match _theme { + crate::datadogV2::model::SecureEmbedViewingPreferencesTheme::UnparsedObject(_theme) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = SecureEmbedViewingPreferences { + high_density, + theme, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(SecureEmbedViewingPreferencesVisitor) + } +} diff --git a/src/datadogV2/model/model_secure_embed_viewing_preferences_theme.rs b/src/datadogV2/model/model_secure_embed_viewing_preferences_theme.rs new file mode 100644 index 000000000..5f2fc297d --- /dev/null +++ b/src/datadogV2/model/model_secure_embed_viewing_preferences_theme.rs @@ -0,0 +1,54 @@ +// 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 SecureEmbedViewingPreferencesTheme { + SYSTEM, + LIGHT, + DARK, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for SecureEmbedViewingPreferencesTheme { + fn to_string(&self) -> String { + match self { + Self::SYSTEM => String::from("system"), + Self::LIGHT => String::from("light"), + Self::DARK => String::from("dark"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for SecureEmbedViewingPreferencesTheme { + 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 SecureEmbedViewingPreferencesTheme { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "system" => Self::SYSTEM, + "light" => Self::LIGHT, + "dark" => Self::DARK, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/tests/scenarios/features/v2/dashboard_secure_embed.feature b/tests/scenarios/features/v2/dashboard_secure_embed.feature new file mode 100644 index 000000000..25cb5335e --- /dev/null +++ b/tests/scenarios/features/v2/dashboard_secure_embed.feature @@ -0,0 +1,99 @@ +@endpoint(dashboard-secure-embed) @endpoint(dashboard-secure-embed-v2) @endpoint(https://api.datadoghq.com) @endpoint(https://api.datadoghq.eu) @endpoint(https://api.ddog-gov.com) @endpoint(https://api.us5.datadoghq.com) +Feature: Dashboard Secure Embed + Manage securely embedded Datadog dashboards. Secure embeds use HMAC-SHA256 + signed sessions for authentication, enabling customers to embed dashboards + in their own applications with server-side auth control. Unlike public + dashboards (open URL) or invite dashboards (email-based access), secure + embeds provide programmatic access control. **Requirements:** - Org + setting: SharedDashboards > Embed sharing must be enabled. - AuthN: + Datadog API key and application key. - Read operations require + `dashboards_read` permission. - Write operations require + `dashboards_embed_share` permission. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "DashboardSecureEmbed" API + + @generated @skip @team:DataDog/dashboardsnotebooks-backend + Scenario: Create a secure embed for a dashboard returns "Conflict — max 1000 share URLs per dashboard exceeded" response + Given operation "CreateDashboardSecureEmbed" enabled + And new "CreateDashboardSecureEmbed" request + And request contains "dashboard_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"global_time": {"live_span": "1h"}, "global_time_selectable": true, "selectable_template_vars": [{"default_values": ["1"], "name": "org_id", "prefix": "org_id", "visible_tags": ["1"]}], "status": "active", "title": "Q1 Metrics Dashboard", "viewing_preferences": {"high_density": false, "theme": "system"}}, "type": "secure_embed_request"}} + When the request is sent + Then the response status is 409 Conflict — max 1000 share URLs per dashboard exceeded + + @generated @skip @team:DataDog/dashboardsnotebooks-backend + Scenario: Create a secure embed for a dashboard returns "Dashboard Not Found" response + Given operation "CreateDashboardSecureEmbed" enabled + And new "CreateDashboardSecureEmbed" request + And request contains "dashboard_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"global_time": {"live_span": "1h"}, "global_time_selectable": true, "selectable_template_vars": [{"default_values": ["1"], "name": "org_id", "prefix": "org_id", "visible_tags": ["1"]}], "status": "active", "title": "Q1 Metrics Dashboard", "viewing_preferences": {"high_density": false, "theme": "system"}}, "type": "secure_embed_request"}} + When the request is sent + Then the response status is 404 Dashboard Not Found + + @generated @skip @team:DataDog/dashboardsnotebooks-backend + Scenario: Create a secure embed for a dashboard returns "OK" response + Given operation "CreateDashboardSecureEmbed" enabled + And new "CreateDashboardSecureEmbed" request + And request contains "dashboard_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"global_time": {"live_span": "1h"}, "global_time_selectable": true, "selectable_template_vars": [{"default_values": ["1"], "name": "org_id", "prefix": "org_id", "visible_tags": ["1"]}], "status": "active", "title": "Q1 Metrics Dashboard", "viewing_preferences": {"high_density": false, "theme": "system"}}, "type": "secure_embed_request"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/dashboardsnotebooks-backend + Scenario: Delete a secure embed for a dashboard returns "No Content" response + Given operation "DeleteDashboardSecureEmbed" enabled + And new "DeleteDashboardSecureEmbed" request + And request contains "dashboard_id" parameter from "REPLACE.ME" + And request contains "token" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/dashboardsnotebooks-backend + Scenario: Delete a secure embed for a dashboard returns "Not Found" response + Given operation "DeleteDashboardSecureEmbed" enabled + And new "DeleteDashboardSecureEmbed" request + And request contains "dashboard_id" parameter from "REPLACE.ME" + And request contains "token" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/dashboardsnotebooks-backend + Scenario: Get a secure embed for a dashboard returns "Not Found" response + Given operation "GetDashboardSecureEmbed" enabled + And new "GetDashboardSecureEmbed" request + And request contains "dashboard_id" parameter from "REPLACE.ME" + And request contains "token" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/dashboardsnotebooks-backend + Scenario: Get a secure embed for a dashboard returns "OK" response + Given operation "GetDashboardSecureEmbed" enabled + And new "GetDashboardSecureEmbed" request + And request contains "dashboard_id" parameter from "REPLACE.ME" + And request contains "token" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/dashboardsnotebooks-backend + Scenario: Update a secure embed for a dashboard returns "Not Found" response + Given operation "UpdateDashboardSecureEmbed" enabled + And new "UpdateDashboardSecureEmbed" request + And request contains "dashboard_id" parameter from "REPLACE.ME" + And request contains "token" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"global_time": {"live_span": "1h"}, "global_time_selectable": true, "selectable_template_vars": [{"default_values": ["1"], "name": "org_id", "prefix": "org_id", "visible_tags": ["1"]}], "status": "active", "title": "Q1 Metrics Dashboard (Updated)", "viewing_preferences": {"high_density": false, "theme": "system"}}, "type": "secure_embed_update_request"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/dashboardsnotebooks-backend + Scenario: Update a secure embed for a dashboard returns "OK" response + Given operation "UpdateDashboardSecureEmbed" enabled + And new "UpdateDashboardSecureEmbed" request + And request contains "dashboard_id" parameter from "REPLACE.ME" + And request contains "token" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"global_time": {"live_span": "1h"}, "global_time_selectable": true, "selectable_template_vars": [{"default_values": ["1"], "name": "org_id", "prefix": "org_id", "visible_tags": ["1"]}], "status": "active", "title": "Q1 Metrics Dashboard (Updated)", "viewing_preferences": {"high_density": false, "theme": "system"}}, "type": "secure_embed_update_request"}} + 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 078ced2bd..ca868f2fc 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -1470,6 +1470,41 @@ "type": "safe" } }, + "CreateDashboardSecureEmbed": { + "tag": "Dashboard Secure Embed", + "undo": { + "operationId": "DeleteDashboardSecureEmbed", + "parameters": [ + { + "name": "dashboard_id", + "source": "data.attributes.dashboard_id" + }, + { + "name": "token", + "source": "data.attributes.token" + } + ], + "type": "unsafe" + } + }, + "DeleteDashboardSecureEmbed": { + "tag": "Dashboard Secure Embed", + "undo": { + "type": "idempotent" + } + }, + "GetDashboardSecureEmbed": { + "tag": "Dashboard Secure Embed", + "undo": { + "type": "safe" + } + }, + "UpdateDashboardSecureEmbed": { + "tag": "Dashboard Secure Embed", + "undo": { + "type": "idempotent" + } + }, "GetAllDatasets": { "tag": "Datasets", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index 40d6f7cbf..e98ec559b 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -88,6 +88,8 @@ pub struct ApiInstances { pub v2_api_csm_coverage_analysis: Option, pub v2_api_dashboard_lists: Option, + pub v2_api_dashboard_secure_embed: + Option, pub v2_api_datasets: Option, pub v2_api_data_deletion: Option, pub v2_api_deployment_gates: Option, @@ -712,6 +714,12 @@ pub fn initialize_api_instance(world: &mut DatadogWorld, api: String) { world.http_client.as_ref().unwrap().clone() )); } + "DashboardSecureEmbed" => { + world.api_instances.v2_api_dashboard_secure_embed = Some(datadogV2::api_dashboard_secure_embed::DashboardSecureEmbedAPI::with_client_and_config( + world.config.clone(), + world.http_client.as_ref().unwrap().clone() + )); + } "Datasets" => { world.api_instances.v2_api_datasets = Some( datadogV2::api_datasets::DatasetsAPI::with_client_and_config( @@ -3251,6 +3259,22 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { "v2.UpdateDashboardListItems".into(), test_v2_update_dashboard_list_items, ); + world.function_mappings.insert( + "v2.CreateDashboardSecureEmbed".into(), + test_v2_create_dashboard_secure_embed, + ); + world.function_mappings.insert( + "v2.DeleteDashboardSecureEmbed".into(), + test_v2_delete_dashboard_secure_embed, + ); + world.function_mappings.insert( + "v2.GetDashboardSecureEmbed".into(), + test_v2_get_dashboard_secure_embed, + ); + world.function_mappings.insert( + "v2.UpdateDashboardSecureEmbed".into(), + test_v2_update_dashboard_secure_embed, + ); world .function_mappings .insert("v2.GetAllDatasets".into(), test_v2_get_all_datasets); @@ -23862,6 +23886,132 @@ fn test_v2_update_dashboard_list_items( world.response.code = response.status.as_u16(); } +fn test_v2_create_dashboard_secure_embed( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_dashboard_secure_embed + .as_ref() + .expect("api instance not found"); + let dashboard_id = + serde_json::from_value(_parameters.get("dashboard_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = + match block_on(api.create_dashboard_secure_embed_with_http_info(dashboard_id, 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_delete_dashboard_secure_embed( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_dashboard_secure_embed + .as_ref() + .expect("api instance not found"); + let dashboard_id = + serde_json::from_value(_parameters.get("dashboard_id").unwrap().clone()).unwrap(); + let token = serde_json::from_value(_parameters.get("token").unwrap().clone()).unwrap(); + let response = + match block_on(api.delete_dashboard_secure_embed_with_http_info(dashboard_id, token)) { + 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_dashboard_secure_embed( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_dashboard_secure_embed + .as_ref() + .expect("api instance not found"); + let dashboard_id = + serde_json::from_value(_parameters.get("dashboard_id").unwrap().clone()).unwrap(); + let token = serde_json::from_value(_parameters.get("token").unwrap().clone()).unwrap(); + let response = + match block_on(api.get_dashboard_secure_embed_with_http_info(dashboard_id, token)) { + 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_update_dashboard_secure_embed( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_dashboard_secure_embed + .as_ref() + .expect("api instance not found"); + let dashboard_id = + serde_json::from_value(_parameters.get("dashboard_id").unwrap().clone()).unwrap(); + let token = serde_json::from_value(_parameters.get("token").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = + match block_on(api.update_dashboard_secure_embed_with_http_info(dashboard_id, token, 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_get_all_datasets(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances