Skip to content

Commit

Permalink
Regenerate client from commit 1d2b67d9 of spec repo (#1598)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <[email protected]>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Aug 31, 2022
1 parent dafcd7b commit fea1ba3
Show file tree
Hide file tree
Showing 36 changed files with 369 additions and 120 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-08-30 12:29:21.086256",
"spec_repo_commit": "47f45603"
"regenerated": "2022-08-30 13:34:27.172031",
"spec_repo_commit": "1d2b67d9"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2022-08-30 12:29:21.101447",
"spec_repo_commit": "47f45603"
"regenerated": "2022-08-30 13:34:27.184412",
"spec_repo_commit": "1d2b67d9"
}
}
}
8 changes: 7 additions & 1 deletion .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11898,25 +11898,31 @@ components:
the value.
example: content-type
type: string
localVariableName:
description: When type is `local_variable`, name of the local variable to
use to extract the value.
example: LOCAL_VARIABLE
type: string
parser:
$ref: '#/components/schemas/SyntheticsVariableParser'
type:
$ref: '#/components/schemas/SyntheticsGlobalVariableParseTestOptionsType'
required:
- type
- parser
type: object
SyntheticsGlobalVariableParseTestOptionsType:
description: Property of the Synthetics Test Response to use for a Synthetics
global variable.
enum:
- http_body
- http_header
- local_variable
example: http_body
type: string
x-enum-varnames:
- HTTP_BODY
- HTTP_HEADER
- LOCAL_VARIABLE
SyntheticsGlobalVariableParserType:
description: Type of parser for a Synthetics global variable from a synthetics
test.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import (
type SyntheticsGlobalVariableParseTestOptions struct {
// When type is `http_header`, name of the header to use to extract the value.
Field *string `json:"field,omitempty"`
// When type is `local_variable`, name of the local variable to use to extract the value.
LocalVariableName *string `json:"localVariableName,omitempty"`
// Details of the parser to use for the global variable.
Parser SyntheticsVariableParser `json:"parser"`
Parser *SyntheticsVariableParser `json:"parser,omitempty"`
// Property of the Synthetics Test Response to use for a Synthetics global variable.
Type SyntheticsGlobalVariableParseTestOptionsType `json:"type"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
Expand All @@ -26,9 +28,8 @@ type SyntheticsGlobalVariableParseTestOptions 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 NewSyntheticsGlobalVariableParseTestOptions(parser SyntheticsVariableParser, typeVar SyntheticsGlobalVariableParseTestOptionsType) *SyntheticsGlobalVariableParseTestOptions {
func NewSyntheticsGlobalVariableParseTestOptions(typeVar SyntheticsGlobalVariableParseTestOptionsType) *SyntheticsGlobalVariableParseTestOptions {
this := SyntheticsGlobalVariableParseTestOptions{}
this.Parser = parser
this.Type = typeVar
return &this
}
Expand Down Expand Up @@ -73,27 +74,68 @@ func (o *SyntheticsGlobalVariableParseTestOptions) SetField(v string) {
o.Field = &v
}

// GetParser returns the Parser field value.
// GetLocalVariableName returns the LocalVariableName field value if set, zero value otherwise.
func (o *SyntheticsGlobalVariableParseTestOptions) GetLocalVariableName() string {
if o == nil || o.LocalVariableName == nil {
var ret string
return ret
}
return *o.LocalVariableName
}

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

// HasLocalVariableName returns a boolean if a field has been set.
func (o *SyntheticsGlobalVariableParseTestOptions) HasLocalVariableName() bool {
if o != nil && o.LocalVariableName != nil {
return true
}

return false
}

// SetLocalVariableName gets a reference to the given string and assigns it to the LocalVariableName field.
func (o *SyntheticsGlobalVariableParseTestOptions) SetLocalVariableName(v string) {
o.LocalVariableName = &v
}

// GetParser returns the Parser field value if set, zero value otherwise.
func (o *SyntheticsGlobalVariableParseTestOptions) GetParser() SyntheticsVariableParser {
if o == nil {
if o == nil || o.Parser == nil {
var ret SyntheticsVariableParser
return ret
}
return o.Parser
return *o.Parser
}

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

// HasParser returns a boolean if a field has been set.
func (o *SyntheticsGlobalVariableParseTestOptions) HasParser() bool {
if o != nil && o.Parser != nil {
return true
}

return false
}

// SetParser sets field value.
// SetParser gets a reference to the given SyntheticsVariableParser and assigns it to the Parser field.
func (o *SyntheticsGlobalVariableParseTestOptions) SetParser(v SyntheticsVariableParser) {
o.Parser = v
o.Parser = &v
}

// GetType returns the Type field value.
Expand Down Expand Up @@ -128,7 +170,12 @@ func (o SyntheticsGlobalVariableParseTestOptions) MarshalJSON() ([]byte, error)
if o.Field != nil {
toSerialize["field"] = o.Field
}
toSerialize["parser"] = o.Parser
if o.LocalVariableName != nil {
toSerialize["localVariableName"] = o.LocalVariableName
}
if o.Parser != nil {
toSerialize["parser"] = o.Parser
}
toSerialize["type"] = o.Type

for key, value := range o.AdditionalProperties {
Expand All @@ -141,21 +188,18 @@ func (o SyntheticsGlobalVariableParseTestOptions) MarshalJSON() ([]byte, error)
func (o *SyntheticsGlobalVariableParseTestOptions) UnmarshalJSON(bytes []byte) (err error) {
raw := map[string]interface{}{}
required := struct {
Parser *SyntheticsVariableParser `json:"parser"`
Type *SyntheticsGlobalVariableParseTestOptionsType `json:"type"`
Type *SyntheticsGlobalVariableParseTestOptionsType `json:"type"`
}{}
all := struct {
Field *string `json:"field,omitempty"`
Parser SyntheticsVariableParser `json:"parser"`
Type SyntheticsGlobalVariableParseTestOptionsType `json:"type"`
Field *string `json:"field,omitempty"`
LocalVariableName *string `json:"localVariableName,omitempty"`
Parser *SyntheticsVariableParser `json:"parser,omitempty"`
Type SyntheticsGlobalVariableParseTestOptionsType `json:"type"`
}{}
err = json.Unmarshal(bytes, &required)
if err != nil {
return err
}
if required.Parser == nil {
return fmt.Errorf("Required field parser missing")
}
if required.Type == nil {
return fmt.Errorf("Required field type missing")
}
Expand All @@ -177,7 +221,8 @@ func (o *SyntheticsGlobalVariableParseTestOptions) UnmarshalJSON(bytes []byte) (
return nil
}
o.Field = all.Field
if all.Parser.UnparsedObject != nil && o.UnparsedObject == nil {
o.LocalVariableName = all.LocalVariableName
if all.Parser != nil && all.Parser.UnparsedObject != nil && o.UnparsedObject == nil {
err = json.Unmarshal(bytes, &raw)
if err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ type SyntheticsGlobalVariableParseTestOptionsType string

// List of SyntheticsGlobalVariableParseTestOptionsType.
const (
SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_BODY SyntheticsGlobalVariableParseTestOptionsType = "http_body"
SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_HEADER SyntheticsGlobalVariableParseTestOptionsType = "http_header"
SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_BODY SyntheticsGlobalVariableParseTestOptionsType = "http_body"
SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_HEADER SyntheticsGlobalVariableParseTestOptionsType = "http_header"
SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_LOCAL_VARIABLE SyntheticsGlobalVariableParseTestOptionsType = "local_variable"
)

var allowedSyntheticsGlobalVariableParseTestOptionsTypeEnumValues = []SyntheticsGlobalVariableParseTestOptionsType{
SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_BODY,
SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_HEADER,
SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_LOCAL_VARIABLE,
}

// GetAllowedValues reeturns the list of possible values.
Expand Down
5 changes: 3 additions & 2 deletions examples/v1/synthetics/CreateGlobalVariable.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ func main() {
Description: "Example description",
Name: "MY_VARIABLE",
ParseTestOptions: &datadogV1.SyntheticsGlobalVariableParseTestOptions{
Field: datadog.PtrString("content-type"),
Parser: datadogV1.SyntheticsVariableParser{
Field: datadog.PtrString("content-type"),
LocalVariableName: datadog.PtrString("LOCAL_VARIABLE"),
Parser: &datadogV1.SyntheticsVariableParser{
Type: datadogV1.SYNTHETICSGLOBALVARIABLEPARSERTYPE_REGEX,
Value: datadog.PtrString(".*"),
},
Expand Down
46 changes: 46 additions & 0 deletions examples/v1/synthetics/CreateGlobalVariable_1068962881.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Create a global variable from test returns "OK" response

package main

import (
"context"
"encoding/json"
"fmt"
"os"

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

func main() {
// there is a valid "synthetics_api_test_multi_step" in the system
SyntheticsAPITestMultiStepPublicID := os.Getenv("SYNTHETICS_API_TEST_MULTI_STEP_PUBLIC_ID")

body := datadogV1.SyntheticsGlobalVariable{
Description: "",
Name: "GLOBAL_VARIABLE_PAYLOAD",
Tags: []string{},
Value: datadogV1.SyntheticsGlobalVariableValue{
Secure: datadog.PtrBool(false),
Value: datadog.PtrString(""),
},
ParseTestPublicId: datadog.PtrString(SyntheticsAPITestMultiStepPublicID),
ParseTestOptions: &datadogV1.SyntheticsGlobalVariableParseTestOptions{
Type: datadogV1.SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_LOCAL_VARIABLE,
LocalVariableName: datadog.PtrString("EXTRACTED_VALUE"),
},
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewSyntheticsApi(apiClient)
resp, r, err := api.CreateGlobalVariable(ctx, body)

if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.CreateGlobalVariable`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}

responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.CreateGlobalVariable`:\n%s\n", responseContent)
}
10 changes: 10 additions & 0 deletions examples/v1/synthetics/CreateSyntheticsAPITest_1279271422.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ func main() {
Target: 200,
}},
},
ExtractedValues: []datadogV1.SyntheticsParsingOptions{
{
Field: datadog.PtrString("server"),
Name: datadog.PtrString("EXTRACTED_VALUE"),
Parser: &datadogV1.SyntheticsVariableParser{
Type: datadogV1.SYNTHETICSGLOBALVARIABLEPARSERTYPE_RAW,
},
Type: datadogV1.SYNTHETICSGLOBALVARIABLEPARSETESTOPTIONSTYPE_HTTP_HEADER.Ptr(),
},
},
IsCritical: datadog.PtrBool(true),
Name: "request is sent",
Request: datadogV1.SyntheticsTestRequest{
Expand Down
5 changes: 3 additions & 2 deletions examples/v1/synthetics/EditGlobalVariable.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ func main() {
Description: "Example description",
Name: "MY_VARIABLE",
ParseTestOptions: &datadogV1.SyntheticsGlobalVariableParseTestOptions{
Field: datadog.PtrString("content-type"),
Parser: datadogV1.SyntheticsVariableParser{
Field: datadog.PtrString("content-type"),
LocalVariableName: datadog.PtrString("LOCAL_VARIABLE"),
Parser: &datadogV1.SyntheticsVariableParser{
Type: datadogV1.SYNTHETICSGLOBALVARIABLEPARSERTYPE_REGEX,
Value: datadog.PtrString(".*"),
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2022-08-18T09:19:30.220Z
2022-08-30T12:58:36.103Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: |
{"config":{"assertions":[],"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"request":{"certificateDomains":["https://datadoghq.com"],"method":"GET","url":"https://datadoghq.com"},"setCookie":"name:test"},"locations":["aws:us-east-2"],"message":"Test message","name":"Test-Create_a_browser_test_returns_OK_Returns_saved_rumSettings_response-1660814370","options":{"accept_self_signed":false,"allow_insecure":true,"ci":{"executionRule":"skipped"},"device_ids":["tablet"],"disableCors":true,"disableCsp":true,"follow_redirects":true,"ignoreServerCertificateError":true,"initialNavigationTimeout":200,"min_failure_duration":10,"min_location_failed":1,"noScreenshot":true,"retry":{"count":3,"interval":10},"rumSettings":{"applicationId":"mockApplicationId","clientTokenId":12345,"isEnabled":true},"tick_every":300},"steps":[{"allowFailure":false,"isCritical":true,"name":"Refresh page","params":{},"type":"refresh"}],"tags":["testing:browser"],"type":"browser"}
{"config":{"assertions":[],"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"request":{"certificateDomains":["https://datadoghq.com"],"method":"GET","url":"https://datadoghq.com"},"setCookie":"name:test"},"locations":["aws:us-east-2"],"message":"Test message","name":"Test-Create_a_browser_test_returns_OK_Returns_saved_rumSettings_response-1661864316","options":{"accept_self_signed":false,"allow_insecure":true,"ci":{"executionRule":"skipped"},"device_ids":["tablet"],"disableCors":true,"disableCsp":true,"follow_redirects":true,"ignoreServerCertificateError":true,"initialNavigationTimeout":200,"min_failure_duration":10,"min_location_failed":1,"noScreenshot":true,"retry":{"count":3,"interval":10},"rumSettings":{"applicationId":"mockApplicationId","clientTokenId":12345,"isEnabled":true},"tick_every":300},"steps":[{"allowFailure":false,"isCritical":true,"name":"Refresh page","params":{},"type":"refresh"}],"tags":["testing:browser"],"type":"browser"}
form: {}
headers:
Accept:
Expand All @@ -11,8 +11,8 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v1/synthetics/tests/browser
response:
body: '{"status":"paused","public_id":"3ry-tnf-fqu","tags":["testing:browser"],"org_id":321813,"locations":["aws:us-east-2"],"message":"Test
message","deleted_at":null,"name":"Test-Create_a_browser_test_returns_OK_Returns_saved_rumSettings_response-1660814370","monitor_id":80432986,"type":"browser","created_at":"2022-08-18T09:19:30.959520+00:00","modified_at":"2022-08-18T09:19:30.959520+00:00","steps":[{"name":"Refresh
body: '{"status":"paused","public_id":"jsu-a6z-5fw","tags":["testing:browser"],"org_id":321813,"locations":["aws:us-east-2"],"message":"Test
message","deleted_at":null,"name":"Test-Create_a_browser_test_returns_OK_Returns_saved_rumSettings_response-1661864316","monitor_id":81568552,"type":"browser","created_at":"2022-08-30T12:58:36.698302+00:00","modified_at":"2022-08-30T12:58:36.698302+00:00","steps":[{"name":"Refresh
page","allowFailure":false,"params":{},"isCritical":true,"type":"refresh"}],"config":{"setCookie":"name:test","request":{"url":"https://datadoghq.com","certificateDomains":["https://datadoghq.com"],"method":"GET"},"assertions":[],"configVariables":[{"pattern":"content-type","type":"text","example":"content-type","name":"PROPERTY"}]},"options":{"disableCsp":true,"accept_self_signed":false,"retry":{"count":3,"interval":10},"min_location_failed":1,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"ci":{"executionRule":"skipped"},"noScreenshot":true,"rumSettings":{"isEnabled":true,"applicationId":"mockApplicationId","clientTokenId":12345},"initialNavigationTimeout":200,"disableCors":true,"device_ids":["tablet"],"tick_every":300,"ignoreServerCertificateError":true}}'
code: 200
duration: ''
Expand All @@ -22,7 +22,7 @@ interactions:
status: 200 OK
- request:
body: |
{"public_ids":["3ry-tnf-fqu"]}
{"public_ids":["jsu-a6z-5fw"]}
form: {}
headers:
Accept:
Expand All @@ -32,7 +32,7 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v1/synthetics/tests/delete
response:
body: '{"deleted_tests":[{"deleted_at":"2022-08-18T09:19:36.462930+00:00","public_id":"3ry-tnf-fqu"}]}'
body: '{"deleted_tests":[{"deleted_at":"2022-08-30T12:58:42.293815+00:00","public_id":"jsu-a6z-5fw"}]}'
code: 200
duration: ''
headers:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2022-08-18T09:19:36.544Z
2022-08-30T12:58:42.391Z
Loading

0 comments on commit fea1ba3

Please sign in to comment.