diff --git a/.apigentools-info b/.apigentools-info index 81b0a393ed7..a12207f1b8a 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.5.1.dev2", - "regenerated": "2021-11-11 09:29:58.022073", - "spec_repo_commit": "904c411" + "regenerated": "2021-11-11 11:44:21.239708", + "spec_repo_commit": "6ddcc8e" }, "v2": { "apigentools_version": "1.5.1.dev2", - "regenerated": "2021-11-11 09:29:58.043886", - "spec_repo_commit": "904c411" + "regenerated": "2021-11-11 11:44:21.260549", + "spec_repo_commit": "6ddcc8e" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index c32d69998b7..389ccd9df31 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -9251,7 +9251,8 @@ components: properties: assertions: default: [] - description: Array of assertions used for the test. + description: Array of assertions used for the test. Required for single + API tests. example: - operator: lessThan target: 1000 @@ -9458,12 +9459,14 @@ components: type: string target: description: Value used by the operator. + example: 123456 nullable: false type: $ref: '#/components/schemas/SyntheticsAssertionType' required: - type - operator + - target type: object SyntheticsAssertionType: description: Type of the assertion. @@ -9859,7 +9862,7 @@ components: description: Git information. properties: branch: - description: The branch name. + description: Branch name. type: string commitSha: description: The commit SHA. @@ -10590,7 +10593,6 @@ components: type: string value: description: Value for the step. - type: object vitalsMetrics: description: Array of Core Web Vitals metrics for the step. items: diff --git a/api/v1/datadog/api/openapi.yaml b/api/v1/datadog/api/openapi.yaml index d03965b7182..aa0470c4f6d 100644 --- a/api/v1/datadog/api/openapi.yaml +++ b/api/v1/datadog/api/openapi.yaml @@ -21944,7 +21944,8 @@ components: properties: assertions: default: [] - description: Array of assertions used for the test. + description: Array of assertions used for the test. Required for single + API tests. example: - operator: lessThan target: 1000 @@ -22298,11 +22299,13 @@ components: type: string target: description: Value used by the operator. + example: 123456 nullable: false type: $ref: '#/components/schemas/SyntheticsAssertionType' required: - operator + - target - type type: object SyntheticsAssertionType: @@ -22788,7 +22791,7 @@ components: subTestStepDetails: - null - null - value: '{}' + value: "" - screenshotBucketKey: true snapshotBucketKey: true warnings: @@ -22823,7 +22826,7 @@ components: subTestStepDetails: - null - null - value: '{}' + value: "" browserType: browserType properties: browserType: @@ -22919,7 +22922,7 @@ components: subTestStepDetails: - null - null - value: '{}' + value: "" - screenshotBucketKey: true snapshotBucketKey: true warnings: @@ -22954,7 +22957,7 @@ components: subTestStepDetails: - null - null - value: '{}' + value: "" browserType: browserType check_version: 6 probe_dc: probe_dc @@ -23165,7 +23168,7 @@ components: branch: branch properties: branch: - description: The branch name. + description: Branch name. type: string commitSha: description: The commit SHA. @@ -24315,7 +24318,7 @@ components: subTestStepDetails: - null - null - value: '{}' + value: "" properties: browserErrors: description: Array of errors collected for a browser test. @@ -24367,7 +24370,6 @@ components: type: string value: description: Value for the step. - type: object vitalsMetrics: description: Array of Core Web Vitals metrics for the step. items: diff --git a/api/v1/datadog/docs/SyntheticsAPITestConfig.md b/api/v1/datadog/docs/SyntheticsAPITestConfig.md index 23c7fb847d8..de21fa3a00c 100644 --- a/api/v1/datadog/docs/SyntheticsAPITestConfig.md +++ b/api/v1/datadog/docs/SyntheticsAPITestConfig.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ---- | ---- | ----------- | ------ -**Assertions** | Pointer to [**[]SyntheticsAssertion**](SyntheticsAssertion.md) | Array of assertions used for the test. | [optional] [default to []] +**Assertions** | Pointer to [**[]SyntheticsAssertion**](SyntheticsAssertion.md) | Array of assertions used for the test. Required for single API tests. | [optional] [default to []] **ConfigVariables** | Pointer to [**[]SyntheticsConfigVariable**](SyntheticsConfigVariable.md) | Array of variables used for the test. | [optional] **Request** | Pointer to [**SyntheticsTestRequest**](SyntheticsTestRequest.md) | | [optional] **Steps** | Pointer to [**[]SyntheticsAPIStep**](SyntheticsAPIStep.md) | When the test subtype is `multi`, the steps of the test. | [optional] diff --git a/api/v1/datadog/docs/SyntheticsAssertionTarget.md b/api/v1/datadog/docs/SyntheticsAssertionTarget.md index eabb4311740..d24812e9cfd 100644 --- a/api/v1/datadog/docs/SyntheticsAssertionTarget.md +++ b/api/v1/datadog/docs/SyntheticsAssertionTarget.md @@ -6,14 +6,14 @@ Name | Type | Description | Notes ---- | ---- | ----------- | ------ **Operator** | [**SyntheticsAssertionOperator**](SyntheticsAssertionOperator.md) | | **Property** | Pointer to **string** | The associated assertion property. | [optional] -**Target** | Pointer to **interface{}** | Value used by the operator. | [optional] +**Target** | **interface{}** | Value used by the operator. | **Type** | [**SyntheticsAssertionType**](SyntheticsAssertionType.md) | | ## Methods ### NewSyntheticsAssertionTarget -`func NewSyntheticsAssertionTarget(operator SyntheticsAssertionOperator, type_ SyntheticsAssertionType) *SyntheticsAssertionTarget` +`func NewSyntheticsAssertionTarget(operator SyntheticsAssertionOperator, target interface{}, type_ SyntheticsAssertionType) *SyntheticsAssertionTarget` NewSyntheticsAssertionTarget instantiates a new SyntheticsAssertionTarget object. This constructor will assign default values to properties that have it defined, @@ -92,11 +92,6 @@ and a boolean to check if the value has been set. SetTarget sets Target field to given value. -### HasTarget - -`func (o *SyntheticsAssertionTarget) HasTarget() bool` - -HasTarget returns a boolean if a field has been set. ### GetType diff --git a/api/v1/datadog/docs/SyntheticsCIBatchMetadataGit.md b/api/v1/datadog/docs/SyntheticsCIBatchMetadataGit.md index 6c8f562e510..f5e5b623ac1 100644 --- a/api/v1/datadog/docs/SyntheticsCIBatchMetadataGit.md +++ b/api/v1/datadog/docs/SyntheticsCIBatchMetadataGit.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ---- | ---- | ----------- | ------ -**Branch** | Pointer to **string** | The branch name. | [optional] +**Branch** | Pointer to **string** | Branch name. | [optional] **CommitSha** | Pointer to **string** | The commit SHA. | [optional] ## Methods diff --git a/api/v1/datadog/docs/SyntheticsStepDetail.md b/api/v1/datadog/docs/SyntheticsStepDetail.md index b3d5ab5e139..0c43350ebf7 100644 --- a/api/v1/datadog/docs/SyntheticsStepDetail.md +++ b/api/v1/datadog/docs/SyntheticsStepDetail.md @@ -416,6 +416,16 @@ SetValue sets Value field to given value. HasValue returns a boolean if a field has been set. +### SetValueNil + +`func (o *SyntheticsStepDetail) SetValueNil(b bool)` + + SetValueNil sets the value for Value to be an explicit nil + +### UnsetValue +`func (o *SyntheticsStepDetail) UnsetValue()` + +UnsetValue ensures that no value is present for Value, not even an explicit nil ### GetVitalsMetrics `func (o *SyntheticsStepDetail) GetVitalsMetrics() []SyntheticsCoreWebVitals` diff --git a/api/v1/datadog/model_synthetics_api_test_config.go b/api/v1/datadog/model_synthetics_api_test_config.go index da5347a1ead..5ea95d7a521 100644 --- a/api/v1/datadog/model_synthetics_api_test_config.go +++ b/api/v1/datadog/model_synthetics_api_test_config.go @@ -14,7 +14,7 @@ import ( // SyntheticsAPITestConfig Configuration object for a Synthetic API test. type SyntheticsAPITestConfig struct { - // Array of assertions used for the test. + // Array of assertions used for the test. Required for single API tests. Assertions *[]SyntheticsAssertion `json:"assertions,omitempty"` // Array of variables used for the test. ConfigVariables *[]SyntheticsConfigVariable `json:"configVariables,omitempty"` diff --git a/api/v1/datadog/model_synthetics_assertion_target.go b/api/v1/datadog/model_synthetics_assertion_target.go index 25beecf718d..7506624fd7e 100644 --- a/api/v1/datadog/model_synthetics_assertion_target.go +++ b/api/v1/datadog/model_synthetics_assertion_target.go @@ -19,7 +19,7 @@ type SyntheticsAssertionTarget struct { // The associated assertion property. Property *string `json:"property,omitempty"` // Value used by the operator. - Target interface{} `json:"target,omitempty"` + Target interface{} `json:"target"` Type SyntheticsAssertionType `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:-` @@ -29,9 +29,10 @@ type SyntheticsAssertionTarget 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 NewSyntheticsAssertionTarget(operator SyntheticsAssertionOperator, type_ SyntheticsAssertionType) *SyntheticsAssertionTarget { +func NewSyntheticsAssertionTarget(operator SyntheticsAssertionOperator, target interface{}, type_ SyntheticsAssertionType) *SyntheticsAssertionTarget { this := SyntheticsAssertionTarget{} this.Operator = operator + this.Target = target this.Type = type_ return &this } @@ -100,36 +101,28 @@ func (o *SyntheticsAssertionTarget) SetProperty(v string) { o.Property = &v } -// GetTarget returns the Target field value if set, zero value otherwise. +// GetTarget returns the Target field value func (o *SyntheticsAssertionTarget) GetTarget() interface{} { - if o == nil || o.Target == nil { + if o == nil { var ret interface{} return ret } + return o.Target } -// GetTargetOk returns a tuple with the Target field value if set, nil otherwise +// GetTargetOk returns a tuple with the Target field value // and a boolean to check if the value has been set. -func (o *SyntheticsAssertionTarget) GetTargetOk() (interface{}, bool) { - if o == nil || o.Target == nil { +func (o *SyntheticsAssertionTarget) GetTargetOk() (*interface{}, bool) { + if o == nil { return nil, false } - return o.Target, true + return &o.Target, true } -// HasTarget returns a boolean if a field has been set. -func (o *SyntheticsAssertionTarget) HasTarget() bool { - if o != nil && o.Target != nil { - return true - } - - return false -} - -// SetTarget gets a reference to the given interface{} and assigns it to the Target field. +// SetTarget sets field value func (o *SyntheticsAssertionTarget) SetTarget(v interface{}) { - o.Target = &v + o.Target = v } // GetType returns the Type field value @@ -167,7 +160,7 @@ func (o SyntheticsAssertionTarget) MarshalJSON() ([]byte, error) { if o.Property != nil { toSerialize["property"] = o.Property } - if o.Target != nil { + if true { toSerialize["target"] = o.Target } if true { @@ -180,12 +173,13 @@ func (o *SyntheticsAssertionTarget) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} required := struct { Operator *SyntheticsAssertionOperator `json:"operator"` + Target *interface{} `json:"target"` Type *SyntheticsAssertionType `json:"type"` }{} all := struct { Operator SyntheticsAssertionOperator `json:"operator"` Property *string `json:"property,omitempty"` - Target interface{} `json:"target,omitempty"` + Target interface{} `json:"target"` Type SyntheticsAssertionType `json:"type"` }{} err = json.Unmarshal(bytes, &required) @@ -195,6 +189,9 @@ func (o *SyntheticsAssertionTarget) UnmarshalJSON(bytes []byte) (err error) { if required.Operator == nil { return fmt.Errorf("Required field operator missing") } + if required.Target == nil { + return fmt.Errorf("Required field target missing") + } if required.Type == nil { return fmt.Errorf("Required field type missing") } diff --git a/api/v1/datadog/model_synthetics_ci_batch_metadata_git.go b/api/v1/datadog/model_synthetics_ci_batch_metadata_git.go index dc3e8153f00..151b5168066 100644 --- a/api/v1/datadog/model_synthetics_ci_batch_metadata_git.go +++ b/api/v1/datadog/model_synthetics_ci_batch_metadata_git.go @@ -14,7 +14,7 @@ import ( // SyntheticsCIBatchMetadataGit Git information. type SyntheticsCIBatchMetadataGit struct { - // The branch name. + // Branch name. Branch *string `json:"branch,omitempty"` // The commit SHA. CommitSha *string `json:"commitSha,omitempty"` diff --git a/api/v1/datadog/model_synthetics_step_detail.go b/api/v1/datadog/model_synthetics_step_detail.go index 441645f3a0e..ca30f216f0d 100644 --- a/api/v1/datadog/model_synthetics_step_detail.go +++ b/api/v1/datadog/model_synthetics_step_detail.go @@ -40,7 +40,7 @@ type SyntheticsStepDetail struct { // URL to perform the step against. Url *string `json:"url,omitempty"` // Value for the step. - Value *interface{} `json:"value,omitempty"` + Value interface{} `json:"value,omitempty"` // Array of Core Web Vitals metrics for the step. VitalsMetrics *[]SyntheticsCoreWebVitals `json:"vitalsMetrics,omitempty"` // Warning collected that didn't failed the step. @@ -514,22 +514,23 @@ func (o *SyntheticsStepDetail) SetUrl(v string) { o.Url = &v } -// GetValue returns the Value field value if set, zero value otherwise. +// GetValue returns the Value field value if set, zero value otherwise (both if not set or set to explicit null). func (o *SyntheticsStepDetail) GetValue() interface{} { - if o == nil || o.Value == nil { + if o == nil { var ret interface{} return ret } - return *o.Value + return o.Value } // GetValueOk returns a tuple with the Value field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *SyntheticsStepDetail) GetValueOk() (*interface{}, bool) { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SyntheticsStepDetail) GetValueOk() (interface{}, bool) { if o == nil || o.Value == nil { return nil, false } - return o.Value, true + return &o.Value, true } // HasValue returns a boolean if a field has been set. @@ -543,7 +544,7 @@ func (o *SyntheticsStepDetail) HasValue() bool { // SetValue gets a reference to the given interface{} and assigns it to the Value field. func (o *SyntheticsStepDetail) SetValue(v interface{}) { - o.Value = &v + o.Value = v } // GetVitalsMetrics returns the VitalsMetrics field value if set, zero value otherwise. @@ -686,7 +687,7 @@ func (o *SyntheticsStepDetail) UnmarshalJSON(bytes []byte) (err error) { TimeToInteractive *float64 `json:"timeToInteractive,omitempty"` Type *SyntheticsStepType `json:"type,omitempty"` Url *string `json:"url,omitempty"` - Value *interface{} `json:"value,omitempty"` + Value interface{} `json:"value,omitempty"` VitalsMetrics *[]SyntheticsCoreWebVitals `json:"vitalsMetrics,omitempty"` Warnings *[]SyntheticsStepDetailWarning `json:"warnings,omitempty"` }{} diff --git a/tests/api/v1/datadog/api_synthetics_test.go b/tests/api/v1/datadog/api_synthetics_test.go index 23ab4b7dce7..5b0bec4416c 100644 --- a/tests/api/v1/datadog/api_synthetics_test.go +++ b/tests/api/v1/datadog/api_synthetics_test.go @@ -27,12 +27,12 @@ var target2000 interface{} = 2000 var targetValue0 interface{} = "0" func getTestSyntheticsAPI(ctx context.Context, t *testing.T) datadog.SyntheticsAPITest { - assertionTextHTML := datadog.NewSyntheticsAssertionTarget(datadog.SYNTHETICSASSERTIONOPERATOR_IS, datadog.SYNTHETICSASSERTIONTYPE_HEADER) + assertionTextHTML := datadog.NewSyntheticsAssertionTarget(datadog.SYNTHETICSASSERTIONOPERATOR_IS, targetTextHTML, datadog.SYNTHETICSASSERTIONTYPE_HEADER) assertionTextHTML.Property = datadog.PtrString("{{ PROPERTY }}") - assertionTextHTML.Target = &targetTextHTML + // assertionTextHTML.Target = &targetTextHTML - assertion2000 := datadog.NewSyntheticsAssertionTarget(datadog.SYNTHETICSASSERTIONOPERATOR_LESS_THAN, datadog.SYNTHETICSASSERTIONTYPE_RESPONSE_TIME) - assertion2000.Target = &target2000 + assertion2000 := datadog.NewSyntheticsAssertionTarget(datadog.SYNTHETICSASSERTIONOPERATOR_LESS_THAN, target2000, datadog.SYNTHETICSASSERTIONTYPE_RESPONSE_TIME) + // assertion2000.Target = &target2000 targetJSONPath := datadog.NewSyntheticsAssertionJSONPathTarget(datadog.SYNTHETICSASSERTIONJSONPATHOPERATOR_VALIDATES_JSON_PATH, datadog.SYNTHETICSASSERTIONTYPE_BODY) targetJSONPath.SetTarget( @@ -166,8 +166,8 @@ func getTestSyntheticsAPIMultistep(ctx context.Context, t *testing.T, globalVari } func getTestSyntheticsSubtypeTCPAPI(ctx context.Context, t *testing.T) datadog.SyntheticsAPITest { - assertion2000 := datadog.NewSyntheticsAssertionTarget(datadog.SYNTHETICSASSERTIONOPERATOR_LESS_THAN, datadog.SYNTHETICSASSERTIONTYPE_RESPONSE_TIME) - assertion2000.SetTarget(target2000) + assertion2000 := datadog.NewSyntheticsAssertionTarget(datadog.SYNTHETICSASSERTIONOPERATOR_LESS_THAN, target2000, datadog.SYNTHETICSASSERTIONTYPE_RESPONSE_TIME) + // assertion2000.SetTarget(target2000) return datadog.SyntheticsAPITest{ Config: &datadog.SyntheticsAPITestConfig{ @@ -192,10 +192,10 @@ func getTestSyntheticsSubtypeTCPAPI(ctx context.Context, t *testing.T) datadog.S } func getTestSyntheticsSubtypeDNSAPI(ctx context.Context, t *testing.T) datadog.SyntheticsAPITest { - recordAssertion := datadog.NewSyntheticsAssertionTarget(datadog.SYNTHETICSASSERTIONOPERATOR_IS, datadog.SYNTHETICSASSERTIONTYPE_RECORD_SOME) var target interface{} = "0.0.0.0" + recordAssertion := datadog.NewSyntheticsAssertionTarget(datadog.SYNTHETICSASSERTIONOPERATOR_IS, target, datadog.SYNTHETICSASSERTIONTYPE_RECORD_SOME) recordAssertion.SetProperty("A") - recordAssertion.SetTarget(target) + // recordAssertion.SetTarget(target) return datadog.SyntheticsAPITest{ Config: &datadog.SyntheticsAPITestConfig{ @@ -221,10 +221,10 @@ func getTestSyntheticsSubtypeDNSAPI(ctx context.Context, t *testing.T) datadog.S } func getTestSyntheticsSubtypeICMPAPI(ctx context.Context, t *testing.T) datadog.SyntheticsAPITest { - latencyAssertion := datadog.NewSyntheticsAssertionTarget(datadog.SYNTHETICSASSERTIONOPERATOR_LESS_THAN, datadog.SYNTHETICSASSERTIONTYPE_LATENCY) var target interface{} = 200 + latencyAssertion := datadog.NewSyntheticsAssertionTarget(datadog.SYNTHETICSASSERTIONOPERATOR_LESS_THAN, target, datadog.SYNTHETICSASSERTIONTYPE_LATENCY) latencyAssertion.SetProperty("avg") - latencyAssertion.SetTarget(target) + // latencyAssertion.SetTarget(target) return datadog.SyntheticsAPITest{ Config: &datadog.SyntheticsAPITestConfig{ diff --git a/tests/scenarios/features/v1/snapshots.feature b/tests/scenarios/features/v1/snapshots.feature index 37bb48b2d0e..786e506a906 100644 --- a/tests/scenarios/features/v1/snapshots.feature +++ b/tests/scenarios/features/v1/snapshots.feature @@ -6,6 +6,7 @@ Feature: Snapshots Given a valid "apiKeyAuth" key in the system And a valid "appKeyAuth" key in the system And an instance of "Snapshots" API + And new "GetGraphSnapshot" request @generated @skip Scenario: Take graph snapshots returns "Bad Request" response @@ -14,8 +15,7 @@ Feature: Snapshots @integration-only Scenario: Take graph snapshots returns "OK" response - Given new "GetGraphSnapshot" request - And request contains "start" parameter with value {{ timestamp("now - 1d") }} + Given request contains "start" parameter with value {{ timestamp("now - 1d") }} And request contains "end" parameter with value {{ timestamp("now") }} And request contains "metric_query" parameter with value "avg:system.load.1{*}" And request contains "title" parameter with value "System load"