Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
55 changes: 55 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions src/datadogV2/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
40 changes: 39 additions & 1 deletion src/datadogV2/model/model_api_key_create_attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
/// 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<bool>,
#[serde(skip)]
#[serde(default)]
pub(crate) _unparsed: bool,
Expand All @@ -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 {
Expand All @@ -45,20 +63,40 @@ impl<'de> Deserialize<'de> for APIKeyCreateAttributes {
where
M: MapAccess<'a>,
{
let mut category: Option<String> = None;
let mut name: Option<String> = None;
let mut remote_config_read_enabled: Option<bool> = None;
let mut _unparsed = false;

while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
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)
}
Expand Down
8 changes: 8 additions & 0 deletions src/datadogV2/model/model_api_key_response_included_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use serde::{Deserialize, Deserializer, Serialize};
#[serde(untagged)]
pub enum APIKeyResponseIncludedItem {
User(Box<crate::datadogV2::model::User>),
LeakedKey(Box<crate::datadogV2::model::LeakedKey>),
UnparsedObject(crate::datadog::UnparsedObject),
}

Expand All @@ -24,6 +25,13 @@ impl<'de> Deserialize<'de> for APIKeyResponseIncludedItem {
return Ok(APIKeyResponseIncludedItem::User(_v));
}
}
if let Ok(_v) =
serde_json::from_value::<Box<crate::datadogV2::model::LeakedKey>>(value.clone())
{
if !_v._unparsed {
return Ok(APIKeyResponseIncludedItem::LeakedKey(_v));
}
}

return Ok(APIKeyResponseIncludedItem::UnparsedObject(
crate::datadog::UnparsedObject { value },
Expand Down
40 changes: 39 additions & 1 deletion src/datadogV2/model/model_api_key_update_attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
/// 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<bool>,
#[serde(skip)]
#[serde(default)]
pub(crate) _unparsed: bool,
Expand All @@ -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 {
Expand All @@ -45,20 +63,40 @@ impl<'de> Deserialize<'de> for APIKeyUpdateAttributes {
where
M: MapAccess<'a>,
{
let mut category: Option<String> = None;
let mut name: Option<String> = None;
let mut remote_config_read_enabled: Option<bool> = None;
let mut _unparsed = false;

while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use serde::{Deserialize, Deserializer, Serialize};
pub enum ApplicationKeyResponseIncludedItem {
User(Box<crate::datadogV2::model::User>),
Role(Box<crate::datadogV2::model::Role>),
LeakedKey(Box<crate::datadogV2::model::LeakedKey>),
UnparsedObject(crate::datadog::UnparsedObject),
}

Expand All @@ -31,6 +32,13 @@ impl<'de> Deserialize<'de> for ApplicationKeyResponseIncludedItem {
return Ok(ApplicationKeyResponseIncludedItem::Role(_v));
}
}
if let Ok(_v) =
serde_json::from_value::<Box<crate::datadogV2::model::LeakedKey>>(value.clone())
{
if !_v._unparsed {
return Ok(ApplicationKeyResponseIncludedItem::LeakedKey(_v));
}
}

return Ok(ApplicationKeyResponseIncludedItem::UnparsedObject(
crate::datadog::UnparsedObject { value },
Expand Down
12 changes: 6 additions & 6 deletions src/datadogV2/model/model_full_api_key_attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct FullAPIKeyAttributes {
pub category: Option<String>,
/// Creation date of the API key.
#[serde(rename = "created_at")]
pub created_at: Option<String>,
pub created_at: Option<chrono::DateTime<chrono::Utc>>,
/// The API key.
#[serde(rename = "key")]
pub key: Option<String>,
Expand All @@ -25,7 +25,7 @@ pub struct FullAPIKeyAttributes {
pub last4: Option<String>,
/// Date the API key was last modified.
#[serde(rename = "modified_at")]
pub modified_at: Option<String>,
pub modified_at: Option<chrono::DateTime<chrono::Utc>>,
/// Name of the API key.
#[serde(rename = "name")]
pub name: Option<String>,
Expand Down Expand Up @@ -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<chrono::Utc>) -> Self {
self.created_at = Some(value);
self
}
Expand All @@ -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<chrono::Utc>) -> Self {
self.modified_at = Some(value);
self
}
Expand Down Expand Up @@ -111,10 +111,10 @@ impl<'de> Deserialize<'de> for FullAPIKeyAttributes {
M: MapAccess<'a>,
{
let mut category: Option<String> = None;
let mut created_at: Option<String> = None;
let mut created_at: Option<chrono::DateTime<chrono::Utc>> = None;
let mut key: Option<String> = None;
let mut last4: Option<String> = None;
let mut modified_at: Option<String> = None;
let mut modified_at: Option<chrono::DateTime<chrono::Utc>> = None;
let mut name: Option<String> = None;
let mut remote_config_read_enabled: Option<bool> = None;
let mut _unparsed = false;
Expand Down
Loading
Loading