Skip to content

Commit b7344d4

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Fix basic auth requirements (#731)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent a845eb1 commit b7344d4

7 files changed

+50
-25
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": "2025-06-20 19:51:47.574925",
8-
"spec_repo_commit": "51272749"
7+
"regenerated": "2025-06-23 07:59:26.601798",
8+
"spec_repo_commit": "74866a53"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-06-20 19:51:47.591597",
13-
"spec_repo_commit": "51272749"
12+
"regenerated": "2025-06-23 07:59:26.619809",
13+
"spec_repo_commit": "74866a53"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14785,9 +14785,6 @@ components:
1478514785
description: Username to use for the basic authentication.
1478614786
example: my_username
1478714787
type: string
14788-
required:
14789-
- password
14790-
- username
1479114788
type: object
1479214789
SyntheticsBasicAuthWebType:
1479314790
default: web

examples/v1_synthetics_CreateSyntheticsAPITest_1279271422.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,10 @@ async fn main() {
277277
.basic_auth(
278278
SyntheticsBasicAuth::SyntheticsBasicAuthWeb(
279279
Box::new(
280-
SyntheticsBasicAuthWeb::new(
281-
"password".to_string(),
282-
"user".to_string(),
283-
).type_(SyntheticsBasicAuthWebType::WEB),
280+
SyntheticsBasicAuthWeb::new()
281+
.password("password".to_string())
282+
.type_(SyntheticsBasicAuthWebType::WEB)
283+
.username("user".to_string()),
284284
),
285285
),
286286
)

examples/v1_synthetics_CreateSyntheticsAPITest_1717840259.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ async fn main() {
4848
"request is sent".to_string(),
4949
SyntheticsTestRequest::new()
5050
.basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
51-
SyntheticsBasicAuthWeb::new("password".to_string(), "username".to_string()),
51+
SyntheticsBasicAuthWeb::new()
52+
.password("password".to_string())
53+
.username("username".to_string()),
5254
)))
5355
.method("GET".to_string())
5456
.url("https://httpbin.org/status/200".to_string()),
@@ -67,8 +69,10 @@ async fn main() {
6769
"request is sent".to_string(),
6870
SyntheticsTestRequest::new()
6971
.basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
70-
SyntheticsBasicAuthWeb::new("password".to_string(), "username".to_string())
71-
.type_(SyntheticsBasicAuthWebType::WEB),
72+
SyntheticsBasicAuthWeb::new()
73+
.password("password".to_string())
74+
.type_(SyntheticsBasicAuthWebType::WEB)
75+
.username("username".to_string()),
7276
)))
7377
.method("GET".to_string())
7478
.url("https://httpbin.org/status/200".to_string()),

examples/v1_synthetics_TriggerCITests.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ async fn main() {
1818
let body =
1919
SyntheticsCITestBody::new().tests(vec![SyntheticsCITest::new("aaa-aaa-aaa".to_string())
2020
.basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
21-
SyntheticsBasicAuthWeb::new("PaSSw0RD!".to_string(), "my_username".to_string())
22-
.type_(SyntheticsBasicAuthWebType::WEB),
21+
SyntheticsBasicAuthWeb::new()
22+
.password("PaSSw0RD!".to_string())
23+
.type_(SyntheticsBasicAuthWebType::WEB)
24+
.username("my_username".to_string()),
2325
)))
2426
.device_ids(vec!["chrome.laptop_large".to_string()])
2527
.locations(vec!["aws:eu-west-3".to_string()])

examples/v1_synthetics_UpdateBrowserTest.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ async fn main() {
3939
vec![],
4040
SyntheticsTestRequest::new()
4141
.basic_auth(SyntheticsBasicAuth::SyntheticsBasicAuthWeb(Box::new(
42-
SyntheticsBasicAuthWeb::new("PaSSw0RD!".to_string(), "my_username".to_string())
43-
.type_(SyntheticsBasicAuthWebType::WEB),
42+
SyntheticsBasicAuthWeb::new()
43+
.password("PaSSw0RD!".to_string())
44+
.type_(SyntheticsBasicAuthWebType::WEB)
45+
.username("my_username".to_string()),
4446
)))
4547
.body_type(SyntheticsTestRequestBodyType::TEXT_PLAIN)
4648
.call_type(SyntheticsTestCallType::UNARY)

src/datadogV1/model/model_synthetics_basic_auth_web.rs

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ use std::fmt::{self, Formatter};
1313
pub struct SyntheticsBasicAuthWeb {
1414
/// Password to use for the basic authentication.
1515
#[serde(rename = "password")]
16-
pub password: String,
16+
pub password: Option<String>,
1717
/// The type of basic authentication to use when performing the test.
1818
#[serde(rename = "type")]
1919
pub type_: Option<crate::datadogV1::model::SyntheticsBasicAuthWebType>,
2020
/// Username to use for the basic authentication.
2121
#[serde(rename = "username")]
22-
pub username: String,
22+
pub username: Option<String>,
2323
#[serde(flatten)]
2424
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
2525
#[serde(skip)]
@@ -28,21 +28,31 @@ pub struct SyntheticsBasicAuthWeb {
2828
}
2929

3030
impl SyntheticsBasicAuthWeb {
31-
pub fn new(password: String, username: String) -> SyntheticsBasicAuthWeb {
31+
pub fn new() -> SyntheticsBasicAuthWeb {
3232
SyntheticsBasicAuthWeb {
33-
password,
33+
password: None,
3434
type_: None,
35-
username,
35+
username: None,
3636
additional_properties: std::collections::BTreeMap::new(),
3737
_unparsed: false,
3838
}
3939
}
4040

41+
pub fn password(mut self, value: String) -> Self {
42+
self.password = Some(value);
43+
self
44+
}
45+
4146
pub fn type_(mut self, value: crate::datadogV1::model::SyntheticsBasicAuthWebType) -> Self {
4247
self.type_ = Some(value);
4348
self
4449
}
4550

51+
pub fn username(mut self, value: String) -> Self {
52+
self.username = Some(value);
53+
self
54+
}
55+
4656
pub fn additional_properties(
4757
mut self,
4858
value: std::collections::BTreeMap<String, serde_json::Value>,
@@ -52,6 +62,12 @@ impl SyntheticsBasicAuthWeb {
5262
}
5363
}
5464

65+
impl Default for SyntheticsBasicAuthWeb {
66+
fn default() -> Self {
67+
Self::new()
68+
}
69+
}
70+
5571
impl<'de> Deserialize<'de> for SyntheticsBasicAuthWeb {
5672
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
5773
where
@@ -81,6 +97,9 @@ impl<'de> Deserialize<'de> for SyntheticsBasicAuthWeb {
8197
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
8298
match k.as_str() {
8399
"password" => {
100+
if v.is_null() {
101+
continue;
102+
}
84103
password = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
85104
}
86105
"type" => {
@@ -98,6 +117,9 @@ impl<'de> Deserialize<'de> for SyntheticsBasicAuthWeb {
98117
}
99118
}
100119
"username" => {
120+
if v.is_null() {
121+
continue;
122+
}
101123
username = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
102124
}
103125
&_ => {
@@ -107,8 +129,6 @@ impl<'de> Deserialize<'de> for SyntheticsBasicAuthWeb {
107129
}
108130
}
109131
}
110-
let password = password.ok_or_else(|| M::Error::missing_field("password"))?;
111-
let username = username.ok_or_else(|| M::Error::missing_field("username"))?;
112132

113133
let content = SyntheticsBasicAuthWeb {
114134
password,

0 commit comments

Comments
 (0)