Skip to content

Commit

Permalink
Regenerate client from commit 7555f883 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Oct 28, 2022
1 parent bb99c1d commit 635303b
Show file tree
Hide file tree
Showing 11 changed files with 610 additions and 16 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.4",
"regenerated": "2022-10-27 17:48:11.585630",
"spec_repo_commit": "15da7251"
"regenerated": "2022-10-28 09:08:47.169124",
"spec_repo_commit": "7555f883"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2022-10-27 17:48:11.599151",
"spec_repo_commit": "15da7251"
"regenerated": "2022-10-28 09:08:47.181842",
"spec_repo_commit": "7555f883"
}
}
}
37 changes: 37 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11240,6 +11240,7 @@ components:
oneOf:
- $ref: '#/components/schemas/SyntheticsAssertionTarget'
- $ref: '#/components/schemas/SyntheticsAssertionJSONPathTarget'
- $ref: '#/components/schemas/SyntheticsAssertionXPathTarget'
type: object
SyntheticsAssertionJSONPathOperator:
description: Assertion operator to apply.
Expand Down Expand Up @@ -11369,6 +11370,42 @@ components:
- RECEIVED_MESSAGE
- GRPC_HEALTHCHECK_STATUS
- CONNECTION
SyntheticsAssertionXPathOperator:
description: Assertion operator to apply.
enum:
- validatesXPath
example: validatesXPath
type: string
x-enum-varnames:
- VALIDATES_X_PATH
SyntheticsAssertionXPathTarget:
description: An assertion for the `validatesXPath` operator.
properties:
operator:
$ref: '#/components/schemas/SyntheticsAssertionXPathOperator'
property:
description: The associated assertion property.
type: string
target:
$ref: '#/components/schemas/SyntheticsAssertionXPathTargetTarget'
type:
$ref: '#/components/schemas/SyntheticsAssertionType'
required:
- type
- operator
type: object
SyntheticsAssertionXPathTargetTarget:
description: Composed target for `validatesXPath` operator.
properties:
operator:
description: The specific operator to use on the path.
type: string
targetValue:
description: The path target value to compare to.
xPath:
description: The X path to assert.
type: string
type: object
SyntheticsBasicAuth:
description: Object to handle basic authentication when performing the test.
oneOf:
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 @@ -13,6 +13,7 @@ import (
type SyntheticsAssertion struct {
SyntheticsAssertionTarget *SyntheticsAssertionTarget
SyntheticsAssertionJSONPathTarget *SyntheticsAssertionJSONPathTarget
SyntheticsAssertionXPathTarget *SyntheticsAssertionXPathTarget

// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject interface{}
Expand All @@ -28,6 +29,11 @@ func SyntheticsAssertionJSONPathTargetAsSyntheticsAssertion(v *SyntheticsAsserti
return SyntheticsAssertion{SyntheticsAssertionJSONPathTarget: v}
}

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

// UnmarshalJSON turns data into one of the pointers in the struct.
func (obj *SyntheticsAssertion) UnmarshalJSON(data []byte) error {
var err error
Expand Down Expand Up @@ -66,10 +72,28 @@ func (obj *SyntheticsAssertion) UnmarshalJSON(data []byte) error {
obj.SyntheticsAssertionJSONPathTarget = nil
}

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

if match != 1 { // more than 1 match
// reset to nil
obj.SyntheticsAssertionTarget = nil
obj.SyntheticsAssertionJSONPathTarget = nil
obj.SyntheticsAssertionXPathTarget = nil
return json.Unmarshal(data, &obj.UnparsedObject)
}
return nil // exactly one match
Expand All @@ -85,6 +109,10 @@ func (obj SyntheticsAssertion) MarshalJSON() ([]byte, error) {
return json.Marshal(&obj.SyntheticsAssertionJSONPathTarget)
}

if obj.SyntheticsAssertionXPathTarget != nil {
return json.Marshal(&obj.SyntheticsAssertionXPathTarget)
}

if obj.UnparsedObject != nil {
return json.Marshal(obj.UnparsedObject)
}
Expand All @@ -101,6 +129,10 @@ func (obj *SyntheticsAssertion) GetActualInstance() interface{} {
return obj.SyntheticsAssertionJSONPathTarget
}

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

// all schemas are nil
return nil
}
Expand Down
107 changes: 107 additions & 0 deletions api/datadogV1/model_synthetics_assertion_x_path_operator.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// 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"
"fmt"
)

// SyntheticsAssertionXPathOperator Assertion operator to apply.
type SyntheticsAssertionXPathOperator string

// List of SyntheticsAssertionXPathOperator.
const (
SYNTHETICSASSERTIONXPATHOPERATOR_VALIDATES_X_PATH SyntheticsAssertionXPathOperator = "validatesXPath"
)

var allowedSyntheticsAssertionXPathOperatorEnumValues = []SyntheticsAssertionXPathOperator{
SYNTHETICSASSERTIONXPATHOPERATOR_VALIDATES_X_PATH,
}

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

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

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

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

// Ptr returns reference to SyntheticsAssertionXPathOperator value.
func (v SyntheticsAssertionXPathOperator) Ptr() *SyntheticsAssertionXPathOperator {
return &v
}

// NullableSyntheticsAssertionXPathOperator handles when a null is used for SyntheticsAssertionXPathOperator.
type NullableSyntheticsAssertionXPathOperator struct {
value *SyntheticsAssertionXPathOperator
isSet bool
}

// Get returns the associated value.
func (v NullableSyntheticsAssertionXPathOperator) Get() *SyntheticsAssertionXPathOperator {
return v.value
}

// Set changes the value and indicates it's been called.
func (v *NullableSyntheticsAssertionXPathOperator) Set(val *SyntheticsAssertionXPathOperator) {
v.value = val
v.isSet = true
}

// IsSet returns whether Set has been called.
func (v NullableSyntheticsAssertionXPathOperator) IsSet() bool {
return v.isSet
}

// Unset sets the value to nil and resets the set flag.
func (v *NullableSyntheticsAssertionXPathOperator) Unset() {
v.value = nil
v.isSet = false
}

// NewNullableSyntheticsAssertionXPathOperator initializes the struct as if Set has been called.
func NewNullableSyntheticsAssertionXPathOperator(val *SyntheticsAssertionXPathOperator) *NullableSyntheticsAssertionXPathOperator {
return &NullableSyntheticsAssertionXPathOperator{value: val, isSet: true}
}

// MarshalJSON serializes the associated value.
func (v NullableSyntheticsAssertionXPathOperator) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}

// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called.
func (v *NullableSyntheticsAssertionXPathOperator) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
Loading

0 comments on commit 635303b

Please sign in to comment.