Skip to content

Commit 5dabfa4

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Fix VFTs and extracted local variables enum types (#218)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 1c83720 commit 5dabfa4

8 files changed

+104
-21
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-08-29 20:01:57.245800",
8-
"spec_repo_commit": "518ca9df"
7+
"regenerated": "2024-09-03 13:58:40.716012",
8+
"spec_repo_commit": "ff772101"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-08-29 20:01:57.263520",
13-
"spec_repo_commit": "518ca9df"
12+
"regenerated": "2024-09-03 13:58:40.734640",
13+
"spec_repo_commit": "ff772101"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15267,17 +15267,18 @@ components:
1526715267
- type
1526815268
type: object
1526915269
SyntheticsGlobalVariableParseTestOptionsType:
15270-
description: Property of the Synthetic Test Response to use for a Synthetic
15271-
global variable.
15270+
description: Type of value to extract from a test for a Synthetic global variable.
1527215271
enum:
1527315272
- http_body
1527415273
- http_header
15274+
- http_status_code
1527515275
- local_variable
1527615276
example: http_body
1527715277
type: string
1527815278
x-enum-varnames:
1527915279
- HTTP_BODY
1528015280
- HTTP_HEADER
15281+
- HTTP_STATUS_CODE
1528115282
- LOCAL_VARIABLE
1528215283
SyntheticsGlobalVariableParserType:
1528315284
description: Type of parser for a Synthetic global variable from a synthetics
@@ -15396,6 +15397,23 @@ components:
1539615397
$ref: '#/components/schemas/SyntheticsTestDetails'
1539715398
type: array
1539815399
type: object
15400+
SyntheticsLocalVariableParsingOptionsType:
15401+
description: Property of the Synthetic Test Response to extract into a local
15402+
variable.
15403+
enum:
15404+
- grpc_message
15405+
- grpc_metadata
15406+
- http_body
15407+
- http_header
15408+
- http_status_code
15409+
example: http_body
15410+
type: string
15411+
x-enum-varnames:
15412+
- GRPC_MESSAGE
15413+
- GRPC_METADATA
15414+
- HTTP_BODY
15415+
- HTTP_HEADER
15416+
- HTTP_STATUS_CODE
1539915417
SyntheticsLocation:
1540015418
description: 'Synthetic location that can be used when creating or editing a
1540115419

@@ -15422,8 +15440,8 @@ components:
1542215440
example: {}
1542315441
properties:
1542415442
field:
15425-
description: When type is `http_header`, name of the header to use to extract
15426-
the value.
15443+
description: When type is `http_header` or `grpc_metadata`, name of the
15444+
header or metadatum to extract.
1542715445
example: content-type
1542815446
type: string
1542915447
name:
@@ -15435,7 +15453,7 @@ components:
1543515453
description: Determines whether or not the extracted value will be obfuscated.
1543615454
type: boolean
1543715455
type:
15438-
$ref: '#/components/schemas/SyntheticsGlobalVariableParseTestOptionsType'
15456+
$ref: '#/components/schemas/SyntheticsLocalVariableParsingOptionsType'
1543915457
type: object
1544015458
SyntheticsPatchTestBody:
1544115459
description: Wrapper around an array of [JSON Patch](https://jsonpatch.com)
@@ -16010,7 +16028,7 @@ components:
1601016028
type: object
1601116029
SyntheticsTestMetadata:
1601216030
additionalProperties:
16013-
description: A single Metadatum.
16031+
description: A single metadatum.
1601416032
type: string
1601516033
description: Metadata to include when performing the gRPC test.
1601616034
type: object

examples/v1_synthetics_CreateSyntheticsAPITest_1279271422.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use datadog_api_client::datadogV1::model::SyntheticsAssertionTarget;
1616
use datadog_api_client::datadogV1::model::SyntheticsAssertionType;
1717
use datadog_api_client::datadogV1::model::SyntheticsConfigVariable;
1818
use datadog_api_client::datadogV1::model::SyntheticsConfigVariableType;
19-
use datadog_api_client::datadogV1::model::SyntheticsGlobalVariableParseTestOptionsType;
2019
use datadog_api_client::datadogV1::model::SyntheticsGlobalVariableParserType;
20+
use datadog_api_client::datadogV1::model::SyntheticsLocalVariableParsingOptionsType;
2121
use datadog_api_client::datadogV1::model::SyntheticsParsingOptions;
2222
use datadog_api_client::datadogV1::model::SyntheticsTestCallType;
2323
use datadog_api_client::datadogV1::model::SyntheticsTestDetailsSubType;
@@ -77,7 +77,7 @@ async fn main() {
7777
),
7878
)
7979
.secure(true)
80-
.type_(SyntheticsGlobalVariableParseTestOptionsType::HTTP_HEADER)
80+
.type_(SyntheticsLocalVariableParsingOptionsType::HTTP_HEADER)
8181
],
8282
)
8383
.is_critical(true)

src/datadogV1/model/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,8 +1394,8 @@ pub mod model_synthetics_variable_parser;
13941394
pub use self::model_synthetics_variable_parser::SyntheticsVariableParser;
13951395
pub mod model_synthetics_global_variable_parser_type;
13961396
pub use self::model_synthetics_global_variable_parser_type::SyntheticsGlobalVariableParserType;
1397-
pub mod model_synthetics_global_variable_parse_test_options_type;
1398-
pub use self::model_synthetics_global_variable_parse_test_options_type::SyntheticsGlobalVariableParseTestOptionsType;
1397+
pub mod model_synthetics_local_variable_parsing_options_type;
1398+
pub use self::model_synthetics_local_variable_parsing_options_type::SyntheticsLocalVariableParsingOptionsType;
13991399
pub mod model_synthetics_api_test_step_subtype;
14001400
pub use self::model_synthetics_api_test_step_subtype::SyntheticsAPITestStepSubtype;
14011401
pub mod model_synthetics_api_wait_step;
@@ -1510,6 +1510,8 @@ pub mod model_synthetics_global_variable_attributes;
15101510
pub use self::model_synthetics_global_variable_attributes::SyntheticsGlobalVariableAttributes;
15111511
pub mod model_synthetics_global_variable_parse_test_options;
15121512
pub use self::model_synthetics_global_variable_parse_test_options::SyntheticsGlobalVariableParseTestOptions;
1513+
pub mod model_synthetics_global_variable_parse_test_options_type;
1514+
pub use self::model_synthetics_global_variable_parse_test_options_type::SyntheticsGlobalVariableParseTestOptionsType;
15131515
pub mod model_synthetics_global_variable_value;
15141516
pub use self::model_synthetics_global_variable_value::SyntheticsGlobalVariableValue;
15151517
pub mod model_synthetics_global_variable_options;

src/datadogV1/model/model_synthetics_global_variable_parse_test_options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub struct SyntheticsGlobalVariableParseTestOptions {
2020
/// Details of the parser to use for the global variable.
2121
#[serde(rename = "parser")]
2222
pub parser: Option<crate::datadogV1::model::SyntheticsVariableParser>,
23-
/// Property of the Synthetic Test Response to use for a Synthetic global variable.
23+
/// Type of value to extract from a test for a Synthetic global variable.
2424
#[serde(rename = "type")]
2525
pub type_: crate::datadogV1::model::SyntheticsGlobalVariableParseTestOptionsType,
2626
#[serde(flatten)]

src/datadogV1/model/model_synthetics_global_variable_parse_test_options_type.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
99
pub enum SyntheticsGlobalVariableParseTestOptionsType {
1010
HTTP_BODY,
1111
HTTP_HEADER,
12+
HTTP_STATUS_CODE,
1213
LOCAL_VARIABLE,
1314
UnparsedObject(crate::datadog::UnparsedObject),
1415
}
@@ -18,6 +19,7 @@ impl ToString for SyntheticsGlobalVariableParseTestOptionsType {
1819
match self {
1920
Self::HTTP_BODY => String::from("http_body"),
2021
Self::HTTP_HEADER => String::from("http_header"),
22+
Self::HTTP_STATUS_CODE => String::from("http_status_code"),
2123
Self::LOCAL_VARIABLE => String::from("local_variable"),
2224
Self::UnparsedObject(v) => v.value.to_string(),
2325
}
@@ -45,6 +47,7 @@ impl<'de> Deserialize<'de> for SyntheticsGlobalVariableParseTestOptionsType {
4547
Ok(match s.as_str() {
4648
"http_body" => Self::HTTP_BODY,
4749
"http_header" => Self::HTTP_HEADER,
50+
"http_status_code" => Self::HTTP_STATUS_CODE,
4851
"local_variable" => Self::LOCAL_VARIABLE,
4952
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
5053
value: serde_json::Value::String(s.into()),
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
use serde::{Deserialize, Deserializer, Serialize, Serializer};
6+
7+
#[non_exhaustive]
8+
#[derive(Clone, Debug, Eq, PartialEq)]
9+
pub enum SyntheticsLocalVariableParsingOptionsType {
10+
GRPC_MESSAGE,
11+
GRPC_METADATA,
12+
HTTP_BODY,
13+
HTTP_HEADER,
14+
HTTP_STATUS_CODE,
15+
UnparsedObject(crate::datadog::UnparsedObject),
16+
}
17+
18+
impl ToString for SyntheticsLocalVariableParsingOptionsType {
19+
fn to_string(&self) -> String {
20+
match self {
21+
Self::GRPC_MESSAGE => String::from("grpc_message"),
22+
Self::GRPC_METADATA => String::from("grpc_metadata"),
23+
Self::HTTP_BODY => String::from("http_body"),
24+
Self::HTTP_HEADER => String::from("http_header"),
25+
Self::HTTP_STATUS_CODE => String::from("http_status_code"),
26+
Self::UnparsedObject(v) => v.value.to_string(),
27+
}
28+
}
29+
}
30+
31+
impl Serialize for SyntheticsLocalVariableParsingOptionsType {
32+
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
33+
where
34+
S: Serializer,
35+
{
36+
match self {
37+
Self::UnparsedObject(v) => v.serialize(serializer),
38+
_ => serializer.serialize_str(self.to_string().as_str()),
39+
}
40+
}
41+
}
42+
43+
impl<'de> Deserialize<'de> for SyntheticsLocalVariableParsingOptionsType {
44+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
45+
where
46+
D: Deserializer<'de>,
47+
{
48+
let s: String = String::deserialize(deserializer)?;
49+
Ok(match s.as_str() {
50+
"grpc_message" => Self::GRPC_MESSAGE,
51+
"grpc_metadata" => Self::GRPC_METADATA,
52+
"http_body" => Self::HTTP_BODY,
53+
"http_header" => Self::HTTP_HEADER,
54+
"http_status_code" => Self::HTTP_STATUS_CODE,
55+
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
56+
value: serde_json::Value::String(s.into()),
57+
}),
58+
})
59+
}
60+
}

src/datadogV1/model/model_synthetics_parsing_options.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::fmt::{self, Formatter};
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct SyntheticsParsingOptions {
14-
/// When type is `http_header`, name of the header to use to extract the value.
14+
/// When type is `http_header` or `grpc_metadata`, name of the header or metadatum to extract.
1515
#[serde(rename = "field")]
1616
pub field: Option<String>,
1717
/// Name of the variable to extract.
@@ -23,9 +23,9 @@ pub struct SyntheticsParsingOptions {
2323
/// Determines whether or not the extracted value will be obfuscated.
2424
#[serde(rename = "secure")]
2525
pub secure: Option<bool>,
26-
/// Property of the Synthetic Test Response to use for a Synthetic global variable.
26+
/// Property of the Synthetic Test Response to extract into a local variable.
2727
#[serde(rename = "type")]
28-
pub type_: Option<crate::datadogV1::model::SyntheticsGlobalVariableParseTestOptionsType>,
28+
pub type_: Option<crate::datadogV1::model::SyntheticsLocalVariableParsingOptionsType>,
2929
#[serde(flatten)]
3030
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
3131
#[serde(skip)]
@@ -68,7 +68,7 @@ impl SyntheticsParsingOptions {
6868

6969
pub fn type_(
7070
mut self,
71-
value: crate::datadogV1::model::SyntheticsGlobalVariableParseTestOptionsType,
71+
value: crate::datadogV1::model::SyntheticsLocalVariableParsingOptionsType,
7272
) -> Self {
7373
self.type_ = Some(value);
7474
self
@@ -111,7 +111,7 @@ impl<'de> Deserialize<'de> for SyntheticsParsingOptions {
111111
let mut parser: Option<crate::datadogV1::model::SyntheticsVariableParser> = None;
112112
let mut secure: Option<bool> = None;
113113
let mut type_: Option<
114-
crate::datadogV1::model::SyntheticsGlobalVariableParseTestOptionsType,
114+
crate::datadogV1::model::SyntheticsLocalVariableParsingOptionsType,
115115
> = None;
116116
let mut additional_properties: std::collections::BTreeMap<
117117
String,
@@ -152,7 +152,7 @@ impl<'de> Deserialize<'de> for SyntheticsParsingOptions {
152152
type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
153153
if let Some(ref _type_) = type_ {
154154
match _type_ {
155-
crate::datadogV1::model::SyntheticsGlobalVariableParseTestOptionsType::UnparsedObject(_type_) => {
155+
crate::datadogV1::model::SyntheticsLocalVariableParsingOptionsType::UnparsedObject(_type_) => {
156156
_unparsed = true;
157157
},
158158
_ => {}

0 commit comments

Comments
 (0)