@@ -13,13 +13,13 @@ use std::fmt::{self, Formatter};
1313pub 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
3030impl 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+
5571impl < ' 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