-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TOTP parameters to Synthetics test options (#1815)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
- Loading branch information
1 parent
e22ba06
commit ca779ce
Showing
10 changed files
with
336 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
api/datadogV1/model_synthetics_global_variable_options.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2019-Present Datadog, Inc. | ||
|
||
package datadogV1 | ||
|
||
import ( | ||
"encoding/json" | ||
) | ||
|
||
// SyntheticsGlobalVariableOptions Options for the Global Variable for MFA. | ||
type SyntheticsGlobalVariableOptions struct { | ||
// Parameters for the TOTP/MFA variable | ||
TotpParameters *SyntheticsGlobalVariableTOTPParameters `json:"totp_parameters,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{} | ||
} | ||
|
||
// NewSyntheticsGlobalVariableOptions instantiates a new SyntheticsGlobalVariableOptions object. | ||
// 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 NewSyntheticsGlobalVariableOptions() *SyntheticsGlobalVariableOptions { | ||
this := SyntheticsGlobalVariableOptions{} | ||
return &this | ||
} | ||
|
||
// NewSyntheticsGlobalVariableOptionsWithDefaults instantiates a new SyntheticsGlobalVariableOptions object. | ||
// This constructor will only assign default values to properties that have it defined, | ||
// but it doesn't guarantee that properties required by API are set. | ||
func NewSyntheticsGlobalVariableOptionsWithDefaults() *SyntheticsGlobalVariableOptions { | ||
this := SyntheticsGlobalVariableOptions{} | ||
return &this | ||
} | ||
|
||
// GetTotpParameters returns the TotpParameters field value if set, zero value otherwise. | ||
func (o *SyntheticsGlobalVariableOptions) GetTotpParameters() SyntheticsGlobalVariableTOTPParameters { | ||
if o == nil || o.TotpParameters == nil { | ||
var ret SyntheticsGlobalVariableTOTPParameters | ||
return ret | ||
} | ||
return *o.TotpParameters | ||
} | ||
|
||
// GetTotpParametersOk returns a tuple with the TotpParameters field value if set, nil otherwise | ||
// and a boolean to check if the value has been set. | ||
func (o *SyntheticsGlobalVariableOptions) GetTotpParametersOk() (*SyntheticsGlobalVariableTOTPParameters, bool) { | ||
if o == nil || o.TotpParameters == nil { | ||
return nil, false | ||
} | ||
return o.TotpParameters, true | ||
} | ||
|
||
// HasTotpParameters returns a boolean if a field has been set. | ||
func (o *SyntheticsGlobalVariableOptions) HasTotpParameters() bool { | ||
return o != nil && o.TotpParameters != nil | ||
} | ||
|
||
// SetTotpParameters gets a reference to the given SyntheticsGlobalVariableTOTPParameters and assigns it to the TotpParameters field. | ||
func (o *SyntheticsGlobalVariableOptions) SetTotpParameters(v SyntheticsGlobalVariableTOTPParameters) { | ||
o.TotpParameters = &v | ||
} | ||
|
||
// MarshalJSON serializes the struct using spec logic. | ||
func (o SyntheticsGlobalVariableOptions) MarshalJSON() ([]byte, error) { | ||
toSerialize := map[string]interface{}{} | ||
if o.UnparsedObject != nil { | ||
return json.Marshal(o.UnparsedObject) | ||
} | ||
if o.TotpParameters != nil { | ||
toSerialize["totp_parameters"] = o.TotpParameters | ||
} | ||
|
||
for key, value := range o.AdditionalProperties { | ||
toSerialize[key] = value | ||
} | ||
return json.Marshal(toSerialize) | ||
} | ||
|
||
// UnmarshalJSON deserializes the given payload. | ||
func (o *SyntheticsGlobalVariableOptions) UnmarshalJSON(bytes []byte) (err error) { | ||
raw := map[string]interface{}{} | ||
all := struct { | ||
TotpParameters *SyntheticsGlobalVariableTOTPParameters `json:"totp_parameters,omitempty"` | ||
}{} | ||
err = json.Unmarshal(bytes, &all) | ||
if err != nil { | ||
err = json.Unmarshal(bytes, &raw) | ||
if err != nil { | ||
return err | ||
} | ||
o.UnparsedObject = raw | ||
return nil | ||
} | ||
if all.TotpParameters != nil && all.TotpParameters.UnparsedObject != nil && o.UnparsedObject == nil { | ||
err = json.Unmarshal(bytes, &raw) | ||
if err != nil { | ||
return err | ||
} | ||
o.UnparsedObject = raw | ||
} | ||
o.TotpParameters = all.TotpParameters | ||
return nil | ||
} |
133 changes: 133 additions & 0 deletions
133
api/datadogV1/model_synthetics_global_variable_totp_parameters.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2019-Present Datadog, Inc. | ||
|
||
package datadogV1 | ||
|
||
import ( | ||
"encoding/json" | ||
) | ||
|
||
// SyntheticsGlobalVariableTOTPParameters Parameters for the TOTP/MFA variable | ||
type SyntheticsGlobalVariableTOTPParameters struct { | ||
// Number of digits for the OTP code. | ||
Digits *int32 `json:"digits,omitempty"` | ||
// Interval for which to refresh the token (in seconds). | ||
RefreshInterval *int32 `json:"refresh_interval,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{} | ||
} | ||
|
||
// NewSyntheticsGlobalVariableTOTPParameters instantiates a new SyntheticsGlobalVariableTOTPParameters object. | ||
// 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 NewSyntheticsGlobalVariableTOTPParameters() *SyntheticsGlobalVariableTOTPParameters { | ||
this := SyntheticsGlobalVariableTOTPParameters{} | ||
return &this | ||
} | ||
|
||
// NewSyntheticsGlobalVariableTOTPParametersWithDefaults instantiates a new SyntheticsGlobalVariableTOTPParameters object. | ||
// This constructor will only assign default values to properties that have it defined, | ||
// but it doesn't guarantee that properties required by API are set. | ||
func NewSyntheticsGlobalVariableTOTPParametersWithDefaults() *SyntheticsGlobalVariableTOTPParameters { | ||
this := SyntheticsGlobalVariableTOTPParameters{} | ||
return &this | ||
} | ||
|
||
// GetDigits returns the Digits field value if set, zero value otherwise. | ||
func (o *SyntheticsGlobalVariableTOTPParameters) GetDigits() int32 { | ||
if o == nil || o.Digits == nil { | ||
var ret int32 | ||
return ret | ||
} | ||
return *o.Digits | ||
} | ||
|
||
// GetDigitsOk returns a tuple with the Digits field value if set, nil otherwise | ||
// and a boolean to check if the value has been set. | ||
func (o *SyntheticsGlobalVariableTOTPParameters) GetDigitsOk() (*int32, bool) { | ||
if o == nil || o.Digits == nil { | ||
return nil, false | ||
} | ||
return o.Digits, true | ||
} | ||
|
||
// HasDigits returns a boolean if a field has been set. | ||
func (o *SyntheticsGlobalVariableTOTPParameters) HasDigits() bool { | ||
return o != nil && o.Digits != nil | ||
} | ||
|
||
// SetDigits gets a reference to the given int32 and assigns it to the Digits field. | ||
func (o *SyntheticsGlobalVariableTOTPParameters) SetDigits(v int32) { | ||
o.Digits = &v | ||
} | ||
|
||
// GetRefreshInterval returns the RefreshInterval field value if set, zero value otherwise. | ||
func (o *SyntheticsGlobalVariableTOTPParameters) GetRefreshInterval() int32 { | ||
if o == nil || o.RefreshInterval == nil { | ||
var ret int32 | ||
return ret | ||
} | ||
return *o.RefreshInterval | ||
} | ||
|
||
// GetRefreshIntervalOk returns a tuple with the RefreshInterval field value if set, nil otherwise | ||
// and a boolean to check if the value has been set. | ||
func (o *SyntheticsGlobalVariableTOTPParameters) GetRefreshIntervalOk() (*int32, bool) { | ||
if o == nil || o.RefreshInterval == nil { | ||
return nil, false | ||
} | ||
return o.RefreshInterval, true | ||
} | ||
|
||
// HasRefreshInterval returns a boolean if a field has been set. | ||
func (o *SyntheticsGlobalVariableTOTPParameters) HasRefreshInterval() bool { | ||
return o != nil && o.RefreshInterval != nil | ||
} | ||
|
||
// SetRefreshInterval gets a reference to the given int32 and assigns it to the RefreshInterval field. | ||
func (o *SyntheticsGlobalVariableTOTPParameters) SetRefreshInterval(v int32) { | ||
o.RefreshInterval = &v | ||
} | ||
|
||
// MarshalJSON serializes the struct using spec logic. | ||
func (o SyntheticsGlobalVariableTOTPParameters) MarshalJSON() ([]byte, error) { | ||
toSerialize := map[string]interface{}{} | ||
if o.UnparsedObject != nil { | ||
return json.Marshal(o.UnparsedObject) | ||
} | ||
if o.Digits != nil { | ||
toSerialize["digits"] = o.Digits | ||
} | ||
if o.RefreshInterval != nil { | ||
toSerialize["refresh_interval"] = o.RefreshInterval | ||
} | ||
|
||
for key, value := range o.AdditionalProperties { | ||
toSerialize[key] = value | ||
} | ||
return json.Marshal(toSerialize) | ||
} | ||
|
||
// UnmarshalJSON deserializes the given payload. | ||
func (o *SyntheticsGlobalVariableTOTPParameters) UnmarshalJSON(bytes []byte) (err error) { | ||
raw := map[string]interface{}{} | ||
all := struct { | ||
Digits *int32 `json:"digits,omitempty"` | ||
RefreshInterval *int32 `json:"refresh_interval,omitempty"` | ||
}{} | ||
err = json.Unmarshal(bytes, &all) | ||
if err != nil { | ||
err = json.Unmarshal(bytes, &raw) | ||
if err != nil { | ||
return err | ||
} | ||
o.UnparsedObject = raw | ||
return nil | ||
} | ||
o.Digits = all.Digits | ||
o.RefreshInterval = all.RefreshInterval | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.