Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-06-20 19:51:49.000722",
"spec_repo_commit": "51272749"
"regenerated": "2025-06-23 07:59:29.359544",
"spec_repo_commit": "74866a53"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-06-20 19:51:49.016467",
"spec_repo_commit": "51272749"
"regenerated": "2025-06-23 07:59:29.376654",
"spec_repo_commit": "74866a53"
}
}
}
3 changes: 0 additions & 3 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14785,9 +14785,6 @@ components:
description: Username to use for the basic authentication.
example: my_username
type: string
required:
- password
- username
type: object
SyntheticsBasicAuthWebType:
default: web
Expand Down
2 changes: 1 addition & 1 deletion api/datadogV1/model_synthetics_basic_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (obj *SyntheticsBasicAuth) UnmarshalJSON(data []byte) error {
if err == nil {
if obj.SyntheticsBasicAuthWeb != nil && obj.SyntheticsBasicAuthWeb.UnparsedObject == nil {
jsonSyntheticsBasicAuthWeb, _ := datadog.Marshal(obj.SyntheticsBasicAuthWeb)
if string(jsonSyntheticsBasicAuthWeb) == "{}" { // empty struct
if string(jsonSyntheticsBasicAuthWeb) == "{}" && string(data) != "{}" { // empty struct
obj.SyntheticsBasicAuthWeb = nil
} else {
match++
Expand Down
74 changes: 39 additions & 35 deletions api/datadogV1/model_synthetics_basic_auth_web.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@
package datadogV1

import (
"fmt"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// SyntheticsBasicAuthWeb Object to handle basic authentication when performing the test.
type SyntheticsBasicAuthWeb struct {
// Password to use for the basic authentication.
Password string `json:"password"`
Password *string `json:"password,omitempty"`
// The type of basic authentication to use when performing the test.
Type *SyntheticsBasicAuthWebType `json:"type,omitempty"`
// Username to use for the basic authentication.
Username string `json:"username"`
Username *string `json:"username,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{} `json:"-"`
Expand All @@ -27,12 +25,10 @@ type SyntheticsBasicAuthWeb struct {
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewSyntheticsBasicAuthWeb(password string, username string) *SyntheticsBasicAuthWeb {
func NewSyntheticsBasicAuthWeb() *SyntheticsBasicAuthWeb {
this := SyntheticsBasicAuthWeb{}
this.Password = password
var typeVar SyntheticsBasicAuthWebType = SYNTHETICSBASICAUTHWEBTYPE_WEB
this.Type = &typeVar
this.Username = username
return &this
}

Expand All @@ -46,27 +42,32 @@ func NewSyntheticsBasicAuthWebWithDefaults() *SyntheticsBasicAuthWeb {
return &this
}

// GetPassword returns the Password field value.
// GetPassword returns the Password field value if set, zero value otherwise.
func (o *SyntheticsBasicAuthWeb) GetPassword() string {
if o == nil {
if o == nil || o.Password == nil {
var ret string
return ret
}
return o.Password
return *o.Password
}

// GetPasswordOk returns a tuple with the Password field value
// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsBasicAuthWeb) GetPasswordOk() (*string, bool) {
if o == nil {
if o == nil || o.Password == nil {
return nil, false
}
return &o.Password, true
return o.Password, true
}

// HasPassword returns a boolean if a field has been set.
func (o *SyntheticsBasicAuthWeb) HasPassword() bool {
return o != nil && o.Password != nil
}

// SetPassword sets field value.
// SetPassword gets a reference to the given string and assigns it to the Password field.
func (o *SyntheticsBasicAuthWeb) SetPassword(v string) {
o.Password = v
o.Password = &v
}

// GetType returns the Type field value if set, zero value otherwise.
Expand Down Expand Up @@ -97,27 +98,32 @@ func (o *SyntheticsBasicAuthWeb) SetType(v SyntheticsBasicAuthWebType) {
o.Type = &v
}

// GetUsername returns the Username field value.
// GetUsername returns the Username field value if set, zero value otherwise.
func (o *SyntheticsBasicAuthWeb) GetUsername() string {
if o == nil {
if o == nil || o.Username == nil {
var ret string
return ret
}
return o.Username
return *o.Username
}

// GetUsernameOk returns a tuple with the Username field value
// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyntheticsBasicAuthWeb) GetUsernameOk() (*string, bool) {
if o == nil {
if o == nil || o.Username == nil {
return nil, false
}
return &o.Username, true
return o.Username, true
}

// HasUsername returns a boolean if a field has been set.
func (o *SyntheticsBasicAuthWeb) HasUsername() bool {
return o != nil && o.Username != nil
}

// SetUsername sets field value.
// SetUsername gets a reference to the given string and assigns it to the Username field.
func (o *SyntheticsBasicAuthWeb) SetUsername(v string) {
o.Username = v
o.Username = &v
}

// MarshalJSON serializes the struct using spec logic.
Expand All @@ -126,11 +132,15 @@ func (o SyntheticsBasicAuthWeb) MarshalJSON() ([]byte, error) {
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
toSerialize["password"] = o.Password
if o.Password != nil {
toSerialize["password"] = o.Password
}
if o.Type != nil {
toSerialize["type"] = o.Type
}
toSerialize["username"] = o.Username
if o.Username != nil {
toSerialize["username"] = o.Username
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
Expand All @@ -141,19 +151,13 @@ func (o SyntheticsBasicAuthWeb) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *SyntheticsBasicAuthWeb) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Password *string `json:"password"`
Password *string `json:"password,omitempty"`
Type *SyntheticsBasicAuthWebType `json:"type,omitempty"`
Username *string `json:"username"`
Username *string `json:"username,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if all.Password == nil {
return fmt.Errorf("required field password missing")
}
if all.Username == nil {
return fmt.Errorf("required field username missing")
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"password", "type", "username"})
Expand All @@ -162,13 +166,13 @@ func (o *SyntheticsBasicAuthWeb) UnmarshalJSON(bytes []byte) (err error) {
}

hasInvalidField := false
o.Password = *all.Password
o.Password = all.Password
if all.Type != nil && !all.Type.IsValid() {
hasInvalidField = true
} else {
o.Type = all.Type
}
o.Username = *all.Username
o.Username = all.Username

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ func main() {
BasicAuth: &datadogV1.SyntheticsBasicAuth{
SyntheticsBasicAuthWeb: &datadogV1.SyntheticsBasicAuthWeb{
Type: datadogV1.SYNTHETICSBASICAUTHWEBTYPE_WEB.Ptr(),
Username: "user",
Password: "password",
Username: datadog.PtrString("user"),
Password: datadog.PtrString("password"),
}},
},
}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func main() {
Method: datadog.PtrString("GET"),
BasicAuth: &datadogV1.SyntheticsBasicAuth{
SyntheticsBasicAuthWeb: &datadogV1.SyntheticsBasicAuthWeb{
Password: "password",
Username: "username",
Password: datadog.PtrString("password"),
Username: datadog.PtrString("username"),
}},
},
Subtype: datadogV1.SYNTHETICSAPITESTSTEPSUBTYPE_HTTP,
Expand All @@ -56,8 +56,8 @@ func main() {
Method: datadog.PtrString("GET"),
BasicAuth: &datadogV1.SyntheticsBasicAuth{
SyntheticsBasicAuthWeb: &datadogV1.SyntheticsBasicAuthWeb{
Password: "password",
Username: "username",
Password: datadog.PtrString("password"),
Username: datadog.PtrString("username"),
Type: datadogV1.SYNTHETICSBASICAUTHWEBTYPE_WEB.Ptr(),
}},
},
Expand Down
4 changes: 2 additions & 2 deletions examples/v1/synthetics/TriggerCITests.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ func main() {
{
BasicAuth: &datadogV1.SyntheticsBasicAuth{
SyntheticsBasicAuthWeb: &datadogV1.SyntheticsBasicAuthWeb{
Password: "PaSSw0RD!",
Password: datadog.PtrString("PaSSw0RD!"),
Type: datadogV1.SYNTHETICSBASICAUTHWEBTYPE_WEB.Ptr(),
Username: "my_username",
Username: datadog.PtrString("my_username"),
}},
DeviceIds: []string{
"chrome.laptop_large",
Expand Down
4 changes: 2 additions & 2 deletions examples/v1/synthetics/UpdateBrowserTest.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ func main() {
Request: datadogV1.SyntheticsTestRequest{
BasicAuth: &datadogV1.SyntheticsBasicAuth{
SyntheticsBasicAuthWeb: &datadogV1.SyntheticsBasicAuthWeb{
Password: "PaSSw0RD!",
Password: datadog.PtrString("PaSSw0RD!"),
Type: datadogV1.SYNTHETICSBASICAUTHWEBTYPE_WEB.Ptr(),
Username: "my_username",
Username: datadog.PtrString("my_username"),
}},
BodyType: datadogV1.SYNTHETICSTESTREQUESTBODYTYPE_TEXT_PLAIN.Ptr(),
CallType: datadogV1.SYNTHETICSTESTCALLTYPE_UNARY.Ptr(),
Expand Down