From 72992162142d56205b5c3dcabbb82953dd08a8be Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 14 Aug 2024 22:37:10 +0000 Subject: [PATCH] Regenerate client from commit 07d72513 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 55 +++++++++ src/datadogV2/model/mod.rs | 6 + .../model/model_api_key_create_attributes.rs | 40 ++++++- .../model_api_key_response_included_item.rs | 8 ++ .../model/model_api_key_update_attributes.rs | 40 ++++++- ..._application_key_response_included_item.rs | 8 ++ .../model/model_full_api_key_attributes.rs | 12 +- src/datadogV2/model/model_leaked_key.rs | 106 ++++++++++++++++++ .../model/model_leaked_key_attributes.rs | 90 +++++++++++++++ src/datadogV2/model/model_leaked_key_type.rs | 48 ++++++++ 11 files changed, 409 insertions(+), 12 deletions(-) create mode 100644 src/datadogV2/model/model_leaked_key.rs create mode 100644 src/datadogV2/model/model_leaked_key_attributes.rs create mode 100644 src/datadogV2/model/model_leaked_key_type.rs diff --git a/.apigentools-info b/.apigentools-info index 8a6d6194c..34b2c2e9d 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-08-14 22:02:41.175864", - "spec_repo_commit": "5e33062a" + "regenerated": "2024-08-14 22:32:06.462762", + "spec_repo_commit": "07d72513" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-08-14 22:02:41.194584", - "spec_repo_commit": "5e33062a" + "regenerated": "2024-08-14 22:32:06.480578", + "spec_repo_commit": "07d72513" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e77e01633..5bc7b9beb 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -673,10 +673,16 @@ components: APIKeyCreateAttributes: description: Attributes used to create an API Key. properties: + category: + description: The APIKeyCreateAttributes category. + type: string name: description: Name of the API key. example: API Key for submitting metrics type: string + remote_config_read_enabled: + description: The APIKeyCreateAttributes remote_config_read_enabled. + type: boolean required: - name type: object @@ -722,13 +728,20 @@ components: description: An object related to an API key. oneOf: - $ref: '#/components/schemas/User' + - $ref: '#/components/schemas/LeakedKey' APIKeyUpdateAttributes: description: Attributes used to update an API Key. properties: + category: + description: The APIKeyUpdateAttributes category. + type: string name: description: Name of the API key. example: API Key for submitting metrics type: string + remote_config_read_enabled: + description: The APIKeyUpdateAttributes remote_config_read_enabled. + type: boolean required: - name type: object @@ -981,6 +994,7 @@ components: oneOf: - $ref: '#/components/schemas/User' - $ref: '#/components/schemas/Role' + - $ref: '#/components/schemas/LeakedKey' ApplicationKeyResponseMeta: description: Additional information related to the application key response. properties: @@ -8461,6 +8475,7 @@ components: created_at: description: Creation date of the API key. example: '2020-11-23T10:00:00.000Z' + format: date-time readOnly: true type: string key: @@ -8477,6 +8492,7 @@ components: modified_at: description: Date the API key was last modified. example: '2020-11-23T10:00:00.000Z' + format: date-time readOnly: true type: string name: @@ -11140,6 +11156,45 @@ components: description: Jira project key type: string type: object + LeakedKey: + description: The definition of LeakedKey object. + properties: + attributes: + $ref: '#/components/schemas/LeakedKeyAttributes' + id: + description: The LeakedKey id. + example: id + type: string + type: + $ref: '#/components/schemas/LeakedKeyType' + required: + - attributes + - id + - type + type: object + LeakedKeyAttributes: + description: The definition of LeakedKeyAttributes object. + properties: + date: + description: The LeakedKeyAttributes date. + example: '2017-07-21T17:32:28Z' + format: date-time + type: string + leak_source: + description: The LeakedKeyAttributes leak_source. + type: string + required: + - date + type: object + LeakedKeyType: + default: leaked_keys + description: The definition of LeakedKeyType object. + enum: + - leaked_keys + example: leaked_keys + type: string + x-enum-varnames: + - LEAKED_KEYS ListAPIsResponse: description: Response for `ListAPIs`. properties: diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 23eb5c058..897d96a3c 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -46,6 +46,12 @@ pub mod model_relationship_to_role_data; pub use self::model_relationship_to_role_data::RelationshipToRoleData; pub mod model_roles_type; pub use self::model_roles_type::RolesType; +pub mod model_leaked_key; +pub use self::model_leaked_key::LeakedKey; +pub mod model_leaked_key_attributes; +pub use self::model_leaked_key_attributes::LeakedKeyAttributes; +pub mod model_leaked_key_type; +pub use self::model_leaked_key_type::LeakedKeyType; pub mod model_api_key_response_included_item; pub use self::model_api_key_response_included_item::APIKeyResponseIncludedItem; pub mod model_api_keys_response_meta; diff --git a/src/datadogV2/model/model_api_key_create_attributes.rs b/src/datadogV2/model/model_api_key_create_attributes.rs index 057edd590..d4141bc0b 100644 --- a/src/datadogV2/model/model_api_key_create_attributes.rs +++ b/src/datadogV2/model/model_api_key_create_attributes.rs @@ -11,9 +11,15 @@ use std::fmt::{self, Formatter}; #[skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize)] pub struct APIKeyCreateAttributes { + /// The APIKeyCreateAttributes category. + #[serde(rename = "category")] + pub category: Option, /// Name of the API key. #[serde(rename = "name")] pub name: String, + /// The APIKeyCreateAttributes remote_config_read_enabled. + #[serde(rename = "remote_config_read_enabled")] + pub remote_config_read_enabled: Option, #[serde(skip)] #[serde(default)] pub(crate) _unparsed: bool, @@ -22,10 +28,22 @@ pub struct APIKeyCreateAttributes { impl APIKeyCreateAttributes { pub fn new(name: String) -> APIKeyCreateAttributes { APIKeyCreateAttributes { + category: None, name, + remote_config_read_enabled: None, _unparsed: false, } } + + pub fn category(mut self, value: String) -> Self { + self.category = Some(value); + self + } + + pub fn remote_config_read_enabled(mut self, value: bool) -> Self { + self.remote_config_read_enabled = Some(value); + self + } } impl<'de> Deserialize<'de> for APIKeyCreateAttributes { @@ -45,20 +63,40 @@ impl<'de> Deserialize<'de> for APIKeyCreateAttributes { where M: MapAccess<'a>, { + let mut category: Option = None; let mut name: Option = None; + let mut remote_config_read_enabled: Option = None; let mut _unparsed = false; while let Some((k, v)) = map.next_entry::()? { match k.as_str() { + "category" => { + if v.is_null() { + continue; + } + category = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "name" => { name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "remote_config_read_enabled" => { + if v.is_null() { + continue; + } + remote_config_read_enabled = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } &_ => {} } } let name = name.ok_or_else(|| M::Error::missing_field("name"))?; - let content = APIKeyCreateAttributes { name, _unparsed }; + let content = APIKeyCreateAttributes { + category, + name, + remote_config_read_enabled, + _unparsed, + }; Ok(content) } diff --git a/src/datadogV2/model/model_api_key_response_included_item.rs b/src/datadogV2/model/model_api_key_response_included_item.rs index 51d1aa772..f40fb2bb3 100644 --- a/src/datadogV2/model/model_api_key_response_included_item.rs +++ b/src/datadogV2/model/model_api_key_response_included_item.rs @@ -9,6 +9,7 @@ use serde::{Deserialize, Deserializer, Serialize}; #[serde(untagged)] pub enum APIKeyResponseIncludedItem { User(Box), + LeakedKey(Box), UnparsedObject(crate::datadog::UnparsedObject), } @@ -24,6 +25,13 @@ impl<'de> Deserialize<'de> for APIKeyResponseIncludedItem { return Ok(APIKeyResponseIncludedItem::User(_v)); } } + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(APIKeyResponseIncludedItem::LeakedKey(_v)); + } + } return Ok(APIKeyResponseIncludedItem::UnparsedObject( crate::datadog::UnparsedObject { value }, diff --git a/src/datadogV2/model/model_api_key_update_attributes.rs b/src/datadogV2/model/model_api_key_update_attributes.rs index be3ba7383..a9a29de66 100644 --- a/src/datadogV2/model/model_api_key_update_attributes.rs +++ b/src/datadogV2/model/model_api_key_update_attributes.rs @@ -11,9 +11,15 @@ use std::fmt::{self, Formatter}; #[skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize)] pub struct APIKeyUpdateAttributes { + /// The APIKeyUpdateAttributes category. + #[serde(rename = "category")] + pub category: Option, /// Name of the API key. #[serde(rename = "name")] pub name: String, + /// The APIKeyUpdateAttributes remote_config_read_enabled. + #[serde(rename = "remote_config_read_enabled")] + pub remote_config_read_enabled: Option, #[serde(skip)] #[serde(default)] pub(crate) _unparsed: bool, @@ -22,10 +28,22 @@ pub struct APIKeyUpdateAttributes { impl APIKeyUpdateAttributes { pub fn new(name: String) -> APIKeyUpdateAttributes { APIKeyUpdateAttributes { + category: None, name, + remote_config_read_enabled: None, _unparsed: false, } } + + pub fn category(mut self, value: String) -> Self { + self.category = Some(value); + self + } + + pub fn remote_config_read_enabled(mut self, value: bool) -> Self { + self.remote_config_read_enabled = Some(value); + self + } } impl<'de> Deserialize<'de> for APIKeyUpdateAttributes { @@ -45,20 +63,40 @@ impl<'de> Deserialize<'de> for APIKeyUpdateAttributes { where M: MapAccess<'a>, { + let mut category: Option = None; let mut name: Option = None; + let mut remote_config_read_enabled: Option = None; let mut _unparsed = false; while let Some((k, v)) = map.next_entry::()? { match k.as_str() { + "category" => { + if v.is_null() { + continue; + } + category = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "name" => { name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "remote_config_read_enabled" => { + if v.is_null() { + continue; + } + remote_config_read_enabled = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } &_ => {} } } let name = name.ok_or_else(|| M::Error::missing_field("name"))?; - let content = APIKeyUpdateAttributes { name, _unparsed }; + let content = APIKeyUpdateAttributes { + category, + name, + remote_config_read_enabled, + _unparsed, + }; Ok(content) } diff --git a/src/datadogV2/model/model_application_key_response_included_item.rs b/src/datadogV2/model/model_application_key_response_included_item.rs index 1905e7ac0..3cb7aaa9c 100644 --- a/src/datadogV2/model/model_application_key_response_included_item.rs +++ b/src/datadogV2/model/model_application_key_response_included_item.rs @@ -10,6 +10,7 @@ use serde::{Deserialize, Deserializer, Serialize}; pub enum ApplicationKeyResponseIncludedItem { User(Box), Role(Box), + LeakedKey(Box), UnparsedObject(crate::datadog::UnparsedObject), } @@ -31,6 +32,13 @@ impl<'de> Deserialize<'de> for ApplicationKeyResponseIncludedItem { return Ok(ApplicationKeyResponseIncludedItem::Role(_v)); } } + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(ApplicationKeyResponseIncludedItem::LeakedKey(_v)); + } + } return Ok(ApplicationKeyResponseIncludedItem::UnparsedObject( crate::datadog::UnparsedObject { value }, diff --git a/src/datadogV2/model/model_full_api_key_attributes.rs b/src/datadogV2/model/model_full_api_key_attributes.rs index 16a483a75..c03157eb1 100644 --- a/src/datadogV2/model/model_full_api_key_attributes.rs +++ b/src/datadogV2/model/model_full_api_key_attributes.rs @@ -16,7 +16,7 @@ pub struct FullAPIKeyAttributes { pub category: Option, /// Creation date of the API key. #[serde(rename = "created_at")] - pub created_at: Option, + pub created_at: Option>, /// The API key. #[serde(rename = "key")] pub key: Option, @@ -25,7 +25,7 @@ pub struct FullAPIKeyAttributes { pub last4: Option, /// Date the API key was last modified. #[serde(rename = "modified_at")] - pub modified_at: Option, + pub modified_at: Option>, /// Name of the API key. #[serde(rename = "name")] pub name: Option, @@ -56,7 +56,7 @@ impl FullAPIKeyAttributes { self } - pub fn created_at(mut self, value: String) -> Self { + pub fn created_at(mut self, value: chrono::DateTime) -> Self { self.created_at = Some(value); self } @@ -71,7 +71,7 @@ impl FullAPIKeyAttributes { self } - pub fn modified_at(mut self, value: String) -> Self { + pub fn modified_at(mut self, value: chrono::DateTime) -> Self { self.modified_at = Some(value); self } @@ -111,10 +111,10 @@ impl<'de> Deserialize<'de> for FullAPIKeyAttributes { M: MapAccess<'a>, { let mut category: Option = None; - let mut created_at: Option = None; + let mut created_at: Option> = None; let mut key: Option = None; let mut last4: Option = None; - let mut modified_at: Option = None; + let mut modified_at: Option> = None; let mut name: Option = None; let mut remote_config_read_enabled: Option = None; let mut _unparsed = false; diff --git a/src/datadogV2/model/model_leaked_key.rs b/src/datadogV2/model/model_leaked_key.rs new file mode 100644 index 000000000..6479f1c5b --- /dev/null +++ b/src/datadogV2/model/model_leaked_key.rs @@ -0,0 +1,106 @@ +// 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 definition of LeakedKey object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LeakedKey { + /// The definition of LeakedKeyAttributes object. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LeakedKeyAttributes, + /// The LeakedKey id. + #[serde(rename = "id")] + pub id: String, + /// The definition of LeakedKeyType object. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LeakedKeyType, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LeakedKey { + pub fn new( + attributes: crate::datadogV2::model::LeakedKeyAttributes, + id: String, + type_: crate::datadogV2::model::LeakedKeyType, + ) -> LeakedKey { + LeakedKey { + attributes, + id, + type_, + _unparsed: false, + } + } +} + +impl<'de> Deserialize<'de> for LeakedKey { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LeakedKeyVisitor; + impl<'a> Visitor<'a> for LeakedKeyVisitor { + type Value = LeakedKey; + + 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 = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LeakedKeyType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => {} + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LeakedKey { + attributes, + id, + type_, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LeakedKeyVisitor) + } +} diff --git a/src/datadogV2/model/model_leaked_key_attributes.rs b/src/datadogV2/model/model_leaked_key_attributes.rs new file mode 100644 index 000000000..deb03168c --- /dev/null +++ b/src/datadogV2/model/model_leaked_key_attributes.rs @@ -0,0 +1,90 @@ +// 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 definition of LeakedKeyAttributes object. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LeakedKeyAttributes { + /// The LeakedKeyAttributes date. + #[serde(rename = "date")] + pub date: chrono::DateTime, + /// The LeakedKeyAttributes leak_source. + #[serde(rename = "leak_source")] + pub leak_source: Option, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LeakedKeyAttributes { + pub fn new(date: chrono::DateTime) -> LeakedKeyAttributes { + LeakedKeyAttributes { + date, + leak_source: None, + _unparsed: false, + } + } + + pub fn leak_source(mut self, value: String) -> Self { + self.leak_source = Some(value); + self + } +} + +impl<'de> Deserialize<'de> for LeakedKeyAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LeakedKeyAttributesVisitor; + impl<'a> Visitor<'a> for LeakedKeyAttributesVisitor { + type Value = LeakedKeyAttributes; + + 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 date: Option> = None; + let mut leak_source: Option = None; + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "date" => { + date = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "leak_source" => { + if v.is_null() { + continue; + } + leak_source = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => {} + } + } + let date = date.ok_or_else(|| M::Error::missing_field("date"))?; + + let content = LeakedKeyAttributes { + date, + leak_source, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LeakedKeyAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_leaked_key_type.rs b/src/datadogV2/model/model_leaked_key_type.rs new file mode 100644 index 000000000..fda60a693 --- /dev/null +++ b/src/datadogV2/model/model_leaked_key_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 LeakedKeyType { + LEAKED_KEYS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for LeakedKeyType { + fn to_string(&self) -> String { + match self { + Self::LEAKED_KEYS => String::from("leaked_keys"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for LeakedKeyType { + 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 LeakedKeyType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "leaked_keys" => Self::LEAKED_KEYS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +}