From 63385418b5c020485ce03d0f637428cfc0d52ce7 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 18 Jun 2026 17:38:35 +0000 Subject: [PATCH] Regenerate client from commit 3847a9b of spec repo --- .generator/schemas/v2/openapi.yaml | 429 +++++++++++++++++- ...tatus-pages_CreateBackfilledMaintenance.rs | 20 +- examples/v2_status-pages_CreateMaintenance.rs | 14 +- ...atus-pages_CreateMaintenance_2202276054.rs | 14 +- .../v2_status-pages_EditDegradationUpdate.rs | 44 ++ ...tatus-pages_SoftDeleteDegradationUpdate.rs | 22 + src/datadogV2/api/api_status_pages.rs | 312 +++++++++++++ src/datadogV2/model/mod.rs | 34 ++ ...e_request_data_attributes_updates_items.rs | 23 +- ...ate_maintenance_request_data_attributes.rs | 23 +- ...ate_status_page_request_data_attributes.rs | 53 +++ ...gradation_data_attributes_updates_items.rs | 35 ++ .../model/model_degradation_update.rs | 126 +++++ .../model/model_degradation_update_data.rs | 166 +++++++ ...odel_degradation_update_data_attributes.rs | 228 ++++++++++ ...ta_attributes_components_affected_items.rs | 132 ++++++ ...l_degradation_update_data_relationships.rs | 204 +++++++++ ...n_update_data_relationships_degradation.rs | 96 ++++ ...ate_data_relationships_degradation_data.rs | 114 +++++ ...n_update_data_relationships_status_page.rs | 96 ++++ ...ate_data_relationships_status_page_data.rs | 115 +++++ ...radation_update_data_relationships_user.rs | 96 ++++ ...ion_update_data_relationships_user_data.rs | 113 +++++ .../model_degradation_update_included.rs | 49 ++ .../model_patch_degradation_update_request.rs | 109 +++++ ...l_patch_degradation_update_request_data.rs | 143 ++++++ ...radation_update_request_data_attributes.rs | 136 ++++++ ...n_update_request_data_attributes_status.rs | 54 +++ ...ch_degradation_update_request_data_type.rs | 48 ++ ...tch_status_page_request_data_attributes.rs | 36 ++ ...odel_status_page_as_included_attributes.rs | 36 ++ .../model_status_page_data_attributes.rs | 36 ++ .../features/v2/status_pages.feature | 19 + tests/scenarios/features/v2/undo.json | 12 + tests/scenarios/function_mappings.rs | 83 ++++ 35 files changed, 3208 insertions(+), 62 deletions(-) create mode 100644 examples/v2_status-pages_EditDegradationUpdate.rs create mode 100644 examples/v2_status-pages_SoftDeleteDegradationUpdate.rs create mode 100644 src/datadogV2/model/model_degradation_update.rs create mode 100644 src/datadogV2/model/model_degradation_update_data.rs create mode 100644 src/datadogV2/model/model_degradation_update_data_attributes.rs create mode 100644 src/datadogV2/model/model_degradation_update_data_attributes_components_affected_items.rs create mode 100644 src/datadogV2/model/model_degradation_update_data_relationships.rs create mode 100644 src/datadogV2/model/model_degradation_update_data_relationships_degradation.rs create mode 100644 src/datadogV2/model/model_degradation_update_data_relationships_degradation_data.rs create mode 100644 src/datadogV2/model/model_degradation_update_data_relationships_status_page.rs create mode 100644 src/datadogV2/model/model_degradation_update_data_relationships_status_page_data.rs create mode 100644 src/datadogV2/model/model_degradation_update_data_relationships_user.rs create mode 100644 src/datadogV2/model/model_degradation_update_data_relationships_user_data.rs create mode 100644 src/datadogV2/model/model_degradation_update_included.rs create mode 100644 src/datadogV2/model/model_patch_degradation_update_request.rs create mode 100644 src/datadogV2/model/model_patch_degradation_update_request_data.rs create mode 100644 src/datadogV2/model/model_patch_degradation_update_request_data_attributes.rs create mode 100644 src/datadogV2/model/model_patch_degradation_update_request_data_attributes_status.rs create mode 100644 src/datadogV2/model/model_patch_degradation_update_request_data_type.rs diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 51127c3aea..500a331990 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -22843,7 +22843,6 @@ components: status: $ref: "#/components/schemas/CreateMaintenanceRequestDataAttributesUpdatesItemsStatus" required: - - components_affected - description - started_at - status @@ -23789,7 +23788,6 @@ components: example: "API Maintenance" type: string required: - - components_affected - title - completed_date - completed_description @@ -24472,6 +24470,9 @@ components: description: Base64-encoded image data included in email notifications sent to status page subscribers. example: data:image/png;base64,pQSLAw0KGgoAAAANSUhEUgAAAQ4AASJKFF type: string + enabled: + description: Whether the status page is enabled. + type: boolean favicon: description: Base64-encoded image data displayed in the browser tab. example: data:image/png;base64,kWMRNw0KGgoAAAANSUhEUgAAAEAAAABACA @@ -24480,6 +24481,12 @@ components: description: The name of the status page. example: Status Page US1 type: string + slack_app_icon: + description: The Slack app icon URL for the status page. + type: string + slack_subscriptions_enabled: + description: Whether Slack subscriptions are enabled for the status page. + type: boolean subscriptions_enabled: description: Whether users can subscribe to the status page. example: true @@ -29747,6 +29754,12 @@ components: format: date-time readOnly: true type: string + deleted_at: + description: The date and time the resource was deleted. + type: string + deleted_by_user_uuid: + description: UUID of the user who deleted the resource. + type: string description: description: Description of the update. type: string @@ -29871,6 +29884,162 @@ components: oneOf: - $ref: "#/components/schemas/StatusPagesUser" - $ref: "#/components/schemas/StatusPageAsIncluded" + DegradationUpdate: + description: Response object for a degradation update. + properties: + data: + $ref: "#/components/schemas/DegradationUpdateData" + included: + description: Resources related to the degradation update. + items: + $ref: "#/components/schemas/DegradationUpdateIncluded" + type: array + type: object + DegradationUpdateData: + description: The data object for a degradation update. + properties: + attributes: + $ref: "#/components/schemas/DegradationUpdateDataAttributes" + id: + description: The ID of the degradation update. + type: string + relationships: + $ref: "#/components/schemas/DegradationUpdateDataRelationships" + type: + $ref: "#/components/schemas/PatchDegradationUpdateRequestDataType" + required: + - type + type: object + DegradationUpdateDataAttributes: + description: Attributes of a degradation update resource. + properties: + components_affected: + description: Components affected by this update. + items: + $ref: "#/components/schemas/DegradationUpdateDataAttributesComponentsAffectedItems" + type: array + created_at: + description: The date and time the update was created. + format: date-time + type: string + deleted_at: + description: The date and time the update was soft-deleted. + format: date-time + type: string + description: + description: The message body of the update. + type: string + modified_at: + description: The date and time the update was last modified. + format: date-time + type: string + started_at: + description: The date and time the update started. + format: date-time + type: string + status: + $ref: "#/components/schemas/CreateDegradationRequestDataAttributesStatus" + type: object + DegradationUpdateDataAttributesComponentsAffectedItems: + description: A component affected by a degradation update. + properties: + id: + description: The ID of the affected component. + example: "" + type: string + name: + description: The name of the affected component. + readOnly: true + type: string + status: + $ref: "#/components/schemas/StatusPagesComponentDataAttributesStatus" + required: + - id + - status + type: object + DegradationUpdateDataRelationships: + description: Relationships of a degradation update resource. + properties: + created_by_user: + $ref: "#/components/schemas/DegradationUpdateDataRelationshipsUser" + degradation: + $ref: "#/components/schemas/DegradationUpdateDataRelationshipsDegradation" + deleted_by_user: + $ref: "#/components/schemas/DegradationUpdateDataRelationshipsUser" + last_modified_by_user: + $ref: "#/components/schemas/DegradationUpdateDataRelationshipsUser" + status_page: + $ref: "#/components/schemas/DegradationUpdateDataRelationshipsStatusPage" + type: object + DegradationUpdateDataRelationshipsDegradation: + description: The degradation relationship of a degradation update. + properties: + data: + $ref: "#/components/schemas/DegradationUpdateDataRelationshipsDegradationData" + required: + - data + type: object + DegradationUpdateDataRelationshipsDegradationData: + description: The degradation linked to a degradation update. + properties: + id: + description: The ID of the degradation. + example: "" + type: string + type: + $ref: "#/components/schemas/PatchDegradationRequestDataType" + required: + - type + - id + type: object + DegradationUpdateDataRelationshipsStatusPage: + description: The status page relationship of a degradation update. + properties: + data: + $ref: "#/components/schemas/DegradationUpdateDataRelationshipsStatusPageData" + required: + - data + type: object + DegradationUpdateDataRelationshipsStatusPageData: + description: The status page linked to a degradation update. + properties: + id: + description: The ID of the status page. + example: "" + type: string + type: + $ref: "#/components/schemas/StatusPageDataType" + required: + - type + - id + type: object + DegradationUpdateDataRelationshipsUser: + description: A user relationship of a degradation update. + properties: + data: + $ref: "#/components/schemas/DegradationUpdateDataRelationshipsUserData" + required: + - data + type: object + DegradationUpdateDataRelationshipsUserData: + description: A Datadog user linked to a degradation update. + properties: + id: + description: The ID of the user. + example: "" + type: string + type: + $ref: "#/components/schemas/StatusPagesUserType" + required: + - type + - id + type: object + DegradationUpdateIncluded: + description: Resources included in a degradation update response. + oneOf: + - $ref: "#/components/schemas/StatusPagesUser" + - $ref: "#/components/schemas/Degradation" + - $ref: "#/components/schemas/StatusPageAsIncluded" DeleteAppResponse: description: The response object after an app is successfully deleted. properties: @@ -71960,6 +72129,61 @@ components: type: string x-enum-varnames: - DEGRADATIONS + PatchDegradationUpdateRequest: + description: Request object for editing a degradation update. + example: + data: + attributes: + description: We've identified the source of the latency increase and are deploying a fix. + status: identified + id: 00000000-0000-0000-0000-000000000000 + type: degradation_updates + properties: + data: + $ref: "#/components/schemas/PatchDegradationUpdateRequestData" + type: object + PatchDegradationUpdateRequestData: + description: The data object for editing a degradation update. + properties: + attributes: + $ref: "#/components/schemas/PatchDegradationUpdateRequestDataAttributes" + id: + description: The ID of the degradation update to edit. + type: string + type: + $ref: "#/components/schemas/PatchDegradationUpdateRequestDataType" + required: + - type + type: object + PatchDegradationUpdateRequestDataAttributes: + description: Attributes for editing a degradation update. + properties: + description: + description: The message body of the update. + type: string + status: + $ref: "#/components/schemas/PatchDegradationUpdateRequestDataAttributesStatus" + type: object + PatchDegradationUpdateRequestDataAttributesStatus: + description: The status of the degradation update. + enum: + - investigating + - identified + - monitoring + type: string + x-enum-varnames: + - INVESTIGATING + - IDENTIFIED + - MONITORING + PatchDegradationUpdateRequestDataType: + default: degradation_updates + description: Degradation updates resource type. + enum: + - degradation_updates + example: degradation_updates + type: string + x-enum-varnames: + - DEGRADATION_UPDATES PatchIncidentNotificationTemplateRequest: description: Update request for a notification template. properties: @@ -72174,6 +72398,12 @@ components: description: The name of the status page. example: Status Page US1 type: string + slack_app_icon: + description: The Slack app icon URL for the status page. + type: string + slack_subscriptions_enabled: + description: Whether Slack subscriptions are enabled for the status page. + type: boolean subscriptions_enabled: description: Whether users can subscribe to the status page. example: true @@ -93878,6 +94108,12 @@ components: page_url: description: The url that the status page is accessible at. type: string + slack_app_icon: + description: The Slack app icon URL for the status page. + type: string + slack_subscriptions_enabled: + description: Whether Slack subscriptions are enabled for the status page. + type: boolean subscriptions_enabled: description: Whether users can subscribe to the status page. type: boolean @@ -94046,6 +94282,12 @@ components: page_url: description: The url that the status page is accessible at. type: string + slack_app_icon: + description: The Slack app icon URL for the status page. + type: string + slack_subscriptions_enabled: + description: Whether Slack subscriptions are enabled for the status page. + type: boolean subscriptions_enabled: description: Whether users can subscribe to the status page. type: boolean @@ -182940,7 +183182,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_settings_read summary: List status pages tags: - Status Pages @@ -183020,7 +183263,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_settings_write summary: Create status page tags: - Status Pages @@ -183093,7 +183337,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_settings_read summary: List degradations tags: - Status Pages @@ -183167,7 +183412,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_settings_read summary: List maintenances tags: - Status Pages @@ -183196,7 +183442,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_settings_write summary: Delete status page tags: - Status Pages @@ -183247,7 +183494,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_settings_read summary: Get status page tags: - Status Pages @@ -183326,7 +183574,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_settings_write summary: Update status page tags: - Status Pages @@ -183375,7 +183624,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_settings_read summary: List components tags: - Status Pages @@ -183441,7 +183691,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_settings_write summary: Create component tags: - Status Pages @@ -183478,7 +183729,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_settings_write summary: Delete component tags: - Status Pages @@ -183534,7 +183786,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_settings_read summary: Get component tags: - Status Pages @@ -183605,7 +183858,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_settings_write summary: Update component tags: - Status Pages @@ -183683,7 +183937,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_incident_write summary: Create degradation tags: - Status Pages @@ -183762,7 +184017,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_incident_write summary: Create backfilled degradation tags: - Status Pages @@ -183799,7 +184055,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_incident_write summary: Delete degradation tags: - Status Pages @@ -183860,7 +184117,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_settings_read summary: Get degradation tags: - Status Pages @@ -183946,7 +184204,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_incident_write summary: Update degradation tags: - Status Pages @@ -183954,6 +184213,116 @@ paths: operator: AND permissions: - status_pages_incident_write + /api/v2/statuspages/{page_id}/degradations/{degradation_id}/updates/{update_id}: + delete: + description: Soft-deletes a degradation update. + operationId: SoftDeleteDegradationUpdate + parameters: + - description: The ID of the degradation. + in: path + name: degradation_id + required: true + schema: + format: uuid + type: string + - description: The ID of the status page. + in: path + name: page_id + required: true + schema: + format: uuid + type: string + - description: The ID of the degradation update. + in: path + name: update_id + required: true + schema: + format: uuid + type: string + responses: + "204": + description: No Content + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - status_pages_incident_write + summary: Soft delete degradation update + tags: + - Status Pages + patch: + description: Edits a specific degradation update. + operationId: EditDegradationUpdate + parameters: + - description: The ID of the degradation. + in: path + name: degradation_id + required: true + schema: + format: uuid + type: string + - description: "Comma-separated list of resources to include. Supported values: created_by_user, last_modified_by_user, degradation, status_page." + in: query + name: include + schema: + type: string + - description: The ID of the status page. + in: path + name: page_id + required: true + schema: + format: uuid + type: string + - description: The ID of the degradation update. + in: path + name: update_id + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + description: We've identified the source of the latency increase and are deploying a fix. + status: identified + id: 00000000-0000-0000-0000-000000000000 + type: degradation_updates + schema: + $ref: "#/components/schemas/PatchDegradationUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + description: We've identified the source of the latency increase and are deploying a fix. + status: identified + id: 00000000-0000-0000-0000-000000000000 + type: degradation_updates + schema: + $ref: "#/components/schemas/DegradationUpdate" + description: OK + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - status_pages_incident_write + summary: Edit degradation update + tags: + - Status Pages /api/v2/statuspages/{page_id}/maintenances: post: description: Schedules a new maintenance. @@ -184025,7 +184394,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_incident_write summary: Schedule maintenance tags: - Status Pages @@ -184103,7 +184473,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_incident_write summary: Create backfilled maintenance tags: - Status Pages @@ -184162,7 +184533,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_settings_read summary: Get maintenance tags: - Status Pages @@ -184244,7 +184616,8 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_incident_write summary: Update maintenance tags: - Status Pages @@ -184272,7 +184645,10 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_internal_page_publish + - status_pages_public_page_publish + - status_pages_settings_write summary: Publish status page tags: - Status Pages @@ -184302,7 +184678,10 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - - AuthZ: [] + - AuthZ: + - status_pages_internal_page_publish + - status_pages_public_page_publish + - status_pages_settings_write summary: Unpublish status page tags: - Status Pages diff --git a/examples/v2_status-pages_CreateBackfilledMaintenance.rs b/examples/v2_status-pages_CreateBackfilledMaintenance.rs index 6873bda462..0e75615f9c 100644 --- a/examples/v2_status-pages_CreateBackfilledMaintenance.rs +++ b/examples/v2_status-pages_CreateBackfilledMaintenance.rs @@ -31,30 +31,32 @@ async fn main() { "Past Database Maintenance".to_string(), vec![ CreateBackfilledMaintenanceRequestDataAttributesUpdatesItems::new( - vec![ - CreateMaintenanceRequestDataAttributesComponentsAffectedItems::new( - status_page_data_attributes_components_0_components_0_id.clone(), - PatchMaintenanceRequestDataAttributesComponentsAffectedItemsStatus::MAINTENANCE, - ) - ], "Database maintenance is in progress.".to_string(), DateTime::parse_from_rfc3339("2021-11-11T10:11:11+00:00") .expect("Failed to parse datetime") .with_timezone(&Utc), CreateMaintenanceRequestDataAttributesUpdatesItemsStatus::IN_PROGRESS, - ), - CreateBackfilledMaintenanceRequestDataAttributesUpdatesItems::new( + ).components_affected( vec![ CreateMaintenanceRequestDataAttributesComponentsAffectedItems::new( status_page_data_attributes_components_0_components_0_id.clone(), - PatchMaintenanceRequestDataAttributesComponentsAffectedItemsStatus::OPERATIONAL, + PatchMaintenanceRequestDataAttributesComponentsAffectedItemsStatus::MAINTENANCE, ) ], + ), + CreateBackfilledMaintenanceRequestDataAttributesUpdatesItems::new( "Database maintenance has been completed successfully.".to_string(), DateTime::parse_from_rfc3339("2021-11-11T11:11:11+00:00") .expect("Failed to parse datetime") .with_timezone(&Utc), CreateMaintenanceRequestDataAttributesUpdatesItemsStatus::COMPLETED, + ).components_affected( + vec![ + CreateMaintenanceRequestDataAttributesComponentsAffectedItems::new( + status_page_data_attributes_components_0_components_0_id.clone(), + PatchMaintenanceRequestDataAttributesComponentsAffectedItemsStatus::OPERATIONAL, + ) + ], ) ], ), diff --git a/examples/v2_status-pages_CreateMaintenance.rs b/examples/v2_status-pages_CreateMaintenance.rs index 3e97d97f3e..402b7f39b4 100644 --- a/examples/v2_status-pages_CreateMaintenance.rs +++ b/examples/v2_status-pages_CreateMaintenance.rs @@ -19,12 +19,6 @@ async fn main() { .expect("Failed to parse datetime") .with_timezone(&Utc), "We have completed maintenance on the API to improve performance.".to_string(), - vec![ - CreateMaintenanceRequestDataAttributesComponentsAffectedItems::new( - Uuid::parse_str("1234abcd-12ab-34cd-56ef-123456abcdef").expect("invalid UUID"), - PatchMaintenanceRequestDataAttributesComponentsAffectedItemsStatus::OPERATIONAL, - ), - ], "We are currently performing maintenance on the API to improve performance." .to_string(), "We will be performing maintenance on the API to improve performance.".to_string(), @@ -32,7 +26,13 @@ async fn main() { .expect("Failed to parse datetime") .with_timezone(&Utc), "API Maintenance".to_string(), - ), + ) + .components_affected(vec![ + CreateMaintenanceRequestDataAttributesComponentsAffectedItems::new( + Uuid::parse_str("1234abcd-12ab-34cd-56ef-123456abcdef").expect("invalid UUID"), + PatchMaintenanceRequestDataAttributesComponentsAffectedItemsStatus::OPERATIONAL, + ), + ]), PatchMaintenanceRequestDataType::MAINTENANCES, )); let configuration = datadog::Configuration::new(); diff --git a/examples/v2_status-pages_CreateMaintenance_2202276054.rs b/examples/v2_status-pages_CreateMaintenance_2202276054.rs index ce4484360a..ea10fcfa26 100644 --- a/examples/v2_status-pages_CreateMaintenance_2202276054.rs +++ b/examples/v2_status-pages_CreateMaintenance_2202276054.rs @@ -25,12 +25,6 @@ async fn main() { .expect("Failed to parse datetime") .with_timezone(&Utc), "We have completed maintenance on the API to improve performance.".to_string(), - vec![ - CreateMaintenanceRequestDataAttributesComponentsAffectedItems::new( - status_page_data_attributes_components_0_components_0_id.clone(), - PatchMaintenanceRequestDataAttributesComponentsAffectedItemsStatus::OPERATIONAL, - ), - ], "We are currently performing maintenance on the API to improve performance." .to_string(), "We will be performing maintenance on the API to improve performance.".to_string(), @@ -38,7 +32,13 @@ async fn main() { .expect("Failed to parse datetime") .with_timezone(&Utc), "API Maintenance".to_string(), - ), + ) + .components_affected(vec![ + CreateMaintenanceRequestDataAttributesComponentsAffectedItems::new( + status_page_data_attributes_components_0_components_0_id.clone(), + PatchMaintenanceRequestDataAttributesComponentsAffectedItemsStatus::OPERATIONAL, + ), + ]), PatchMaintenanceRequestDataType::MAINTENANCES, )); let configuration = datadog::Configuration::new(); diff --git a/examples/v2_status-pages_EditDegradationUpdate.rs b/examples/v2_status-pages_EditDegradationUpdate.rs new file mode 100644 index 0000000000..608bab528c --- /dev/null +++ b/examples/v2_status-pages_EditDegradationUpdate.rs @@ -0,0 +1,44 @@ +// Edit degradation update returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_status_pages::EditDegradationUpdateOptionalParams; +use datadog_api_client::datadogV2::api_status_pages::StatusPagesAPI; +use datadog_api_client::datadogV2::model::PatchDegradationUpdateRequest; +use datadog_api_client::datadogV2::model::PatchDegradationUpdateRequestData; +use datadog_api_client::datadogV2::model::PatchDegradationUpdateRequestDataAttributes; +use datadog_api_client::datadogV2::model::PatchDegradationUpdateRequestDataAttributesStatus; +use datadog_api_client::datadogV2::model::PatchDegradationUpdateRequestDataType; +use uuid::Uuid; + +#[tokio::main] +async fn main() { + let body = PatchDegradationUpdateRequest::new().data( + PatchDegradationUpdateRequestData::new( + PatchDegradationUpdateRequestDataType::DEGRADATION_UPDATES, + ) + .attributes( + PatchDegradationUpdateRequestDataAttributes::new() + .description( + "We've identified the source of the latency increase and are deploying a fix." + .to_string(), + ) + .status(PatchDegradationUpdateRequestDataAttributesStatus::IDENTIFIED), + ) + .id("00000000-0000-0000-0000-000000000000".to_string()), + ); + let configuration = datadog::Configuration::new(); + let api = StatusPagesAPI::with_config(configuration); + let resp = api + .edit_degradation_update( + Uuid::parse_str("00000000-0000-0000-0000-000000000000").expect("invalid UUID"), + Uuid::parse_str("00000000-0000-0000-0000-000000000000").expect("invalid UUID"), + Uuid::parse_str("00000000-0000-0000-0000-000000000000").expect("invalid UUID"), + body, + EditDegradationUpdateOptionalParams::default(), + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_status-pages_SoftDeleteDegradationUpdate.rs b/examples/v2_status-pages_SoftDeleteDegradationUpdate.rs new file mode 100644 index 0000000000..88c354b430 --- /dev/null +++ b/examples/v2_status-pages_SoftDeleteDegradationUpdate.rs @@ -0,0 +1,22 @@ +// Soft delete degradation update returns "No Content" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_status_pages::StatusPagesAPI; +use uuid::Uuid; + +#[tokio::main] +async fn main() { + let configuration = datadog::Configuration::new(); + let api = StatusPagesAPI::with_config(configuration); + let resp = api + .soft_delete_degradation_update( + Uuid::parse_str("00000000-0000-0000-0000-000000000000").expect("invalid UUID"), + Uuid::parse_str("00000000-0000-0000-0000-000000000000").expect("invalid UUID"), + Uuid::parse_str("00000000-0000-0000-0000-000000000000").expect("invalid UUID"), + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/src/datadogV2/api/api_status_pages.rs b/src/datadogV2/api/api_status_pages.rs index 9bc37f1bcf..01a2a1f339 100644 --- a/src/datadogV2/api/api_status_pages.rs +++ b/src/datadogV2/api/api_status_pages.rs @@ -120,6 +120,22 @@ impl CreateStatusPageOptionalParams { } } +/// EditDegradationUpdateOptionalParams is a struct for passing parameters to the method [`StatusPagesAPI::edit_degradation_update`] +#[non_exhaustive] +#[derive(Clone, Default, Debug)] +pub struct EditDegradationUpdateOptionalParams { + /// Comma-separated list of resources to include. Supported values: created_by_user, last_modified_by_user, degradation, status_page. + pub include: Option, +} + +impl EditDegradationUpdateOptionalParams { + /// Comma-separated list of resources to include. Supported values: created_by_user, last_modified_by_user, degradation, status_page. + pub fn include(mut self, value: String) -> Self { + self.include = Some(value); + self + } +} + /// GetComponentOptionalParams is a struct for passing parameters to the method [`StatusPagesAPI::get_component`] #[non_exhaustive] #[derive(Clone, Default, Debug)] @@ -496,6 +512,14 @@ pub enum DeleteStatusPageError { UnknownValue(serde_json::Value), } +/// EditDegradationUpdateError is a struct for typed errors of method [`StatusPagesAPI::edit_degradation_update`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum EditDegradationUpdateError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// GetComponentError is a struct for typed errors of method [`StatusPagesAPI::get_component`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -568,6 +592,14 @@ pub enum PublishStatusPageError { UnknownValue(serde_json::Value), } +/// SoftDeleteDegradationUpdateError is a struct for typed errors of method [`StatusPagesAPI::soft_delete_degradation_update`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum SoftDeleteDegradationUpdateError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// UnpublishStatusPageError is a struct for typed errors of method [`StatusPagesAPI::unpublish_status_page`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1967,6 +1999,188 @@ impl StatusPagesAPI { } } + /// Edits a specific degradation update. + pub async fn edit_degradation_update( + &self, + degradation_id: uuid::Uuid, + page_id: uuid::Uuid, + update_id: uuid::Uuid, + body: crate::datadogV2::model::PatchDegradationUpdateRequest, + params: EditDegradationUpdateOptionalParams, + ) -> Result< + crate::datadogV2::model::DegradationUpdate, + datadog::Error, + > { + match self + .edit_degradation_update_with_http_info( + degradation_id, + page_id, + update_id, + body, + params, + ) + .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), + } + } + + /// Edits a specific degradation update. + pub async fn edit_degradation_update_with_http_info( + &self, + degradation_id: uuid::Uuid, + page_id: uuid::Uuid, + update_id: uuid::Uuid, + body: crate::datadogV2::model::PatchDegradationUpdateRequest, + params: EditDegradationUpdateOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.edit_degradation_update"; + + // unbox and build optional parameters + let include = params.include; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/statuspages/{page_id}/degradations/{degradation_id}/updates/{update_id}", + local_configuration.get_operation_host(operation_id), + degradation_id = datadog::urlencode(degradation_id.to_string()), + page_id = datadog::urlencode(page_id.to_string()), + update_id = datadog::urlencode(update_id.to_string()) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + + if let Some(ref local_query_param) = include { + local_req_builder = + local_req_builder.query(&[("include", &local_query_param.to_string())]); + }; + + // 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)) + } + } + /// Retrieves a specific component by its ID. pub async fn get_component( &self, @@ -3053,6 +3267,104 @@ impl StatusPagesAPI { } } + /// Soft-deletes a degradation update. + pub async fn soft_delete_degradation_update( + &self, + degradation_id: uuid::Uuid, + page_id: uuid::Uuid, + update_id: uuid::Uuid, + ) -> Result<(), datadog::Error> { + match self + .soft_delete_degradation_update_with_http_info(degradation_id, page_id, update_id) + .await + { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Soft-deletes a degradation update. + pub async fn soft_delete_degradation_update_with_http_info( + &self, + degradation_id: uuid::Uuid, + page_id: uuid::Uuid, + update_id: uuid::Uuid, + ) -> Result, datadog::Error> + { + let local_configuration = &self.config; + let operation_id = "v2.soft_delete_degradation_update"; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/statuspages/{page_id}/degradations/{degradation_id}/updates/{update_id}", + local_configuration.get_operation_host(operation_id), + degradation_id = datadog::urlencode(degradation_id.to_string()), + page_id = datadog::urlencode(page_id.to_string()), + update_id = datadog::urlencode(update_id.to_string()) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("*/*")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + /// Unpublishes a status page. For pages of type `public`, removes the status page from the public internet and requires the `status_pages_public_page_publish` permission. For pages of type `internal`, removes the `status-pages/$domain_prefix/view` route from the Datadog organization and requires the `status_pages_internal_page_publish` permission. The `status_pages_settings_write` permission is temporarily honored as we migrate unpublishing functionality from the update status page endpoint to the unpublish status page endpoint. pub async fn unpublish_status_page( &self, diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 9265dbadeb..2bb9e6735a 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -11964,6 +11964,40 @@ pub mod model_patch_degradation_request_data_attributes_components_affected_item pub use self::model_patch_degradation_request_data_attributes_components_affected_items::PatchDegradationRequestDataAttributesComponentsAffectedItems; pub mod model_patch_degradation_request_data_attributes_status; pub use self::model_patch_degradation_request_data_attributes_status::PatchDegradationRequestDataAttributesStatus; +pub mod model_patch_degradation_update_request; +pub use self::model_patch_degradation_update_request::PatchDegradationUpdateRequest; +pub mod model_patch_degradation_update_request_data; +pub use self::model_patch_degradation_update_request_data::PatchDegradationUpdateRequestData; +pub mod model_patch_degradation_update_request_data_attributes; +pub use self::model_patch_degradation_update_request_data_attributes::PatchDegradationUpdateRequestDataAttributes; +pub mod model_patch_degradation_update_request_data_attributes_status; +pub use self::model_patch_degradation_update_request_data_attributes_status::PatchDegradationUpdateRequestDataAttributesStatus; +pub mod model_patch_degradation_update_request_data_type; +pub use self::model_patch_degradation_update_request_data_type::PatchDegradationUpdateRequestDataType; +pub mod model_degradation_update; +pub use self::model_degradation_update::DegradationUpdate; +pub mod model_degradation_update_data; +pub use self::model_degradation_update_data::DegradationUpdateData; +pub mod model_degradation_update_data_attributes; +pub use self::model_degradation_update_data_attributes::DegradationUpdateDataAttributes; +pub mod model_degradation_update_data_attributes_components_affected_items; +pub use self::model_degradation_update_data_attributes_components_affected_items::DegradationUpdateDataAttributesComponentsAffectedItems; +pub mod model_degradation_update_data_relationships; +pub use self::model_degradation_update_data_relationships::DegradationUpdateDataRelationships; +pub mod model_degradation_update_data_relationships_user; +pub use self::model_degradation_update_data_relationships_user::DegradationUpdateDataRelationshipsUser; +pub mod model_degradation_update_data_relationships_user_data; +pub use self::model_degradation_update_data_relationships_user_data::DegradationUpdateDataRelationshipsUserData; +pub mod model_degradation_update_data_relationships_degradation; +pub use self::model_degradation_update_data_relationships_degradation::DegradationUpdateDataRelationshipsDegradation; +pub mod model_degradation_update_data_relationships_degradation_data; +pub use self::model_degradation_update_data_relationships_degradation_data::DegradationUpdateDataRelationshipsDegradationData; +pub mod model_degradation_update_data_relationships_status_page; +pub use self::model_degradation_update_data_relationships_status_page::DegradationUpdateDataRelationshipsStatusPage; +pub mod model_degradation_update_data_relationships_status_page_data; +pub use self::model_degradation_update_data_relationships_status_page_data::DegradationUpdateDataRelationshipsStatusPageData; +pub mod model_degradation_update_included; +pub use self::model_degradation_update_included::DegradationUpdateIncluded; pub mod model_create_maintenance_request; pub use self::model_create_maintenance_request::CreateMaintenanceRequest; pub mod model_create_maintenance_request_data; diff --git a/src/datadogV2/model/model_create_backfilled_maintenance_request_data_attributes_updates_items.rs b/src/datadogV2/model/model_create_backfilled_maintenance_request_data_attributes_updates_items.rs index 8db01247aa..6e9392fa83 100644 --- a/src/datadogV2/model/model_create_backfilled_maintenance_request_data_attributes_updates_items.rs +++ b/src/datadogV2/model/model_create_backfilled_maintenance_request_data_attributes_updates_items.rs @@ -13,8 +13,9 @@ use std::fmt::{self, Formatter}; pub struct CreateBackfilledMaintenanceRequestDataAttributesUpdatesItems { /// The components affected. #[serde(rename = "components_affected")] - pub components_affected: + pub components_affected: Option< Vec, + >, /// A description of the update. #[serde(rename = "description")] pub description: String, @@ -33,15 +34,12 @@ pub struct CreateBackfilledMaintenanceRequestDataAttributesUpdatesItems { impl CreateBackfilledMaintenanceRequestDataAttributesUpdatesItems { pub fn new( - components_affected: Vec< - crate::datadogV2::model::CreateMaintenanceRequestDataAttributesComponentsAffectedItems, - >, description: String, started_at: chrono::DateTime, status: crate::datadogV2::model::CreateMaintenanceRequestDataAttributesUpdatesItemsStatus, ) -> CreateBackfilledMaintenanceRequestDataAttributesUpdatesItems { CreateBackfilledMaintenanceRequestDataAttributesUpdatesItems { - components_affected, + components_affected: None, description, started_at, status, @@ -50,6 +48,16 @@ impl CreateBackfilledMaintenanceRequestDataAttributesUpdatesItems { } } + pub fn components_affected( + mut self, + value: Vec< + crate::datadogV2::model::CreateMaintenanceRequestDataAttributesComponentsAffectedItems, + >, + ) -> Self { + self.components_affected = Some(value); + self + } + pub fn additional_properties( mut self, value: std::collections::BTreeMap, @@ -89,6 +97,9 @@ impl<'de> Deserialize<'de> for CreateBackfilledMaintenanceRequestDataAttributesU while let Some((k, v)) = map.next_entry::()? { match k.as_str() { "components_affected" => { + if v.is_null() { + continue; + } components_affected = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } @@ -117,8 +128,6 @@ impl<'de> Deserialize<'de> for CreateBackfilledMaintenanceRequestDataAttributesU } } } - let components_affected = components_affected - .ok_or_else(|| M::Error::missing_field("components_affected"))?; let description = description.ok_or_else(|| M::Error::missing_field("description"))?; let started_at = started_at.ok_or_else(|| M::Error::missing_field("started_at"))?; diff --git a/src/datadogV2/model/model_create_maintenance_request_data_attributes.rs b/src/datadogV2/model/model_create_maintenance_request_data_attributes.rs index cad7f44bd3..ba7729baca 100644 --- a/src/datadogV2/model/model_create_maintenance_request_data_attributes.rs +++ b/src/datadogV2/model/model_create_maintenance_request_data_attributes.rs @@ -19,8 +19,9 @@ pub struct CreateMaintenanceRequestDataAttributes { pub completed_description: String, /// The components affected by the maintenance. #[serde(rename = "components_affected")] - pub components_affected: + pub components_affected: Option< Vec, + >, /// The description shown while the maintenance is in progress. #[serde(rename = "in_progress_description")] pub in_progress_description: String, @@ -44,9 +45,6 @@ impl CreateMaintenanceRequestDataAttributes { pub fn new( completed_date: chrono::DateTime, completed_description: String, - components_affected: Vec< - crate::datadogV2::model::CreateMaintenanceRequestDataAttributesComponentsAffectedItems, - >, in_progress_description: String, scheduled_description: String, start_date: chrono::DateTime, @@ -55,7 +53,7 @@ impl CreateMaintenanceRequestDataAttributes { CreateMaintenanceRequestDataAttributes { completed_date, completed_description, - components_affected, + components_affected: None, in_progress_description, scheduled_description, start_date, @@ -65,6 +63,16 @@ impl CreateMaintenanceRequestDataAttributes { } } + pub fn components_affected( + mut self, + value: Vec< + crate::datadogV2::model::CreateMaintenanceRequestDataAttributesComponentsAffectedItems, + >, + ) -> Self { + self.components_affected = Some(value); + self + } + pub fn additional_properties( mut self, value: std::collections::BTreeMap, @@ -115,6 +123,9 @@ impl<'de> Deserialize<'de> for CreateMaintenanceRequestDataAttributes { Some(serde_json::from_value(v).map_err(M::Error::custom)?); } "components_affected" => { + if v.is_null() { + continue; + } components_affected = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } @@ -143,8 +154,6 @@ impl<'de> Deserialize<'de> for CreateMaintenanceRequestDataAttributes { completed_date.ok_or_else(|| M::Error::missing_field("completed_date"))?; let completed_description = completed_description .ok_or_else(|| M::Error::missing_field("completed_description"))?; - let components_affected = components_affected - .ok_or_else(|| M::Error::missing_field("components_affected"))?; let in_progress_description = in_progress_description .ok_or_else(|| M::Error::missing_field("in_progress_description"))?; let scheduled_description = scheduled_description diff --git a/src/datadogV2/model/model_create_status_page_request_data_attributes.rs b/src/datadogV2/model/model_create_status_page_request_data_attributes.rs index af73e3c481..f9b3ae7f2f 100644 --- a/src/datadogV2/model/model_create_status_page_request_data_attributes.rs +++ b/src/datadogV2/model/model_create_status_page_request_data_attributes.rs @@ -24,12 +24,21 @@ pub struct CreateStatusPageRequestDataAttributes { /// Base64-encoded image data included in email notifications sent to status page subscribers. #[serde(rename = "email_header_image")] pub email_header_image: Option, + /// Whether the status page is enabled. + #[serde(rename = "enabled")] + pub enabled: Option, /// Base64-encoded image data displayed in the browser tab. #[serde(rename = "favicon")] pub favicon: Option, /// The name of the status page. #[serde(rename = "name")] pub name: String, + /// The Slack app icon URL for the status page. + #[serde(rename = "slack_app_icon")] + pub slack_app_icon: Option, + /// Whether Slack subscriptions are enabled for the status page. + #[serde(rename = "slack_subscriptions_enabled")] + pub slack_subscriptions_enabled: Option, /// Whether users can subscribe to the status page. #[serde(rename = "subscriptions_enabled")] pub subscriptions_enabled: Option, @@ -59,8 +68,11 @@ impl CreateStatusPageRequestDataAttributes { components: None, domain_prefix, email_header_image: None, + enabled: None, favicon: None, name, + slack_app_icon: None, + slack_subscriptions_enabled: None, subscriptions_enabled: None, type_, visualization_type, @@ -87,11 +99,26 @@ impl CreateStatusPageRequestDataAttributes { self } + pub fn enabled(mut self, value: bool) -> Self { + self.enabled = Some(value); + self + } + pub fn favicon(mut self, value: String) -> Self { self.favicon = Some(value); self } + pub fn slack_app_icon(mut self, value: String) -> Self { + self.slack_app_icon = Some(value); + self + } + + pub fn slack_subscriptions_enabled(mut self, value: bool) -> Self { + self.slack_subscriptions_enabled = Some(value); + self + } + pub fn subscriptions_enabled(mut self, value: bool) -> Self { self.subscriptions_enabled = Some(value); self @@ -127,8 +154,11 @@ impl<'de> Deserialize<'de> for CreateStatusPageRequestDataAttributes { let mut components: Option> = None; let mut domain_prefix: Option = None; let mut email_header_image: Option = None; + let mut enabled: Option = None; let mut favicon: Option = None; let mut name: Option = None; + let mut slack_app_icon: Option = None; + let mut slack_subscriptions_enabled: Option = None; let mut subscriptions_enabled: Option = None; let mut type_: Option< crate::datadogV2::model::CreateStatusPageRequestDataAttributesType, @@ -168,6 +198,12 @@ impl<'de> Deserialize<'de> for CreateStatusPageRequestDataAttributes { email_header_image = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "enabled" => { + if v.is_null() { + continue; + } + enabled = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "favicon" => { if v.is_null() { continue; @@ -177,6 +213,20 @@ impl<'de> Deserialize<'de> for CreateStatusPageRequestDataAttributes { "name" => { name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "slack_app_icon" => { + if v.is_null() { + continue; + } + slack_app_icon = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "slack_subscriptions_enabled" => { + if v.is_null() { + continue; + } + slack_subscriptions_enabled = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "subscriptions_enabled" => { if v.is_null() { continue; @@ -226,8 +276,11 @@ impl<'de> Deserialize<'de> for CreateStatusPageRequestDataAttributes { components, domain_prefix, email_header_image, + enabled, favicon, name, + slack_app_icon, + slack_subscriptions_enabled, subscriptions_enabled, type_, visualization_type, diff --git a/src/datadogV2/model/model_degradation_data_attributes_updates_items.rs b/src/datadogV2/model/model_degradation_data_attributes_updates_items.rs index 891fda1140..45d3a516c3 100644 --- a/src/datadogV2/model/model_degradation_data_attributes_updates_items.rs +++ b/src/datadogV2/model/model_degradation_data_attributes_updates_items.rs @@ -19,6 +19,12 @@ pub struct DegradationDataAttributesUpdatesItems { /// Timestamp of when the update was created. #[serde(rename = "created_at")] pub created_at: Option>, + /// The date and time the resource was deleted. + #[serde(rename = "deleted_at")] + pub deleted_at: Option, + /// UUID of the user who deleted the resource. + #[serde(rename = "deleted_by_user_uuid")] + pub deleted_by_user_uuid: Option, /// Description of the update. #[serde(rename = "description")] pub description: Option, @@ -49,6 +55,8 @@ impl DegradationDataAttributesUpdatesItems { DegradationDataAttributesUpdatesItems { components_affected: None, created_at: None, + deleted_at: None, + deleted_by_user_uuid: None, description: None, id: None, last_modified_by_user_uuid: None, @@ -75,6 +83,16 @@ impl DegradationDataAttributesUpdatesItems { self } + pub fn deleted_at(mut self, value: String) -> Self { + self.deleted_at = Some(value); + self + } + + pub fn deleted_by_user_uuid(mut self, value: String) -> Self { + self.deleted_by_user_uuid = Some(value); + self + } + pub fn description(mut self, value: String) -> Self { self.description = Some(value); self @@ -142,6 +160,8 @@ impl<'de> Deserialize<'de> for DegradationDataAttributesUpdatesItems { { let mut components_affected: Option> = None; let mut created_at: Option> = None; + let mut deleted_at: Option = None; + let mut deleted_by_user_uuid: Option = None; let mut description: Option = None; let mut id: Option = None; let mut last_modified_by_user_uuid: Option = None; @@ -171,6 +191,19 @@ impl<'de> Deserialize<'de> for DegradationDataAttributesUpdatesItems { } created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "deleted_at" => { + if v.is_null() { + continue; + } + deleted_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "deleted_by_user_uuid" => { + if v.is_null() { + continue; + } + deleted_by_user_uuid = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "description" => { if v.is_null() { continue; @@ -229,6 +262,8 @@ impl<'de> Deserialize<'de> for DegradationDataAttributesUpdatesItems { let content = DegradationDataAttributesUpdatesItems { components_affected, created_at, + deleted_at, + deleted_by_user_uuid, description, id, last_modified_by_user_uuid, diff --git a/src/datadogV2/model/model_degradation_update.rs b/src/datadogV2/model/model_degradation_update.rs new file mode 100644 index 0000000000..1cad7c91eb --- /dev/null +++ b/src/datadogV2/model/model_degradation_update.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}; + +/// Response object for a degradation update. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DegradationUpdate { + /// The data object for a degradation update. + #[serde(rename = "data")] + pub data: Option, + /// Resources related to the degradation update. + #[serde(rename = "included")] + pub included: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DegradationUpdate { + pub fn new() -> DegradationUpdate { + DegradationUpdate { + data: None, + included: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data(mut self, value: crate::datadogV2::model::DegradationUpdateData) -> Self { + self.data = Some(value); + self + } + + pub fn included( + mut self, + value: Vec, + ) -> Self { + self.included = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DegradationUpdate { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DegradationUpdate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DegradationUpdateVisitor; + impl<'a> Visitor<'a> for DegradationUpdateVisitor { + type Value = DegradationUpdate; + + 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 included: 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" => { + if v.is_null() { + continue; + } + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "included" => { + if v.is_null() { + continue; + } + included = 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 = DegradationUpdate { + data, + included, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DegradationUpdateVisitor) + } +} diff --git a/src/datadogV2/model/model_degradation_update_data.rs b/src/datadogV2/model/model_degradation_update_data.rs new file mode 100644 index 0000000000..301475c878 --- /dev/null +++ b/src/datadogV2/model/model_degradation_update_data.rs @@ -0,0 +1,166 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The data object for a degradation update. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DegradationUpdateData { + /// Attributes of a degradation update resource. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The ID of the degradation update. + #[serde(rename = "id")] + pub id: Option, + /// Relationships of a degradation update resource. + #[serde(rename = "relationships")] + pub relationships: Option, + /// Degradation updates resource type. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::PatchDegradationUpdateRequestDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DegradationUpdateData { + pub fn new( + type_: crate::datadogV2::model::PatchDegradationUpdateRequestDataType, + ) -> DegradationUpdateData { + DegradationUpdateData { + attributes: None, + id: None, + relationships: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::DegradationUpdateDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn relationships( + mut self, + value: crate::datadogV2::model::DegradationUpdateDataRelationships, + ) -> Self { + self.relationships = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DegradationUpdateData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DegradationUpdateDataVisitor; + impl<'a> Visitor<'a> for DegradationUpdateDataVisitor { + type Value = DegradationUpdateData; + + 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::DegradationUpdateDataAttributes, + > = None; + let mut id: Option = None; + let mut relationships: Option< + crate::datadogV2::model::DegradationUpdateDataRelationships, + > = None; + let mut type_: Option< + crate::datadogV2::model::PatchDegradationUpdateRequestDataType, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "relationships" => { + if v.is_null() { + continue; + } + relationships = + 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::PatchDegradationUpdateRequestDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = DegradationUpdateData { + attributes, + id, + relationships, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DegradationUpdateDataVisitor) + } +} diff --git a/src/datadogV2/model/model_degradation_update_data_attributes.rs b/src/datadogV2/model/model_degradation_update_data_attributes.rs new file mode 100644 index 0000000000..248e5f091d --- /dev/null +++ b/src/datadogV2/model/model_degradation_update_data_attributes.rs @@ -0,0 +1,228 @@ +// 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 degradation update resource. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DegradationUpdateDataAttributes { + /// Components affected by this update. + #[serde(rename = "components_affected")] + pub components_affected: Option< + Vec, + >, + /// The date and time the update was created. + #[serde(rename = "created_at")] + pub created_at: Option>, + /// The date and time the update was soft-deleted. + #[serde(rename = "deleted_at")] + pub deleted_at: Option>, + /// The message body of the update. + #[serde(rename = "description")] + pub description: Option, + /// The date and time the update was last modified. + #[serde(rename = "modified_at")] + pub modified_at: Option>, + /// The date and time the update started. + #[serde(rename = "started_at")] + pub started_at: Option>, + /// The status of the degradation. + #[serde(rename = "status")] + pub status: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DegradationUpdateDataAttributes { + pub fn new() -> DegradationUpdateDataAttributes { + DegradationUpdateDataAttributes { + components_affected: None, + created_at: None, + deleted_at: None, + description: None, + modified_at: None, + started_at: None, + status: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn components_affected( + mut self, + value: Vec, + ) -> Self { + self.components_affected = Some(value); + self + } + + pub fn created_at(mut self, value: chrono::DateTime) -> Self { + self.created_at = Some(value); + self + } + + pub fn deleted_at(mut self, value: chrono::DateTime) -> Self { + self.deleted_at = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn modified_at(mut self, value: chrono::DateTime) -> Self { + self.modified_at = Some(value); + self + } + + pub fn started_at(mut self, value: chrono::DateTime) -> Self { + self.started_at = Some(value); + self + } + + pub fn status( + mut self, + value: crate::datadogV2::model::CreateDegradationRequestDataAttributesStatus, + ) -> Self { + self.status = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DegradationUpdateDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DegradationUpdateDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DegradationUpdateDataAttributesVisitor; + impl<'a> Visitor<'a> for DegradationUpdateDataAttributesVisitor { + type Value = DegradationUpdateDataAttributes; + + 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 components_affected: Option> = None; + let mut created_at: Option> = None; + let mut deleted_at: Option> = None; + let mut description: Option = None; + let mut modified_at: Option> = None; + let mut started_at: Option> = None; + let mut status: Option< + crate::datadogV2::model::CreateDegradationRequestDataAttributesStatus, + > = 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() { + "components_affected" => { + if v.is_null() { + continue; + } + components_affected = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "deleted_at" => { + if v.is_null() { + continue; + } + deleted_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "modified_at" => { + if v.is_null() { + continue; + } + modified_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "started_at" => { + if v.is_null() { + continue; + } + started_at = 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::CreateDegradationRequestDataAttributesStatus::UnparsedObject(_status) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = DegradationUpdateDataAttributes { + components_affected, + created_at, + deleted_at, + description, + modified_at, + started_at, + status, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DegradationUpdateDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_degradation_update_data_attributes_components_affected_items.rs b/src/datadogV2/model/model_degradation_update_data_attributes_components_affected_items.rs new file mode 100644 index 0000000000..c5942d147c --- /dev/null +++ b/src/datadogV2/model/model_degradation_update_data_attributes_components_affected_items.rs @@ -0,0 +1,132 @@ +// 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 component affected by a degradation update. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DegradationUpdateDataAttributesComponentsAffectedItems { + /// The ID of the affected component. + #[serde(rename = "id")] + pub id: String, + /// The name of the affected component. + #[serde(rename = "name")] + pub name: Option, + /// The status of the component. + #[serde(rename = "status")] + pub status: crate::datadogV2::model::StatusPagesComponentDataAttributesStatus, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DegradationUpdateDataAttributesComponentsAffectedItems { + pub fn new( + id: String, + status: crate::datadogV2::model::StatusPagesComponentDataAttributesStatus, + ) -> DegradationUpdateDataAttributesComponentsAffectedItems { + DegradationUpdateDataAttributesComponentsAffectedItems { + id, + name: None, + status, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DegradationUpdateDataAttributesComponentsAffectedItems { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DegradationUpdateDataAttributesComponentsAffectedItemsVisitor; + impl<'a> Visitor<'a> for DegradationUpdateDataAttributesComponentsAffectedItemsVisitor { + type Value = DegradationUpdateDataAttributesComponentsAffectedItems; + + 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 id: Option = None; + let mut name: Option = None; + let mut status: Option< + crate::datadogV2::model::StatusPagesComponentDataAttributesStatus, + > = 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() { + "id" => { + id = 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)?); + } + "status" => { + status = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _status) = status { + match _status { + crate::datadogV2::model::StatusPagesComponentDataAttributesStatus::UnparsedObject(_status) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let status = status.ok_or_else(|| M::Error::missing_field("status"))?; + + let content = DegradationUpdateDataAttributesComponentsAffectedItems { + id, + name, + status, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DegradationUpdateDataAttributesComponentsAffectedItemsVisitor) + } +} diff --git a/src/datadogV2/model/model_degradation_update_data_relationships.rs b/src/datadogV2/model/model_degradation_update_data_relationships.rs new file mode 100644 index 0000000000..59ce593d59 --- /dev/null +++ b/src/datadogV2/model/model_degradation_update_data_relationships.rs @@ -0,0 +1,204 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Relationships of a degradation update resource. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DegradationUpdateDataRelationships { + /// A user relationship of a degradation update. + #[serde(rename = "created_by_user")] + pub created_by_user: Option, + /// The degradation relationship of a degradation update. + #[serde(rename = "degradation")] + pub degradation: Option, + /// A user relationship of a degradation update. + #[serde(rename = "deleted_by_user")] + pub deleted_by_user: Option, + /// A user relationship of a degradation update. + #[serde(rename = "last_modified_by_user")] + pub last_modified_by_user: + Option, + /// The status page relationship of a degradation update. + #[serde(rename = "status_page")] + pub status_page: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DegradationUpdateDataRelationships { + pub fn new() -> DegradationUpdateDataRelationships { + DegradationUpdateDataRelationships { + created_by_user: None, + degradation: None, + deleted_by_user: None, + last_modified_by_user: None, + status_page: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn created_by_user( + mut self, + value: crate::datadogV2::model::DegradationUpdateDataRelationshipsUser, + ) -> Self { + self.created_by_user = Some(value); + self + } + + pub fn degradation( + mut self, + value: crate::datadogV2::model::DegradationUpdateDataRelationshipsDegradation, + ) -> Self { + self.degradation = Some(value); + self + } + + pub fn deleted_by_user( + mut self, + value: crate::datadogV2::model::DegradationUpdateDataRelationshipsUser, + ) -> Self { + self.deleted_by_user = Some(value); + self + } + + pub fn last_modified_by_user( + mut self, + value: crate::datadogV2::model::DegradationUpdateDataRelationshipsUser, + ) -> Self { + self.last_modified_by_user = Some(value); + self + } + + pub fn status_page( + mut self, + value: crate::datadogV2::model::DegradationUpdateDataRelationshipsStatusPage, + ) -> Self { + self.status_page = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for DegradationUpdateDataRelationships { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for DegradationUpdateDataRelationships { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DegradationUpdateDataRelationshipsVisitor; + impl<'a> Visitor<'a> for DegradationUpdateDataRelationshipsVisitor { + type Value = DegradationUpdateDataRelationships; + + 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_by_user: Option< + crate::datadogV2::model::DegradationUpdateDataRelationshipsUser, + > = None; + let mut degradation: Option< + crate::datadogV2::model::DegradationUpdateDataRelationshipsDegradation, + > = None; + let mut deleted_by_user: Option< + crate::datadogV2::model::DegradationUpdateDataRelationshipsUser, + > = None; + let mut last_modified_by_user: Option< + crate::datadogV2::model::DegradationUpdateDataRelationshipsUser, + > = None; + let mut status_page: Option< + crate::datadogV2::model::DegradationUpdateDataRelationshipsStatusPage, + > = 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_by_user" => { + if v.is_null() { + continue; + } + created_by_user = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "degradation" => { + if v.is_null() { + continue; + } + degradation = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "deleted_by_user" => { + if v.is_null() { + continue; + } + deleted_by_user = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "last_modified_by_user" => { + if v.is_null() { + continue; + } + last_modified_by_user = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "status_page" => { + if v.is_null() { + continue; + } + status_page = + 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 = DegradationUpdateDataRelationships { + created_by_user, + degradation, + deleted_by_user, + last_modified_by_user, + status_page, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DegradationUpdateDataRelationshipsVisitor) + } +} diff --git a/src/datadogV2/model/model_degradation_update_data_relationships_degradation.rs b/src/datadogV2/model/model_degradation_update_data_relationships_degradation.rs new file mode 100644 index 0000000000..4c00ee86ba --- /dev/null +++ b/src/datadogV2/model/model_degradation_update_data_relationships_degradation.rs @@ -0,0 +1,96 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The degradation relationship of a degradation update. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DegradationUpdateDataRelationshipsDegradation { + /// The degradation linked to a degradation update. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::DegradationUpdateDataRelationshipsDegradationData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DegradationUpdateDataRelationshipsDegradation { + pub fn new( + data: crate::datadogV2::model::DegradationUpdateDataRelationshipsDegradationData, + ) -> DegradationUpdateDataRelationshipsDegradation { + DegradationUpdateDataRelationshipsDegradation { + 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 DegradationUpdateDataRelationshipsDegradation { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DegradationUpdateDataRelationshipsDegradationVisitor; + impl<'a> Visitor<'a> for DegradationUpdateDataRelationshipsDegradationVisitor { + type Value = DegradationUpdateDataRelationshipsDegradation; + + 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< + crate::datadogV2::model::DegradationUpdateDataRelationshipsDegradationData, + > = 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 = DegradationUpdateDataRelationshipsDegradation { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DegradationUpdateDataRelationshipsDegradationVisitor) + } +} diff --git a/src/datadogV2/model/model_degradation_update_data_relationships_degradation_data.rs b/src/datadogV2/model/model_degradation_update_data_relationships_degradation_data.rs new file mode 100644 index 0000000000..3fc48aa958 --- /dev/null +++ b/src/datadogV2/model/model_degradation_update_data_relationships_degradation_data.rs @@ -0,0 +1,114 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The degradation linked to a degradation update. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DegradationUpdateDataRelationshipsDegradationData { + /// The ID of the degradation. + #[serde(rename = "id")] + pub id: String, + /// Degradations resource type. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::PatchDegradationRequestDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DegradationUpdateDataRelationshipsDegradationData { + pub fn new( + id: String, + type_: crate::datadogV2::model::PatchDegradationRequestDataType, + ) -> DegradationUpdateDataRelationshipsDegradationData { + DegradationUpdateDataRelationshipsDegradationData { + 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 DegradationUpdateDataRelationshipsDegradationData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DegradationUpdateDataRelationshipsDegradationDataVisitor; + impl<'a> Visitor<'a> for DegradationUpdateDataRelationshipsDegradationDataVisitor { + type Value = DegradationUpdateDataRelationshipsDegradationData; + + 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 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() { + "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::PatchDegradationRequestDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = DegradationUpdateDataRelationshipsDegradationData { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DegradationUpdateDataRelationshipsDegradationDataVisitor) + } +} diff --git a/src/datadogV2/model/model_degradation_update_data_relationships_status_page.rs b/src/datadogV2/model/model_degradation_update_data_relationships_status_page.rs new file mode 100644 index 0000000000..fd8dbb171a --- /dev/null +++ b/src/datadogV2/model/model_degradation_update_data_relationships_status_page.rs @@ -0,0 +1,96 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The status page relationship of a degradation update. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DegradationUpdateDataRelationshipsStatusPage { + /// The status page linked to a degradation update. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::DegradationUpdateDataRelationshipsStatusPageData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DegradationUpdateDataRelationshipsStatusPage { + pub fn new( + data: crate::datadogV2::model::DegradationUpdateDataRelationshipsStatusPageData, + ) -> DegradationUpdateDataRelationshipsStatusPage { + DegradationUpdateDataRelationshipsStatusPage { + 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 DegradationUpdateDataRelationshipsStatusPage { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DegradationUpdateDataRelationshipsStatusPageVisitor; + impl<'a> Visitor<'a> for DegradationUpdateDataRelationshipsStatusPageVisitor { + type Value = DegradationUpdateDataRelationshipsStatusPage; + + 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< + crate::datadogV2::model::DegradationUpdateDataRelationshipsStatusPageData, + > = 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 = DegradationUpdateDataRelationshipsStatusPage { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DegradationUpdateDataRelationshipsStatusPageVisitor) + } +} diff --git a/src/datadogV2/model/model_degradation_update_data_relationships_status_page_data.rs b/src/datadogV2/model/model_degradation_update_data_relationships_status_page_data.rs new file mode 100644 index 0000000000..4d39b98c91 --- /dev/null +++ b/src/datadogV2/model/model_degradation_update_data_relationships_status_page_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}; + +/// The status page linked to a degradation update. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DegradationUpdateDataRelationshipsStatusPageData { + /// The ID of the status page. + #[serde(rename = "id")] + pub id: String, + /// Status pages resource type. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::StatusPageDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DegradationUpdateDataRelationshipsStatusPageData { + pub fn new( + id: String, + type_: crate::datadogV2::model::StatusPageDataType, + ) -> DegradationUpdateDataRelationshipsStatusPageData { + DegradationUpdateDataRelationshipsStatusPageData { + 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 DegradationUpdateDataRelationshipsStatusPageData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DegradationUpdateDataRelationshipsStatusPageDataVisitor; + impl<'a> Visitor<'a> for DegradationUpdateDataRelationshipsStatusPageDataVisitor { + type Value = DegradationUpdateDataRelationshipsStatusPageData; + + 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 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() { + "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::StatusPageDataType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = DegradationUpdateDataRelationshipsStatusPageData { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DegradationUpdateDataRelationshipsStatusPageDataVisitor) + } +} diff --git a/src/datadogV2/model/model_degradation_update_data_relationships_user.rs b/src/datadogV2/model/model_degradation_update_data_relationships_user.rs new file mode 100644 index 0000000000..b998910194 --- /dev/null +++ b/src/datadogV2/model/model_degradation_update_data_relationships_user.rs @@ -0,0 +1,96 @@ +// 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 user relationship of a degradation update. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DegradationUpdateDataRelationshipsUser { + /// A Datadog user linked to a degradation update. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::DegradationUpdateDataRelationshipsUserData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DegradationUpdateDataRelationshipsUser { + pub fn new( + data: crate::datadogV2::model::DegradationUpdateDataRelationshipsUserData, + ) -> DegradationUpdateDataRelationshipsUser { + DegradationUpdateDataRelationshipsUser { + 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 DegradationUpdateDataRelationshipsUser { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DegradationUpdateDataRelationshipsUserVisitor; + impl<'a> Visitor<'a> for DegradationUpdateDataRelationshipsUserVisitor { + type Value = DegradationUpdateDataRelationshipsUser; + + 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< + crate::datadogV2::model::DegradationUpdateDataRelationshipsUserData, + > = 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 = DegradationUpdateDataRelationshipsUser { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DegradationUpdateDataRelationshipsUserVisitor) + } +} diff --git a/src/datadogV2/model/model_degradation_update_data_relationships_user_data.rs b/src/datadogV2/model/model_degradation_update_data_relationships_user_data.rs new file mode 100644 index 0000000000..80be8ed3d2 --- /dev/null +++ b/src/datadogV2/model/model_degradation_update_data_relationships_user_data.rs @@ -0,0 +1,113 @@ +// 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 Datadog user linked to a degradation update. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DegradationUpdateDataRelationshipsUserData { + /// The ID of the user. + #[serde(rename = "id")] + pub id: String, + /// Users resource type. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::StatusPagesUserType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DegradationUpdateDataRelationshipsUserData { + pub fn new( + id: String, + type_: crate::datadogV2::model::StatusPagesUserType, + ) -> DegradationUpdateDataRelationshipsUserData { + DegradationUpdateDataRelationshipsUserData { + 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 DegradationUpdateDataRelationshipsUserData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DegradationUpdateDataRelationshipsUserDataVisitor; + impl<'a> Visitor<'a> for DegradationUpdateDataRelationshipsUserDataVisitor { + type Value = DegradationUpdateDataRelationshipsUserData; + + 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 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() { + "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::StatusPagesUserType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = DegradationUpdateDataRelationshipsUserData { + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DegradationUpdateDataRelationshipsUserDataVisitor) + } +} diff --git a/src/datadogV2/model/model_degradation_update_included.rs b/src/datadogV2/model/model_degradation_update_included.rs new file mode 100644 index 0000000000..2af74f5231 --- /dev/null +++ b/src/datadogV2/model/model_degradation_update_included.rs @@ -0,0 +1,49 @@ +// 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}; + +/// Resources included in a degradation update response. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum DegradationUpdateIncluded { + StatusPagesUser(Box), + Degradation(Box), + StatusPageAsIncluded(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for DegradationUpdateIncluded { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(DegradationUpdateIncluded::StatusPagesUser(_v)); + } + } + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(DegradationUpdateIncluded::Degradation(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(DegradationUpdateIncluded::StatusPageAsIncluded(_v)); + } + } + + return Ok(DegradationUpdateIncluded::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_patch_degradation_update_request.rs b/src/datadogV2/model/model_patch_degradation_update_request.rs new file mode 100644 index 0000000000..db52fa1b4b --- /dev/null +++ b/src/datadogV2/model/model_patch_degradation_update_request.rs @@ -0,0 +1,109 @@ +// 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 object for editing a degradation update. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct PatchDegradationUpdateRequest { + /// The data object for editing a degradation update. + #[serde(rename = "data")] + pub data: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl PatchDegradationUpdateRequest { + pub fn new() -> PatchDegradationUpdateRequest { + PatchDegradationUpdateRequest { + data: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data( + mut self, + value: crate::datadogV2::model::PatchDegradationUpdateRequestData, + ) -> Self { + self.data = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for PatchDegradationUpdateRequest { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for PatchDegradationUpdateRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct PatchDegradationUpdateRequestVisitor; + impl<'a> Visitor<'a> for PatchDegradationUpdateRequestVisitor { + type Value = PatchDegradationUpdateRequest; + + 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" => { + if v.is_null() { + continue; + } + 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 content = PatchDegradationUpdateRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(PatchDegradationUpdateRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_patch_degradation_update_request_data.rs b/src/datadogV2/model/model_patch_degradation_update_request_data.rs new file mode 100644 index 0000000000..4f93c394d4 --- /dev/null +++ b/src/datadogV2/model/model_patch_degradation_update_request_data.rs @@ -0,0 +1,143 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// The data object for editing a degradation update. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct PatchDegradationUpdateRequestData { + /// Attributes for editing a degradation update. + #[serde(rename = "attributes")] + pub attributes: Option, + /// The ID of the degradation update to edit. + #[serde(rename = "id")] + pub id: Option, + /// Degradation updates resource type. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::PatchDegradationUpdateRequestDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl PatchDegradationUpdateRequestData { + pub fn new( + type_: crate::datadogV2::model::PatchDegradationUpdateRequestDataType, + ) -> PatchDegradationUpdateRequestData { + PatchDegradationUpdateRequestData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::PatchDegradationUpdateRequestDataAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for PatchDegradationUpdateRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct PatchDegradationUpdateRequestDataVisitor; + impl<'a> Visitor<'a> for PatchDegradationUpdateRequestDataVisitor { + type Value = PatchDegradationUpdateRequestData; + + 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::PatchDegradationUpdateRequestDataAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option< + crate::datadogV2::model::PatchDegradationUpdateRequestDataType, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + 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::PatchDegradationUpdateRequestDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = PatchDegradationUpdateRequestData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(PatchDegradationUpdateRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_patch_degradation_update_request_data_attributes.rs b/src/datadogV2/model/model_patch_degradation_update_request_data_attributes.rs new file mode 100644 index 0000000000..7748101c35 --- /dev/null +++ b/src/datadogV2/model/model_patch_degradation_update_request_data_attributes.rs @@ -0,0 +1,136 @@ +// 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 editing a degradation update. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct PatchDegradationUpdateRequestDataAttributes { + /// The message body of the update. + #[serde(rename = "description")] + pub description: Option, + /// The status of the degradation update. + #[serde(rename = "status")] + pub status: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl PatchDegradationUpdateRequestDataAttributes { + pub fn new() -> PatchDegradationUpdateRequestDataAttributes { + PatchDegradationUpdateRequestDataAttributes { + description: None, + status: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn status( + mut self, + value: crate::datadogV2::model::PatchDegradationUpdateRequestDataAttributesStatus, + ) -> Self { + self.status = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for PatchDegradationUpdateRequestDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for PatchDegradationUpdateRequestDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct PatchDegradationUpdateRequestDataAttributesVisitor; + impl<'a> Visitor<'a> for PatchDegradationUpdateRequestDataAttributesVisitor { + type Value = PatchDegradationUpdateRequestDataAttributes; + + 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 description: Option = None; + let mut status: Option< + crate::datadogV2::model::PatchDegradationUpdateRequestDataAttributesStatus, + > = 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() { + "description" => { + if v.is_null() { + continue; + } + description = + 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::PatchDegradationUpdateRequestDataAttributesStatus::UnparsedObject(_status) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = PatchDegradationUpdateRequestDataAttributes { + description, + status, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(PatchDegradationUpdateRequestDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_patch_degradation_update_request_data_attributes_status.rs b/src/datadogV2/model/model_patch_degradation_update_request_data_attributes_status.rs new file mode 100644 index 0000000000..84bdee9a7f --- /dev/null +++ b/src/datadogV2/model/model_patch_degradation_update_request_data_attributes_status.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 PatchDegradationUpdateRequestDataAttributesStatus { + INVESTIGATING, + IDENTIFIED, + MONITORING, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for PatchDegradationUpdateRequestDataAttributesStatus { + fn to_string(&self) -> String { + match self { + Self::INVESTIGATING => String::from("investigating"), + Self::IDENTIFIED => String::from("identified"), + Self::MONITORING => String::from("monitoring"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for PatchDegradationUpdateRequestDataAttributesStatus { + 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 PatchDegradationUpdateRequestDataAttributesStatus { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "investigating" => Self::INVESTIGATING, + "identified" => Self::IDENTIFIED, + "monitoring" => Self::MONITORING, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_patch_degradation_update_request_data_type.rs b/src/datadogV2/model/model_patch_degradation_update_request_data_type.rs new file mode 100644 index 0000000000..b0eac20100 --- /dev/null +++ b/src/datadogV2/model/model_patch_degradation_update_request_data_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 PatchDegradationUpdateRequestDataType { + DEGRADATION_UPDATES, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for PatchDegradationUpdateRequestDataType { + fn to_string(&self) -> String { + match self { + Self::DEGRADATION_UPDATES => String::from("degradation_updates"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for PatchDegradationUpdateRequestDataType { + 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 PatchDegradationUpdateRequestDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "degradation_updates" => Self::DEGRADATION_UPDATES, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_patch_status_page_request_data_attributes.rs b/src/datadogV2/model/model_patch_status_page_request_data_attributes.rs index 121e7b8ecc..9b138fd29d 100644 --- a/src/datadogV2/model/model_patch_status_page_request_data_attributes.rs +++ b/src/datadogV2/model/model_patch_status_page_request_data_attributes.rs @@ -29,6 +29,12 @@ pub struct PatchStatusPageRequestDataAttributes { /// The name of the status page. #[serde(rename = "name")] pub name: Option, + /// The Slack app icon URL for the status page. + #[serde(rename = "slack_app_icon")] + pub slack_app_icon: Option, + /// Whether Slack subscriptions are enabled for the status page. + #[serde(rename = "slack_subscriptions_enabled")] + pub slack_subscriptions_enabled: Option, /// Whether users can subscribe to the status page. #[serde(rename = "subscriptions_enabled")] pub subscriptions_enabled: Option, @@ -55,6 +61,8 @@ impl PatchStatusPageRequestDataAttributes { enabled: None, favicon: None, name: None, + slack_app_icon: None, + slack_subscriptions_enabled: None, subscriptions_enabled: None, type_: None, visualization_type: None, @@ -93,6 +101,16 @@ impl PatchStatusPageRequestDataAttributes { self } + pub fn slack_app_icon(mut self, value: String) -> Self { + self.slack_app_icon = Some(value); + self + } + + pub fn slack_subscriptions_enabled(mut self, value: bool) -> Self { + self.slack_subscriptions_enabled = Some(value); + self + } + pub fn subscriptions_enabled(mut self, value: bool) -> Self { self.subscriptions_enabled = Some(value); self @@ -152,6 +170,8 @@ impl<'de> Deserialize<'de> for PatchStatusPageRequestDataAttributes { let mut enabled: Option = None; let mut favicon: Option = None; let mut name: Option = None; + let mut slack_app_icon: Option = None; + let mut slack_subscriptions_enabled: Option = None; let mut subscriptions_enabled: Option = None; let mut type_: Option< crate::datadogV2::model::CreateStatusPageRequestDataAttributesType, @@ -206,6 +226,20 @@ impl<'de> Deserialize<'de> for PatchStatusPageRequestDataAttributes { } name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "slack_app_icon" => { + if v.is_null() { + continue; + } + slack_app_icon = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "slack_subscriptions_enabled" => { + if v.is_null() { + continue; + } + slack_subscriptions_enabled = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "subscriptions_enabled" => { if v.is_null() { continue; @@ -257,6 +291,8 @@ impl<'de> Deserialize<'de> for PatchStatusPageRequestDataAttributes { enabled, favicon, name, + slack_app_icon, + slack_subscriptions_enabled, subscriptions_enabled, type_, visualization_type, diff --git a/src/datadogV2/model/model_status_page_as_included_attributes.rs b/src/datadogV2/model/model_status_page_as_included_attributes.rs index 597cf7d0f9..727003de72 100644 --- a/src/datadogV2/model/model_status_page_as_included_attributes.rs +++ b/src/datadogV2/model/model_status_page_as_included_attributes.rs @@ -48,6 +48,12 @@ pub struct StatusPageAsIncludedAttributes { /// The url that the status page is accessible at. #[serde(rename = "page_url")] pub page_url: Option, + /// The Slack app icon URL for the status page. + #[serde(rename = "slack_app_icon")] + pub slack_app_icon: Option, + /// Whether Slack subscriptions are enabled for the status page. + #[serde(rename = "slack_subscriptions_enabled")] + pub slack_subscriptions_enabled: Option, /// Whether users can subscribe to the status page. #[serde(rename = "subscriptions_enabled")] pub subscriptions_enabled: Option, @@ -80,6 +86,8 @@ impl StatusPageAsIncludedAttributes { modified_at: None, name: None, page_url: None, + slack_app_icon: None, + slack_subscriptions_enabled: None, subscriptions_enabled: None, type_: None, visualization_type: None, @@ -151,6 +159,16 @@ impl StatusPageAsIncludedAttributes { self } + pub fn slack_app_icon(mut self, value: String) -> Self { + self.slack_app_icon = Some(value); + self + } + + pub fn slack_subscriptions_enabled(mut self, value: bool) -> Self { + self.slack_subscriptions_enabled = Some(value); + self + } + pub fn subscriptions_enabled(mut self, value: bool) -> Self { self.subscriptions_enabled = Some(value); self @@ -218,6 +236,8 @@ impl<'de> Deserialize<'de> for StatusPageAsIncludedAttributes { let mut modified_at: Option> = None; let mut name: Option = None; let mut page_url: Option = None; + let mut slack_app_icon: Option = None; + let mut slack_subscriptions_enabled: Option = None; let mut subscriptions_enabled: Option = None; let mut type_: Option< crate::datadogV2::model::CreateStatusPageRequestDataAttributesType, @@ -311,6 +331,20 @@ impl<'de> Deserialize<'de> for StatusPageAsIncludedAttributes { } page_url = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "slack_app_icon" => { + if v.is_null() { + continue; + } + slack_app_icon = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "slack_subscriptions_enabled" => { + if v.is_null() { + continue; + } + slack_subscriptions_enabled = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "subscriptions_enabled" => { if v.is_null() { continue; @@ -368,6 +402,8 @@ impl<'de> Deserialize<'de> for StatusPageAsIncludedAttributes { modified_at, name, page_url, + slack_app_icon, + slack_subscriptions_enabled, subscriptions_enabled, type_, visualization_type, diff --git a/src/datadogV2/model/model_status_page_data_attributes.rs b/src/datadogV2/model/model_status_page_data_attributes.rs index e255ea067f..30b35c0c1d 100644 --- a/src/datadogV2/model/model_status_page_data_attributes.rs +++ b/src/datadogV2/model/model_status_page_data_attributes.rs @@ -63,6 +63,12 @@ pub struct StatusPageDataAttributes { /// The url that the status page is accessible at. #[serde(rename = "page_url")] pub page_url: Option, + /// The Slack app icon URL for the status page. + #[serde(rename = "slack_app_icon")] + pub slack_app_icon: Option, + /// Whether Slack subscriptions are enabled for the status page. + #[serde(rename = "slack_subscriptions_enabled")] + pub slack_subscriptions_enabled: Option, /// Whether users can subscribe to the status page. #[serde(rename = "subscriptions_enabled")] pub subscriptions_enabled: Option, @@ -95,6 +101,8 @@ impl StatusPageDataAttributes { modified_at: None, name: None, page_url: None, + slack_app_icon: None, + slack_subscriptions_enabled: None, subscriptions_enabled: None, type_: None, visualization_type: None, @@ -166,6 +174,16 @@ impl StatusPageDataAttributes { self } + pub fn slack_app_icon(mut self, value: String) -> Self { + self.slack_app_icon = Some(value); + self + } + + pub fn slack_subscriptions_enabled(mut self, value: bool) -> Self { + self.slack_subscriptions_enabled = Some(value); + self + } + pub fn subscriptions_enabled(mut self, value: bool) -> Self { self.subscriptions_enabled = Some(value); self @@ -233,6 +251,8 @@ impl<'de> Deserialize<'de> for StatusPageDataAttributes { let mut modified_at: Option> = None; let mut name: Option = None; let mut page_url: Option = None; + let mut slack_app_icon: Option = None; + let mut slack_subscriptions_enabled: Option = None; let mut subscriptions_enabled: Option = None; let mut type_: Option< crate::datadogV2::model::CreateStatusPageRequestDataAttributesType, @@ -314,6 +334,20 @@ impl<'de> Deserialize<'de> for StatusPageDataAttributes { } page_url = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "slack_app_icon" => { + if v.is_null() { + continue; + } + slack_app_icon = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "slack_subscriptions_enabled" => { + if v.is_null() { + continue; + } + slack_subscriptions_enabled = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "subscriptions_enabled" => { if v.is_null() { continue; @@ -371,6 +405,8 @@ impl<'de> Deserialize<'de> for StatusPageDataAttributes { modified_at, name, page_url, + slack_app_icon, + slack_subscriptions_enabled, subscriptions_enabled, type_, visualization_type, diff --git a/tests/scenarios/features/v2/status_pages.feature b/tests/scenarios/features/v2/status_pages.feature index 4e671f186d..99cb8e3ed6 100644 --- a/tests/scenarios/features/v2/status_pages.feature +++ b/tests/scenarios/features/v2/status_pages.feature @@ -94,6 +94,16 @@ Feature: Status Pages When the request is sent Then the response status is 204 No Content + @generated @skip @team:DataDog/incident-app + Scenario: Edit degradation update returns "OK" response + Given new "EditDegradationUpdate" request + And request contains "degradation_id" parameter from "REPLACE.ME" + And request contains "page_id" parameter from "REPLACE.ME" + And request contains "update_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "We've identified the source of the latency increase and are deploying a fix.", "status": "identified"}, "id": "00000000-0000-0000-0000-000000000000", "type": "degradation_updates"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/incident-app Scenario: Get component returns "OK" response Given new "GetComponent" request @@ -178,6 +188,15 @@ Feature: Status Pages When the request is sent Then the response status is 201 Created + @generated @skip @team:DataDog/incident-app + Scenario: Soft delete degradation update returns "No Content" response + Given new "SoftDeleteDegradationUpdate" request + And request contains "degradation_id" parameter from "REPLACE.ME" + And request contains "page_id" parameter from "REPLACE.ME" + And request contains "update_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + @generated @skip @team:DataDog/incident-app Scenario: Unpublish status page returns "No Content" response Given new "UnpublishStatusPage" request diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 89626bc569..a5c43f6c0f 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -8521,6 +8521,18 @@ "type": "idempotent" } }, + "SoftDeleteDegradationUpdate": { + "tag": "Status Pages", + "undo": { + "type": "idempotent" + } + }, + "EditDegradationUpdate": { + "tag": "Status Pages", + "undo": { + "type": "idempotent" + } + }, "CreateMaintenance": { "tag": "Status Pages", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index 5b7efc21c4..4b2bcdac9f 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -7103,6 +7103,14 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { world .function_mappings .insert("v2.UpdateDegradation".into(), test_v2_update_degradation); + world.function_mappings.insert( + "v2.SoftDeleteDegradationUpdate".into(), + test_v2_soft_delete_degradation_update, + ); + world.function_mappings.insert( + "v2.EditDegradationUpdate".into(), + test_v2_edit_degradation_update, + ); world .function_mappings .insert("v2.CreateMaintenance".into(), test_v2_create_maintenance); @@ -56313,6 +56321,81 @@ fn test_v2_update_degradation(world: &mut DatadogWorld, _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_status_pages + .as_ref() + .expect("api instance not found"); + let degradation_id = + serde_json::from_value(_parameters.get("degradation_id").unwrap().clone()).unwrap(); + let page_id = serde_json::from_value(_parameters.get("page_id").unwrap().clone()).unwrap(); + let update_id = serde_json::from_value(_parameters.get("update_id").unwrap().clone()).unwrap(); + let response = match block_on(api.soft_delete_degradation_update_with_http_info( + degradation_id, + page_id, + update_id, + )) { + 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_edit_degradation_update(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_status_pages + .as_ref() + .expect("api instance not found"); + let degradation_id = + serde_json::from_value(_parameters.get("degradation_id").unwrap().clone()).unwrap(); + let page_id = serde_json::from_value(_parameters.get("page_id").unwrap().clone()).unwrap(); + let update_id = serde_json::from_value(_parameters.get("update_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let include = _parameters + .get("include") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = datadogV2::api_status_pages::EditDegradationUpdateOptionalParams::default(); + params.include = include; + let response = match block_on(api.edit_degradation_update_with_http_info( + degradation_id, + page_id, + update_id, + body, + params, + )) { + 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_create_maintenance(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances