55package datadogV1
66
77import (
8- "fmt"
9-
108 "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
119)
1210
1311// SyntheticsBasicAuthWeb Object to handle basic authentication when performing the test.
1412type SyntheticsBasicAuthWeb struct {
1513 // Password to use for the basic authentication.
16- Password string `json:"password"`
14+ Password * string `json:"password,omitempty "`
1715 // The type of basic authentication to use when performing the test.
1816 Type * SyntheticsBasicAuthWebType `json:"type,omitempty"`
1917 // Username to use for the basic authentication.
20- Username string `json:"username"`
18+ Username * string `json:"username,omitempty "`
2119 // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
2220 UnparsedObject map [string ]interface {} `json:"-"`
2321 AdditionalProperties map [string ]interface {} `json:"-"`
@@ -27,12 +25,10 @@ type SyntheticsBasicAuthWeb struct {
2725// This constructor will assign default values to properties that have it defined,
2826// and makes sure properties required by API are set, but the set of arguments
2927// will change when the set of required properties is changed.
30- func NewSyntheticsBasicAuthWeb (password string , username string ) * SyntheticsBasicAuthWeb {
28+ func NewSyntheticsBasicAuthWeb () * SyntheticsBasicAuthWeb {
3129 this := SyntheticsBasicAuthWeb {}
32- this .Password = password
3330 var typeVar SyntheticsBasicAuthWebType = SYNTHETICSBASICAUTHWEBTYPE_WEB
3431 this .Type = & typeVar
35- this .Username = username
3632 return & this
3733}
3834
@@ -46,27 +42,32 @@ func NewSyntheticsBasicAuthWebWithDefaults() *SyntheticsBasicAuthWeb {
4642 return & this
4743}
4844
49- // GetPassword returns the Password field value.
45+ // GetPassword returns the Password field value if set, zero value otherwise .
5046func (o * SyntheticsBasicAuthWeb ) GetPassword () string {
51- if o == nil {
47+ if o == nil || o . Password == nil {
5248 var ret string
5349 return ret
5450 }
55- return o .Password
51+ return * o .Password
5652}
5753
58- // GetPasswordOk returns a tuple with the Password field value
54+ // GetPasswordOk returns a tuple with the Password field value if set, nil otherwise
5955// and a boolean to check if the value has been set.
6056func (o * SyntheticsBasicAuthWeb ) GetPasswordOk () (* string , bool ) {
61- if o == nil {
57+ if o == nil || o . Password == nil {
6258 return nil , false
6359 }
64- return & o .Password , true
60+ return o .Password , true
61+ }
62+
63+ // HasPassword returns a boolean if a field has been set.
64+ func (o * SyntheticsBasicAuthWeb ) HasPassword () bool {
65+ return o != nil && o .Password != nil
6566}
6667
67- // SetPassword sets field value .
68+ // SetPassword gets a reference to the given string and assigns it to the Password field .
6869func (o * SyntheticsBasicAuthWeb ) SetPassword (v string ) {
69- o .Password = v
70+ o .Password = & v
7071}
7172
7273// GetType returns the Type field value if set, zero value otherwise.
@@ -97,27 +98,32 @@ func (o *SyntheticsBasicAuthWeb) SetType(v SyntheticsBasicAuthWebType) {
9798 o .Type = & v
9899}
99100
100- // GetUsername returns the Username field value.
101+ // GetUsername returns the Username field value if set, zero value otherwise .
101102func (o * SyntheticsBasicAuthWeb ) GetUsername () string {
102- if o == nil {
103+ if o == nil || o . Username == nil {
103104 var ret string
104105 return ret
105106 }
106- return o .Username
107+ return * o .Username
107108}
108109
109- // GetUsernameOk returns a tuple with the Username field value
110+ // GetUsernameOk returns a tuple with the Username field value if set, nil otherwise
110111// and a boolean to check if the value has been set.
111112func (o * SyntheticsBasicAuthWeb ) GetUsernameOk () (* string , bool ) {
112- if o == nil {
113+ if o == nil || o . Username == nil {
113114 return nil , false
114115 }
115- return & o .Username , true
116+ return o .Username , true
117+ }
118+
119+ // HasUsername returns a boolean if a field has been set.
120+ func (o * SyntheticsBasicAuthWeb ) HasUsername () bool {
121+ return o != nil && o .Username != nil
116122}
117123
118- // SetUsername sets field value .
124+ // SetUsername gets a reference to the given string and assigns it to the Username field .
119125func (o * SyntheticsBasicAuthWeb ) SetUsername (v string ) {
120- o .Username = v
126+ o .Username = & v
121127}
122128
123129// MarshalJSON serializes the struct using spec logic.
@@ -126,11 +132,15 @@ func (o SyntheticsBasicAuthWeb) MarshalJSON() ([]byte, error) {
126132 if o .UnparsedObject != nil {
127133 return datadog .Marshal (o .UnparsedObject )
128134 }
129- toSerialize ["password" ] = o .Password
135+ if o .Password != nil {
136+ toSerialize ["password" ] = o .Password
137+ }
130138 if o .Type != nil {
131139 toSerialize ["type" ] = o .Type
132140 }
133- toSerialize ["username" ] = o .Username
141+ if o .Username != nil {
142+ toSerialize ["username" ] = o .Username
143+ }
134144
135145 for key , value := range o .AdditionalProperties {
136146 toSerialize [key ] = value
@@ -141,19 +151,13 @@ func (o SyntheticsBasicAuthWeb) MarshalJSON() ([]byte, error) {
141151// UnmarshalJSON deserializes the given payload.
142152func (o * SyntheticsBasicAuthWeb ) UnmarshalJSON (bytes []byte ) (err error ) {
143153 all := struct {
144- Password * string `json:"password"`
154+ Password * string `json:"password,omitempty "`
145155 Type * SyntheticsBasicAuthWebType `json:"type,omitempty"`
146- Username * string `json:"username"`
156+ Username * string `json:"username,omitempty "`
147157 }{}
148158 if err = datadog .Unmarshal (bytes , & all ); err != nil {
149159 return datadog .Unmarshal (bytes , & o .UnparsedObject )
150160 }
151- if all .Password == nil {
152- return fmt .Errorf ("required field password missing" )
153- }
154- if all .Username == nil {
155- return fmt .Errorf ("required field username missing" )
156- }
157161 additionalProperties := make (map [string ]interface {})
158162 if err = datadog .Unmarshal (bytes , & additionalProperties ); err == nil {
159163 datadog .DeleteKeys (additionalProperties , & []string {"password" , "type" , "username" })
@@ -162,13 +166,13 @@ func (o *SyntheticsBasicAuthWeb) UnmarshalJSON(bytes []byte) (err error) {
162166 }
163167
164168 hasInvalidField := false
165- o .Password = * all .Password
169+ o .Password = all .Password
166170 if all .Type != nil && ! all .Type .IsValid () {
167171 hasInvalidField = true
168172 } else {
169173 o .Type = all .Type
170174 }
171- o .Username = * all .Username
175+ o .Username = all .Username
172176
173177 if len (additionalProperties ) > 0 {
174178 o .AdditionalProperties = additionalProperties
0 commit comments