Skip to content

Commit

Permalink
Regenerate client from commit a66250ac of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jun 10, 2024
1 parent dcbfc17 commit 5a6d937
Show file tree
Hide file tree
Showing 21 changed files with 623 additions and 55 deletions.
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": "2024-06-07 12:30:45.560911",
"spec_repo_commit": "93296fc6"
"regenerated": "2024-06-10 13:57:18.039487",
"spec_repo_commit": "a66250ac"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-06-07 12:30:45.578596",
"spec_repo_commit": "93296fc6"
"regenerated": "2024-06-10 13:57:18.065978",
"spec_repo_commit": "a66250ac"
}
}
}
36 changes: 36 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13693,9 +13693,45 @@ components:
which property they apply, and upon which target.'
oneOf:
- $ref: '#/components/schemas/SyntheticsAssertionTarget'
- $ref: '#/components/schemas/SyntheticsAssertionBodyHashTarget'
- $ref: '#/components/schemas/SyntheticsAssertionJSONPathTarget'
- $ref: '#/components/schemas/SyntheticsAssertionJSONSchemaTarget'
- $ref: '#/components/schemas/SyntheticsAssertionXPathTarget'
SyntheticsAssertionBodyHashOperator:
description: Assertion operator to apply.
enum:
- md5
- sha1
- sha256
example: md5
type: string
x-enum-varnames:
- MD5
- SHA1
- SHA256
SyntheticsAssertionBodyHashTarget:
description: An assertion which targets body hash.
properties:
operator:
$ref: '#/components/schemas/SyntheticsAssertionBodyHashOperator'
target:
description: Value used by the operator.
example: 123456
type:
$ref: '#/components/schemas/SyntheticsAssertionBodyHashType'
required:
- type
- operator
- target
type: object
SyntheticsAssertionBodyHashType:
description: Type of the assertion.
enum:
- bodyHash
example: bodyHash
type: string
x-enum-varnames:
- BODY_HASH
SyntheticsAssertionJSONPathOperator:
description: Assertion operator to apply.
enum:
Expand Down
32 changes: 32 additions & 0 deletions api/datadogV1/model_synthetics_assertion.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
// which property they apply, and upon which target.
type SyntheticsAssertion struct {
SyntheticsAssertionTarget *SyntheticsAssertionTarget
SyntheticsAssertionBodyHashTarget *SyntheticsAssertionBodyHashTarget
SyntheticsAssertionJSONPathTarget *SyntheticsAssertionJSONPathTarget
SyntheticsAssertionJSONSchemaTarget *SyntheticsAssertionJSONSchemaTarget
SyntheticsAssertionXPathTarget *SyntheticsAssertionXPathTarget
Expand All @@ -25,6 +26,11 @@ func SyntheticsAssertionTargetAsSyntheticsAssertion(v *SyntheticsAssertionTarget
return SyntheticsAssertion{SyntheticsAssertionTarget: v}
}

// SyntheticsAssertionBodyHashTargetAsSyntheticsAssertion is a convenience function that returns SyntheticsAssertionBodyHashTarget wrapped in SyntheticsAssertion.
func SyntheticsAssertionBodyHashTargetAsSyntheticsAssertion(v *SyntheticsAssertionBodyHashTarget) SyntheticsAssertion {
return SyntheticsAssertion{SyntheticsAssertionBodyHashTarget: v}
}

// SyntheticsAssertionJSONPathTargetAsSyntheticsAssertion is a convenience function that returns SyntheticsAssertionJSONPathTarget wrapped in SyntheticsAssertion.
func SyntheticsAssertionJSONPathTargetAsSyntheticsAssertion(v *SyntheticsAssertionJSONPathTarget) SyntheticsAssertion {
return SyntheticsAssertion{SyntheticsAssertionJSONPathTarget: v}
Expand Down Expand Up @@ -61,6 +67,23 @@ func (obj *SyntheticsAssertion) UnmarshalJSON(data []byte) error {
obj.SyntheticsAssertionTarget = nil
}

// try to unmarshal data into SyntheticsAssertionBodyHashTarget
err = datadog.Unmarshal(data, &obj.SyntheticsAssertionBodyHashTarget)
if err == nil {
if obj.SyntheticsAssertionBodyHashTarget != nil && obj.SyntheticsAssertionBodyHashTarget.UnparsedObject == nil {
jsonSyntheticsAssertionBodyHashTarget, _ := datadog.Marshal(obj.SyntheticsAssertionBodyHashTarget)
if string(jsonSyntheticsAssertionBodyHashTarget) == "{}" { // empty struct
obj.SyntheticsAssertionBodyHashTarget = nil
} else {
match++
}
} else {
obj.SyntheticsAssertionBodyHashTarget = nil
}
} else {
obj.SyntheticsAssertionBodyHashTarget = nil
}

// try to unmarshal data into SyntheticsAssertionJSONPathTarget
err = datadog.Unmarshal(data, &obj.SyntheticsAssertionJSONPathTarget)
if err == nil {
Expand Down Expand Up @@ -115,6 +138,7 @@ func (obj *SyntheticsAssertion) UnmarshalJSON(data []byte) error {
if match != 1 { // more than 1 match
// reset to nil
obj.SyntheticsAssertionTarget = nil
obj.SyntheticsAssertionBodyHashTarget = nil
obj.SyntheticsAssertionJSONPathTarget = nil
obj.SyntheticsAssertionJSONSchemaTarget = nil
obj.SyntheticsAssertionXPathTarget = nil
Expand All @@ -129,6 +153,10 @@ func (obj SyntheticsAssertion) MarshalJSON() ([]byte, error) {
return datadog.Marshal(&obj.SyntheticsAssertionTarget)
}

if obj.SyntheticsAssertionBodyHashTarget != nil {
return datadog.Marshal(&obj.SyntheticsAssertionBodyHashTarget)
}

if obj.SyntheticsAssertionJSONPathTarget != nil {
return datadog.Marshal(&obj.SyntheticsAssertionJSONPathTarget)
}
Expand All @@ -153,6 +181,10 @@ func (obj *SyntheticsAssertion) GetActualInstance() interface{} {
return obj.SyntheticsAssertionTarget
}

if obj.SyntheticsAssertionBodyHashTarget != nil {
return obj.SyntheticsAssertionBodyHashTarget
}

if obj.SyntheticsAssertionJSONPathTarget != nil {
return obj.SyntheticsAssertionJSONPathTarget
}
Expand Down
68 changes: 68 additions & 0 deletions api/datadogV1/model_synthetics_assertion_body_hash_operator.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// 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 (
"fmt"

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

// SyntheticsAssertionBodyHashOperator Assertion operator to apply.
type SyntheticsAssertionBodyHashOperator string

// List of SyntheticsAssertionBodyHashOperator.
const (
SYNTHETICSASSERTIONBODYHASHOPERATOR_MD5 SyntheticsAssertionBodyHashOperator = "md5"
SYNTHETICSASSERTIONBODYHASHOPERATOR_SHA1 SyntheticsAssertionBodyHashOperator = "sha1"
SYNTHETICSASSERTIONBODYHASHOPERATOR_SHA256 SyntheticsAssertionBodyHashOperator = "sha256"
)

var allowedSyntheticsAssertionBodyHashOperatorEnumValues = []SyntheticsAssertionBodyHashOperator{
SYNTHETICSASSERTIONBODYHASHOPERATOR_MD5,
SYNTHETICSASSERTIONBODYHASHOPERATOR_SHA1,
SYNTHETICSASSERTIONBODYHASHOPERATOR_SHA256,
}

// GetAllowedValues reeturns the list of possible values.
func (v *SyntheticsAssertionBodyHashOperator) GetAllowedValues() []SyntheticsAssertionBodyHashOperator {
return allowedSyntheticsAssertionBodyHashOperatorEnumValues
}

// UnmarshalJSON deserializes the given payload.
func (v *SyntheticsAssertionBodyHashOperator) UnmarshalJSON(src []byte) error {
var value string
err := datadog.Unmarshal(src, &value)
if err != nil {
return err
}
*v = SyntheticsAssertionBodyHashOperator(value)
return nil
}

// NewSyntheticsAssertionBodyHashOperatorFromValue returns a pointer to a valid SyntheticsAssertionBodyHashOperator
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
func NewSyntheticsAssertionBodyHashOperatorFromValue(v string) (*SyntheticsAssertionBodyHashOperator, error) {
ev := SyntheticsAssertionBodyHashOperator(v)
if ev.IsValid() {
return &ev, nil
}
return nil, fmt.Errorf("invalid value '%v' for SyntheticsAssertionBodyHashOperator: valid values are %v", v, allowedSyntheticsAssertionBodyHashOperatorEnumValues)
}

// IsValid return true if the value is valid for the enum, false otherwise.
func (v SyntheticsAssertionBodyHashOperator) IsValid() bool {
for _, existing := range allowedSyntheticsAssertionBodyHashOperatorEnumValues {
if existing == v {
return true
}
}
return false
}

// Ptr returns reference to SyntheticsAssertionBodyHashOperator value.
func (v SyntheticsAssertionBodyHashOperator) Ptr() *SyntheticsAssertionBodyHashOperator {
return &v
}
179 changes: 179 additions & 0 deletions api/datadogV1/model_synthetics_assertion_body_hash_target.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
// 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 (
"fmt"

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

// SyntheticsAssertionBodyHashTarget An assertion which targets body hash.
type SyntheticsAssertionBodyHashTarget struct {
// Assertion operator to apply.
Operator SyntheticsAssertionBodyHashOperator `json:"operator"`
// Value used by the operator.
Target interface{} `json:"target"`
// Type of the assertion.
Type SyntheticsAssertionBodyHashType `json:"type"`
// 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{}
}

// NewSyntheticsAssertionBodyHashTarget instantiates a new SyntheticsAssertionBodyHashTarget 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 NewSyntheticsAssertionBodyHashTarget(operator SyntheticsAssertionBodyHashOperator, target interface{}, typeVar SyntheticsAssertionBodyHashType) *SyntheticsAssertionBodyHashTarget {
this := SyntheticsAssertionBodyHashTarget{}
this.Operator = operator
this.Target = target
this.Type = typeVar
return &this
}

// NewSyntheticsAssertionBodyHashTargetWithDefaults instantiates a new SyntheticsAssertionBodyHashTarget 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 NewSyntheticsAssertionBodyHashTargetWithDefaults() *SyntheticsAssertionBodyHashTarget {
this := SyntheticsAssertionBodyHashTarget{}
return &this
}

// GetOperator returns the Operator field value.
func (o *SyntheticsAssertionBodyHashTarget) GetOperator() SyntheticsAssertionBodyHashOperator {
if o == nil {
var ret SyntheticsAssertionBodyHashOperator
return ret
}
return o.Operator
}

// GetOperatorOk returns a tuple with the Operator field value
// and a boolean to check if the value has been set.
func (o *SyntheticsAssertionBodyHashTarget) GetOperatorOk() (*SyntheticsAssertionBodyHashOperator, bool) {
if o == nil {
return nil, false
}
return &o.Operator, true
}

// SetOperator sets field value.
func (o *SyntheticsAssertionBodyHashTarget) SetOperator(v SyntheticsAssertionBodyHashOperator) {
o.Operator = v
}

// GetTarget returns the Target field value.
func (o *SyntheticsAssertionBodyHashTarget) GetTarget() interface{} {
if o == nil {
var ret interface{}
return ret
}
return o.Target
}

// GetTargetOk returns a tuple with the Target field value
// and a boolean to check if the value has been set.
func (o *SyntheticsAssertionBodyHashTarget) GetTargetOk() (*interface{}, bool) {
if o == nil {
return nil, false
}
return &o.Target, true
}

// SetTarget sets field value.
func (o *SyntheticsAssertionBodyHashTarget) SetTarget(v interface{}) {
o.Target = v
}

// GetType returns the Type field value.
func (o *SyntheticsAssertionBodyHashTarget) GetType() SyntheticsAssertionBodyHashType {
if o == nil {
var ret SyntheticsAssertionBodyHashType
return ret
}
return o.Type
}

// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *SyntheticsAssertionBodyHashTarget) GetTypeOk() (*SyntheticsAssertionBodyHashType, bool) {
if o == nil {
return nil, false
}
return &o.Type, true
}

// SetType sets field value.
func (o *SyntheticsAssertionBodyHashTarget) SetType(v SyntheticsAssertionBodyHashType) {
o.Type = v
}

// MarshalJSON serializes the struct using spec logic.
func (o SyntheticsAssertionBodyHashTarget) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
toSerialize["operator"] = o.Operator
toSerialize["target"] = o.Target
toSerialize["type"] = o.Type

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *SyntheticsAssertionBodyHashTarget) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Operator *SyntheticsAssertionBodyHashOperator `json:"operator"`
Target *interface{} `json:"target"`
Type *SyntheticsAssertionBodyHashType `json:"type"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if all.Operator == nil {
return fmt.Errorf("required field operator missing")
}
if all.Target == nil {
return fmt.Errorf("required field target missing")
}
if all.Type == nil {
return fmt.Errorf("required field type missing")
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"operator", "target", "type"})
} else {
return err
}

hasInvalidField := false
if !all.Operator.IsValid() {
hasInvalidField = true
} else {
o.Operator = *all.Operator
}
o.Target = *all.Target
if !all.Type.IsValid() {
hasInvalidField = true
} else {
o.Type = *all.Type
}

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}

return nil
}
Loading

0 comments on commit 5a6d937

Please sign in to comment.