Skip to content

Commit 18c8aec

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit a15b4f2e of spec repo
1 parent c04e581 commit 18c8aec

15 files changed

+631
-33
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.4",
7-
"regenerated": "2022-11-04 18:42:25.256115",
8-
"spec_repo_commit": "af3f11fc"
7+
"regenerated": "2022-11-07 13:51:14.687669",
8+
"spec_repo_commit": "a15b4f2e"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2022-11-04 18:42:25.269568",
13-
"spec_repo_commit": "af3f11fc"
12+
"regenerated": "2022-11-07 13:51:14.700652",
13+
"spec_repo_commit": "a15b4f2e"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11299,6 +11299,7 @@ components:
1129911299
oneOf:
1130011300
- $ref: '#/components/schemas/SyntheticsAssertionTarget'
1130111301
- $ref: '#/components/schemas/SyntheticsAssertionJSONPathTarget'
11302+
- $ref: '#/components/schemas/SyntheticsAssertionXPathTarget'
1130211303
type: object
1130311304
SyntheticsAssertionJSONPathOperator:
1130411305
description: Assertion operator to apply.
@@ -11428,6 +11429,42 @@ components:
1142811429
- RECEIVED_MESSAGE
1142911430
- GRPC_HEALTHCHECK_STATUS
1143011431
- CONNECTION
11432+
SyntheticsAssertionXPathOperator:
11433+
description: Assertion operator to apply.
11434+
enum:
11435+
- validatesXPath
11436+
example: validatesXPath
11437+
type: string
11438+
x-enum-varnames:
11439+
- VALIDATES_X_PATH
11440+
SyntheticsAssertionXPathTarget:
11441+
description: An assertion for the `validatesXPath` operator.
11442+
properties:
11443+
operator:
11444+
$ref: '#/components/schemas/SyntheticsAssertionXPathOperator'
11445+
property:
11446+
description: The associated assertion property.
11447+
type: string
11448+
target:
11449+
$ref: '#/components/schemas/SyntheticsAssertionXPathTargetTarget'
11450+
type:
11451+
$ref: '#/components/schemas/SyntheticsAssertionType'
11452+
required:
11453+
- type
11454+
- operator
11455+
type: object
11456+
SyntheticsAssertionXPathTargetTarget:
11457+
description: Composed target for `validatesXPath` operator.
11458+
properties:
11459+
operator:
11460+
description: The specific operator to use on the path.
11461+
type: string
11462+
targetValue:
11463+
description: The path target value to compare to.
11464+
xPath:
11465+
description: The X path to assert.
11466+
type: string
11467+
type: object
1143111468
SyntheticsBasicAuth:
1143211469
description: Object to handle basic authentication when performing the test.
1143311470
oneOf:

api/datadogV1/model_synthetics_assertion.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
type SyntheticsAssertion struct {
1414
SyntheticsAssertionTarget *SyntheticsAssertionTarget
1515
SyntheticsAssertionJSONPathTarget *SyntheticsAssertionJSONPathTarget
16+
SyntheticsAssertionXPathTarget *SyntheticsAssertionXPathTarget
1617

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

32+
// SyntheticsAssertionXPathTargetAsSyntheticsAssertion is a convenience function that returns SyntheticsAssertionXPathTarget wrapped in SyntheticsAssertion.
33+
func SyntheticsAssertionXPathTargetAsSyntheticsAssertion(v *SyntheticsAssertionXPathTarget) SyntheticsAssertion {
34+
return SyntheticsAssertion{SyntheticsAssertionXPathTarget: v}
35+
}
36+
3137
// UnmarshalJSON turns data into one of the pointers in the struct.
3238
func (obj *SyntheticsAssertion) UnmarshalJSON(data []byte) error {
3339
var err error
@@ -66,10 +72,28 @@ func (obj *SyntheticsAssertion) UnmarshalJSON(data []byte) error {
6672
obj.SyntheticsAssertionJSONPathTarget = nil
6773
}
6874

75+
// try to unmarshal data into SyntheticsAssertionXPathTarget
76+
err = json.Unmarshal(data, &obj.SyntheticsAssertionXPathTarget)
77+
if err == nil {
78+
if obj.SyntheticsAssertionXPathTarget != nil && obj.SyntheticsAssertionXPathTarget.UnparsedObject == nil {
79+
jsonSyntheticsAssertionXPathTarget, _ := json.Marshal(obj.SyntheticsAssertionXPathTarget)
80+
if string(jsonSyntheticsAssertionXPathTarget) == "{}" { // empty struct
81+
obj.SyntheticsAssertionXPathTarget = nil
82+
} else {
83+
match++
84+
}
85+
} else {
86+
obj.SyntheticsAssertionXPathTarget = nil
87+
}
88+
} else {
89+
obj.SyntheticsAssertionXPathTarget = nil
90+
}
91+
6992
if match != 1 { // more than 1 match
7093
// reset to nil
7194
obj.SyntheticsAssertionTarget = nil
7295
obj.SyntheticsAssertionJSONPathTarget = nil
96+
obj.SyntheticsAssertionXPathTarget = nil
7397
return json.Unmarshal(data, &obj.UnparsedObject)
7498
}
7599
return nil // exactly one match
@@ -85,6 +109,10 @@ func (obj SyntheticsAssertion) MarshalJSON() ([]byte, error) {
85109
return json.Marshal(&obj.SyntheticsAssertionJSONPathTarget)
86110
}
87111

112+
if obj.SyntheticsAssertionXPathTarget != nil {
113+
return json.Marshal(&obj.SyntheticsAssertionXPathTarget)
114+
}
115+
88116
if obj.UnparsedObject != nil {
89117
return json.Marshal(obj.UnparsedObject)
90118
}
@@ -101,6 +129,10 @@ func (obj *SyntheticsAssertion) GetActualInstance() interface{} {
101129
return obj.SyntheticsAssertionJSONPathTarget
102130
}
103131

132+
if obj.SyntheticsAssertionXPathTarget != nil {
133+
return obj.SyntheticsAssertionXPathTarget
134+
}
135+
104136
// all schemas are nil
105137
return nil
106138
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV1
6+
7+
import (
8+
"encoding/json"
9+
"fmt"
10+
)
11+
12+
// SyntheticsAssertionXPathOperator Assertion operator to apply.
13+
type SyntheticsAssertionXPathOperator string
14+
15+
// List of SyntheticsAssertionXPathOperator.
16+
const (
17+
SYNTHETICSASSERTIONXPATHOPERATOR_VALIDATES_X_PATH SyntheticsAssertionXPathOperator = "validatesXPath"
18+
)
19+
20+
var allowedSyntheticsAssertionXPathOperatorEnumValues = []SyntheticsAssertionXPathOperator{
21+
SYNTHETICSASSERTIONXPATHOPERATOR_VALIDATES_X_PATH,
22+
}
23+
24+
// GetAllowedValues reeturns the list of possible values.
25+
func (v *SyntheticsAssertionXPathOperator) GetAllowedValues() []SyntheticsAssertionXPathOperator {
26+
return allowedSyntheticsAssertionXPathOperatorEnumValues
27+
}
28+
29+
// UnmarshalJSON deserializes the given payload.
30+
func (v *SyntheticsAssertionXPathOperator) UnmarshalJSON(src []byte) error {
31+
var value string
32+
err := json.Unmarshal(src, &value)
33+
if err != nil {
34+
return err
35+
}
36+
*v = SyntheticsAssertionXPathOperator(value)
37+
return nil
38+
}
39+
40+
// NewSyntheticsAssertionXPathOperatorFromValue returns a pointer to a valid SyntheticsAssertionXPathOperator
41+
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
42+
func NewSyntheticsAssertionXPathOperatorFromValue(v string) (*SyntheticsAssertionXPathOperator, error) {
43+
ev := SyntheticsAssertionXPathOperator(v)
44+
if ev.IsValid() {
45+
return &ev, nil
46+
}
47+
return nil, fmt.Errorf("invalid value '%v' for SyntheticsAssertionXPathOperator: valid values are %v", v, allowedSyntheticsAssertionXPathOperatorEnumValues)
48+
}
49+
50+
// IsValid return true if the value is valid for the enum, false otherwise.
51+
func (v SyntheticsAssertionXPathOperator) IsValid() bool {
52+
for _, existing := range allowedSyntheticsAssertionXPathOperatorEnumValues {
53+
if existing == v {
54+
return true
55+
}
56+
}
57+
return false
58+
}
59+
60+
// Ptr returns reference to SyntheticsAssertionXPathOperator value.
61+
func (v SyntheticsAssertionXPathOperator) Ptr() *SyntheticsAssertionXPathOperator {
62+
return &v
63+
}
64+
65+
// NullableSyntheticsAssertionXPathOperator handles when a null is used for SyntheticsAssertionXPathOperator.
66+
type NullableSyntheticsAssertionXPathOperator struct {
67+
value *SyntheticsAssertionXPathOperator
68+
isSet bool
69+
}
70+
71+
// Get returns the associated value.
72+
func (v NullableSyntheticsAssertionXPathOperator) Get() *SyntheticsAssertionXPathOperator {
73+
return v.value
74+
}
75+
76+
// Set changes the value and indicates it's been called.
77+
func (v *NullableSyntheticsAssertionXPathOperator) Set(val *SyntheticsAssertionXPathOperator) {
78+
v.value = val
79+
v.isSet = true
80+
}
81+
82+
// IsSet returns whether Set has been called.
83+
func (v NullableSyntheticsAssertionXPathOperator) IsSet() bool {
84+
return v.isSet
85+
}
86+
87+
// Unset sets the value to nil and resets the set flag.
88+
func (v *NullableSyntheticsAssertionXPathOperator) Unset() {
89+
v.value = nil
90+
v.isSet = false
91+
}
92+
93+
// NewNullableSyntheticsAssertionXPathOperator initializes the struct as if Set has been called.
94+
func NewNullableSyntheticsAssertionXPathOperator(val *SyntheticsAssertionXPathOperator) *NullableSyntheticsAssertionXPathOperator {
95+
return &NullableSyntheticsAssertionXPathOperator{value: val, isSet: true}
96+
}
97+
98+
// MarshalJSON serializes the associated value.
99+
func (v NullableSyntheticsAssertionXPathOperator) MarshalJSON() ([]byte, error) {
100+
return json.Marshal(v.value)
101+
}
102+
103+
// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called.
104+
func (v *NullableSyntheticsAssertionXPathOperator) UnmarshalJSON(src []byte) error {
105+
v.isSet = true
106+
return json.Unmarshal(src, &v.value)
107+
}

0 commit comments

Comments
 (0)