Skip to content

Commit d046068

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 20b3bfd of spec repo
1 parent b9f6adc commit d046068

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9168,6 +9168,11 @@ components:
91689168
CaseCreateAttributes:
91699169
description: Case creation attributes
91709170
properties:
9171+
custom_attributes:
9172+
additionalProperties:
9173+
$ref: '#/components/schemas/CustomAttributeValue'
9174+
description: Case custom attributes
9175+
type: object
91719176
description:
91729177
description: Description
91739178
type: string

src/datadogV2/model/model_case_create_attributes.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ use std::fmt::{self, Formatter};
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct CaseCreateAttributes {
14+
/// Case custom attributes
15+
#[serde(rename = "custom_attributes")]
16+
pub custom_attributes:
17+
Option<std::collections::BTreeMap<String, crate::datadogV2::model::CustomAttributeValue>>,
1418
/// Description
1519
#[serde(rename = "description")]
1620
pub description: Option<String>,
@@ -33,6 +37,7 @@ pub struct CaseCreateAttributes {
3337
impl CaseCreateAttributes {
3438
pub fn new(title: String, type_id: String) -> CaseCreateAttributes {
3539
CaseCreateAttributes {
40+
custom_attributes: None,
3641
description: None,
3742
priority: None,
3843
title,
@@ -42,6 +47,14 @@ impl CaseCreateAttributes {
4247
}
4348
}
4449

50+
pub fn custom_attributes(
51+
mut self,
52+
value: std::collections::BTreeMap<String, crate::datadogV2::model::CustomAttributeValue>,
53+
) -> Self {
54+
self.custom_attributes = Some(value);
55+
self
56+
}
57+
4558
pub fn description(mut self, value: String) -> Self {
4659
self.description = Some(value);
4760
self
@@ -78,6 +91,12 @@ impl<'de> Deserialize<'de> for CaseCreateAttributes {
7891
where
7992
M: MapAccess<'a>,
8093
{
94+
let mut custom_attributes: Option<
95+
std::collections::BTreeMap<
96+
String,
97+
crate::datadogV2::model::CustomAttributeValue,
98+
>,
99+
> = None;
81100
let mut description: Option<String> = None;
82101
let mut priority: Option<crate::datadogV2::model::CasePriority> = None;
83102
let mut title: Option<String> = None;
@@ -90,6 +109,13 @@ impl<'de> Deserialize<'de> for CaseCreateAttributes {
90109

91110
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
92111
match k.as_str() {
112+
"custom_attributes" => {
113+
if v.is_null() {
114+
continue;
115+
}
116+
custom_attributes =
117+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
118+
}
93119
"description" => {
94120
if v.is_null() {
95121
continue;
@@ -130,6 +156,7 @@ impl<'de> Deserialize<'de> for CaseCreateAttributes {
130156
let type_id = type_id.ok_or_else(|| M::Error::missing_field("type_id"))?;
131157

132158
let content = CaseCreateAttributes {
159+
custom_attributes,
133160
description,
134161
priority,
135162
title,

tests/scenarios/features/v2/given.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
"parameters": [
169169
{
170170
"name": "body",
171-
"value": "{\n \"data\": {\n \"attributes\": {\n \"title\": \"My new case\",\n \"type_id\": \"00000000-0000-0000-0000-000000000001\",\n \"priority\": \"P4\"\n },\n \"relationships\": {\n \"project\": {\n \"data\": {\n \"id\": \"d4bbe1af-f36e-42f1-87c1-493ca35c320e\",\n \"type\": \"project\"\n }\n }\n },\n \"type\": \"case\"\n }\n}"
171+
"value": "{\n \"data\": {\n \"attributes\": {\n \"title\": \"My new case\",\n \"type_id\": \"00000000-0000-0000-0000-000000000001\",\n \"priority\": \"P4\",\n \"custom_attributes\": {\n \"severity\": {\n \"type\": \"SELECT\",\n \"value\": \"High\",\n \"is_multi\": false\n },\n \"affected_systems\": {\n \"type\": \"TEXT\",\n \"value\": [\"Web API\", \"Mobile App\"],\n \"is_multi\": true\n }\n }\n },\n \"relationships\": {\n \"project\": {\n \"data\": {\n \"id\": \"d4bbe1af-f36e-42f1-87c1-493ca35c320e\",\n \"type\": \"project\"\n }\n }\n },\n \"type\": \"case\"\n }\n}"
172172
}
173173
],
174174
"source": "data",
@@ -181,7 +181,7 @@
181181
"parameters": [
182182
{
183183
"name": "body",
184-
"value": "{\n \"data\": {\n \"attributes\": {\n \"title\": \"My new case\",\n \"type_id\": \"{{ case_type.id }}\",\n \"priority\": \"P4\"\n },\n \"relationships\": {\n \"project\": {\n \"data\": {\n \"id\": \"d4bbe1af-f36e-42f1-87c1-493ca35c320e\",\n \"type\": \"project\"\n }\n }\n },\n \"type\": \"case\"\n }\n}"
184+
"value": "{\n \"data\": {\n \"attributes\": {\n \"title\": \"My new case\",\n \"type_id\": \"{{ case_type.id }}\",\n \"priority\": \"P4\",\n \"custom_attributes\": {\n \"impact\": {\n \"type\": \"SELECT\",\n \"value\": \"Critical\",\n \"is_multi\": false\n },\n \"tags\": {\n \"type\": \"TEXT\",\n \"value\": [\"security\", \"urgent\"],\n \"is_multi\": true\n }\n }\n },\n \"relationships\": {\n \"project\": {\n \"data\": {\n \"id\": \"d4bbe1af-f36e-42f1-87c1-493ca35c320e\",\n \"type\": \"project\"\n }\n }\n },\n \"type\": \"case\"\n }\n}"
185185
}
186186
],
187187
"source": "data",

0 commit comments

Comments
 (0)