diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 008c85ab9..4db3d56c9 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1282,6 +1282,123 @@ components: type: string x-enum-varnames: - CHECK_STATUS + CloudcraftWidgetDefinition: + description: This widget displays a Cloudcraft topology of cloud resources for the selected provider. + properties: + custom_links: + description: List of custom links. + items: + $ref: "#/components/schemas/WidgetCustomLink" + type: array + description: + description: The description of the widget. + type: string + group_by: + description: List of tags or attributes used to group the cloud resources in the widget. + example: + - "" + items: + description: Tag or attribute used to group cloud resources. + type: string + type: array + highlighted: + description: Search query that visually highlights matching resources in the diagram. + example: "" + type: string + overlay: + $ref: "#/components/schemas/CloudcraftWidgetDefinitionOverlay" + overlay_filter: + description: Filter applied to the selected overlay. + example: "" + type: string + projection: + $ref: "#/components/schemas/CloudcraftWidgetDefinitionProjection" + provider: + $ref: "#/components/schemas/CloudcraftWidgetDefinitionProvider" + query_string: + description: Query string used to filter the cloud resources displayed in the widget. + example: "" + type: string + show_empty_groups: + description: Whether to show empty outline groups in the diagram. + example: false + type: boolean + title: + description: Title of your widget. + type: string + title_align: + $ref: "#/components/schemas/WidgetTextAlign" + title_size: + description: Size of the title. + type: string + type: + $ref: "#/components/schemas/CloudcraftWidgetDefinitionType" + required: + - type + - query_string + - provider + - overlay + - overlay_filter + - group_by + - projection + - highlighted + - show_empty_groups + type: object + CloudcraftWidgetDefinitionOverlay: + description: Overlay applied on top of the Cloudcraft topology. + enum: + - Observability + - CloudCost + - Security + - NDMReachability + - Monitors + - APM + - Default + example: Observability + type: string + x-enum-varnames: + - OBSERVABILITY + - CLOUD_COST + - SECURITY + - NDM_REACHABILITY + - MONITORS + - APM + - DEFAULT + CloudcraftWidgetDefinitionProjection: + description: Projection used to render the Cloudcraft topology. + enum: + - isometric + - 2d + example: isometric + type: string + x-enum-varnames: + - ISOMETRIC + - TWO_D + CloudcraftWidgetDefinitionProvider: + description: Cloud provider for the Cloudcraft widget. + enum: + - aws + - azure + - gcp + - ndm + - oci + example: aws + type: string + x-enum-varnames: + - AWS + - AZURE + - GCP + - NDM + - OCI + CloudcraftWidgetDefinitionType: + default: cloudcraft + description: Type of Cloudcraft widget. + enum: + - cloudcraft + example: cloudcraft + type: string + x-enum-varnames: + - CLOUDCRAFT CohortWidgetDefinition: additionalProperties: false description: The cohort widget visualizes user retention over time. @@ -25597,6 +25714,7 @@ components: - $ref: "#/components/schemas/BarChartWidgetDefinition" - $ref: "#/components/schemas/ChangeWidgetDefinition" - $ref: "#/components/schemas/CheckStatusWidgetDefinition" + - $ref: "#/components/schemas/CloudcraftWidgetDefinition" - $ref: "#/components/schemas/CohortWidgetDefinition" - $ref: "#/components/schemas/DistributionWidgetDefinition" - $ref: "#/components/schemas/EventStreamWidgetDefinition" diff --git a/src/datadogV1/model/mod.rs b/src/datadogV1/model/mod.rs index b4795f4de..9b7942ce6 100644 --- a/src/datadogV1/model/mod.rs +++ b/src/datadogV1/model/mod.rs @@ -398,6 +398,16 @@ pub mod model_widget_grouping; pub use self::model_widget_grouping::WidgetGrouping; pub mod model_check_status_widget_definition_type; pub use self::model_check_status_widget_definition_type::CheckStatusWidgetDefinitionType; +pub mod model_cloudcraft_widget_definition; +pub use self::model_cloudcraft_widget_definition::CloudcraftWidgetDefinition; +pub mod model_cloudcraft_widget_definition_overlay; +pub use self::model_cloudcraft_widget_definition_overlay::CloudcraftWidgetDefinitionOverlay; +pub mod model_cloudcraft_widget_definition_projection; +pub use self::model_cloudcraft_widget_definition_projection::CloudcraftWidgetDefinitionProjection; +pub mod model_cloudcraft_widget_definition_provider; +pub use self::model_cloudcraft_widget_definition_provider::CloudcraftWidgetDefinitionProvider; +pub mod model_cloudcraft_widget_definition_type; +pub use self::model_cloudcraft_widget_definition_type::CloudcraftWidgetDefinitionType; pub mod model_cohort_widget_definition; pub use self::model_cohort_widget_definition::CohortWidgetDefinition; pub mod model_retention_grid_request; diff --git a/src/datadogV1/model/model_cloudcraft_widget_definition.rs b/src/datadogV1/model/model_cloudcraft_widget_definition.rs new file mode 100644 index 000000000..7c041b66a --- /dev/null +++ b/src/datadogV1/model/model_cloudcraft_widget_definition.rs @@ -0,0 +1,327 @@ +// 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}; + +/// This widget displays a Cloudcraft topology of cloud resources for the selected provider. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CloudcraftWidgetDefinition { + /// List of custom links. + #[serde(rename = "custom_links")] + pub custom_links: Option>, + /// The description of the widget. + #[serde(rename = "description")] + pub description: Option, + /// List of tags or attributes used to group the cloud resources in the widget. + #[serde(rename = "group_by")] + pub group_by: Vec, + /// Search query that visually highlights matching resources in the diagram. + #[serde(rename = "highlighted")] + pub highlighted: String, + /// Overlay applied on top of the Cloudcraft topology. + #[serde(rename = "overlay")] + pub overlay: crate::datadogV1::model::CloudcraftWidgetDefinitionOverlay, + /// Filter applied to the selected overlay. + #[serde(rename = "overlay_filter")] + pub overlay_filter: String, + /// Projection used to render the Cloudcraft topology. + #[serde(rename = "projection")] + pub projection: crate::datadogV1::model::CloudcraftWidgetDefinitionProjection, + /// Cloud provider for the Cloudcraft widget. + #[serde(rename = "provider")] + pub provider: crate::datadogV1::model::CloudcraftWidgetDefinitionProvider, + /// Query string used to filter the cloud resources displayed in the widget. + #[serde(rename = "query_string")] + pub query_string: String, + /// Whether to show empty outline groups in the diagram. + #[serde(rename = "show_empty_groups")] + pub show_empty_groups: bool, + /// Title of your widget. + #[serde(rename = "title")] + pub title: Option, + /// How to align the text on the widget. + #[serde(rename = "title_align")] + pub title_align: Option, + /// Size of the title. + #[serde(rename = "title_size")] + pub title_size: Option, + /// Type of Cloudcraft widget. + #[serde(rename = "type")] + pub type_: crate::datadogV1::model::CloudcraftWidgetDefinitionType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CloudcraftWidgetDefinition { + pub fn new( + group_by: Vec, + highlighted: String, + overlay: crate::datadogV1::model::CloudcraftWidgetDefinitionOverlay, + overlay_filter: String, + projection: crate::datadogV1::model::CloudcraftWidgetDefinitionProjection, + provider: crate::datadogV1::model::CloudcraftWidgetDefinitionProvider, + query_string: String, + show_empty_groups: bool, + type_: crate::datadogV1::model::CloudcraftWidgetDefinitionType, + ) -> CloudcraftWidgetDefinition { + CloudcraftWidgetDefinition { + custom_links: None, + description: None, + group_by, + highlighted, + overlay, + overlay_filter, + projection, + provider, + query_string, + show_empty_groups, + title: None, + title_align: None, + title_size: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn custom_links(mut self, value: Vec) -> Self { + self.custom_links = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn title(mut self, value: String) -> Self { + self.title = Some(value); + self + } + + pub fn title_align(mut self, value: crate::datadogV1::model::WidgetTextAlign) -> Self { + self.title_align = Some(value); + self + } + + pub fn title_size(mut self, value: String) -> Self { + self.title_size = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CloudcraftWidgetDefinition { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CloudcraftWidgetDefinitionVisitor; + impl<'a> Visitor<'a> for CloudcraftWidgetDefinitionVisitor { + type Value = CloudcraftWidgetDefinition; + + 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 custom_links: Option> = None; + let mut description: Option = None; + let mut group_by: Option> = None; + let mut highlighted: Option = None; + let mut overlay: Option< + crate::datadogV1::model::CloudcraftWidgetDefinitionOverlay, + > = None; + let mut overlay_filter: Option = None; + let mut projection: Option< + crate::datadogV1::model::CloudcraftWidgetDefinitionProjection, + > = None; + let mut provider: Option< + crate::datadogV1::model::CloudcraftWidgetDefinitionProvider, + > = None; + let mut query_string: Option = None; + let mut show_empty_groups: Option = None; + let mut title: Option = None; + let mut title_align: Option = None; + let mut title_size: 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() { + "custom_links" => { + if v.is_null() { + continue; + } + custom_links = + 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)?); + } + "group_by" => { + group_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "highlighted" => { + highlighted = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "overlay" => { + overlay = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _overlay) = overlay { + match _overlay { + crate::datadogV1::model::CloudcraftWidgetDefinitionOverlay::UnparsedObject(_overlay) => { + _unparsed = true; + }, + _ => {} + } + } + } + "overlay_filter" => { + overlay_filter = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "projection" => { + projection = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _projection) = projection { + match _projection { + crate::datadogV1::model::CloudcraftWidgetDefinitionProjection::UnparsedObject(_projection) => { + _unparsed = true; + }, + _ => {} + } + } + } + "provider" => { + provider = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _provider) = provider { + match _provider { + crate::datadogV1::model::CloudcraftWidgetDefinitionProvider::UnparsedObject(_provider) => { + _unparsed = true; + }, + _ => {} + } + } + } + "query_string" => { + query_string = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "show_empty_groups" => { + show_empty_groups = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "title" => { + if v.is_null() { + continue; + } + title = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "title_align" => { + if v.is_null() { + continue; + } + title_align = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _title_align) = title_align { + match _title_align { + crate::datadogV1::model::WidgetTextAlign::UnparsedObject( + _title_align, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "title_size" => { + if v.is_null() { + continue; + } + title_size = 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::datadogV1::model::CloudcraftWidgetDefinitionType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let group_by = group_by.ok_or_else(|| M::Error::missing_field("group_by"))?; + let highlighted = + highlighted.ok_or_else(|| M::Error::missing_field("highlighted"))?; + let overlay = overlay.ok_or_else(|| M::Error::missing_field("overlay"))?; + let overlay_filter = + overlay_filter.ok_or_else(|| M::Error::missing_field("overlay_filter"))?; + let projection = projection.ok_or_else(|| M::Error::missing_field("projection"))?; + let provider = provider.ok_or_else(|| M::Error::missing_field("provider"))?; + let query_string = + query_string.ok_or_else(|| M::Error::missing_field("query_string"))?; + let show_empty_groups = show_empty_groups + .ok_or_else(|| M::Error::missing_field("show_empty_groups"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = CloudcraftWidgetDefinition { + custom_links, + description, + group_by, + highlighted, + overlay, + overlay_filter, + projection, + provider, + query_string, + show_empty_groups, + title, + title_align, + title_size, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CloudcraftWidgetDefinitionVisitor) + } +} diff --git a/src/datadogV1/model/model_cloudcraft_widget_definition_overlay.rs b/src/datadogV1/model/model_cloudcraft_widget_definition_overlay.rs new file mode 100644 index 000000000..10301809e --- /dev/null +++ b/src/datadogV1/model/model_cloudcraft_widget_definition_overlay.rs @@ -0,0 +1,66 @@ +// 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 CloudcraftWidgetDefinitionOverlay { + OBSERVABILITY, + CLOUD_COST, + SECURITY, + NDM_REACHABILITY, + MONITORS, + APM, + DEFAULT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CloudcraftWidgetDefinitionOverlay { + fn to_string(&self) -> String { + match self { + Self::OBSERVABILITY => String::from("Observability"), + Self::CLOUD_COST => String::from("CloudCost"), + Self::SECURITY => String::from("Security"), + Self::NDM_REACHABILITY => String::from("NDMReachability"), + Self::MONITORS => String::from("Monitors"), + Self::APM => String::from("APM"), + Self::DEFAULT => String::from("Default"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CloudcraftWidgetDefinitionOverlay { + 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 CloudcraftWidgetDefinitionOverlay { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "Observability" => Self::OBSERVABILITY, + "CloudCost" => Self::CLOUD_COST, + "Security" => Self::SECURITY, + "NDMReachability" => Self::NDM_REACHABILITY, + "Monitors" => Self::MONITORS, + "APM" => Self::APM, + "Default" => Self::DEFAULT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV1/model/model_cloudcraft_widget_definition_projection.rs b/src/datadogV1/model/model_cloudcraft_widget_definition_projection.rs new file mode 100644 index 000000000..e628e950b --- /dev/null +++ b/src/datadogV1/model/model_cloudcraft_widget_definition_projection.rs @@ -0,0 +1,51 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CloudcraftWidgetDefinitionProjection { + ISOMETRIC, + TWO_D, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CloudcraftWidgetDefinitionProjection { + fn to_string(&self) -> String { + match self { + Self::ISOMETRIC => String::from("isometric"), + Self::TWO_D => String::from("2d"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CloudcraftWidgetDefinitionProjection { + 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 CloudcraftWidgetDefinitionProjection { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "isometric" => Self::ISOMETRIC, + "2d" => Self::TWO_D, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV1/model/model_cloudcraft_widget_definition_provider.rs b/src/datadogV1/model/model_cloudcraft_widget_definition_provider.rs new file mode 100644 index 000000000..5cf3307c5 --- /dev/null +++ b/src/datadogV1/model/model_cloudcraft_widget_definition_provider.rs @@ -0,0 +1,60 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CloudcraftWidgetDefinitionProvider { + AWS, + AZURE, + GCP, + NDM, + OCI, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CloudcraftWidgetDefinitionProvider { + fn to_string(&self) -> String { + match self { + Self::AWS => String::from("aws"), + Self::AZURE => String::from("azure"), + Self::GCP => String::from("gcp"), + Self::NDM => String::from("ndm"), + Self::OCI => String::from("oci"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CloudcraftWidgetDefinitionProvider { + 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 CloudcraftWidgetDefinitionProvider { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "aws" => Self::AWS, + "azure" => Self::AZURE, + "gcp" => Self::GCP, + "ndm" => Self::NDM, + "oci" => Self::OCI, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV1/model/model_cloudcraft_widget_definition_type.rs b/src/datadogV1/model/model_cloudcraft_widget_definition_type.rs new file mode 100644 index 000000000..c04be7c2c --- /dev/null +++ b/src/datadogV1/model/model_cloudcraft_widget_definition_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 CloudcraftWidgetDefinitionType { + CLOUDCRAFT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CloudcraftWidgetDefinitionType { + fn to_string(&self) -> String { + match self { + Self::CLOUDCRAFT => String::from("cloudcraft"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CloudcraftWidgetDefinitionType { + 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 CloudcraftWidgetDefinitionType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "cloudcraft" => Self::CLOUDCRAFT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV1/model/model_widget_definition.rs b/src/datadogV1/model/model_widget_definition.rs index 868d5e20d..635b55a76 100644 --- a/src/datadogV1/model/model_widget_definition.rs +++ b/src/datadogV1/model/model_widget_definition.rs @@ -13,6 +13,7 @@ pub enum WidgetDefinition { BarChartWidgetDefinition(Box), ChangeWidgetDefinition(Box), CheckStatusWidgetDefinition(Box), + CloudcraftWidgetDefinition(Box), CohortWidgetDefinition(Box), DistributionWidgetDefinition(Box), EventStreamWidgetDefinition(Box), @@ -98,6 +99,14 @@ impl<'de> Deserialize<'de> for WidgetDefinition { return Ok(WidgetDefinition::CheckStatusWidgetDefinition(_v)); } } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(WidgetDefinition::CloudcraftWidgetDefinition(_v)); + } + } if let Ok(_v) = serde_json::from_value::>( value.clone(), ) {