From f13a3fc3481c17c224f5ccedf02834b6e5b96241 Mon Sep 17 00:00:00 2001 From: Romain Berger Date: Tue, 8 Nov 2022 13:41:58 +0100 Subject: [PATCH 1/4] Update go client --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index cfd8a11ca4..e2b4d23974 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/terraform-providers/terraform-provider-datadog require ( - github.com/DataDog/datadog-api-client-go/v2 v2.4.1-0.20221101131815-3d65624cef4a + github.com/DataDog/datadog-api-client-go/v2 v2.4.1-0.20221108101128-e9dfeefa073e github.com/DataDog/dd-sdk-go-testing v0.0.0-20211116174033-1cd082e322ad github.com/dnaeon/go-vcr v1.0.1 github.com/hashicorp/go-cleanhttp v0.5.2 diff --git a/go.sum b/go.sum index b44312f5d2..5bd579257e 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/DataDog/datadog-api-client-go/v2 v2.4.1-0.20221101131815-3d65624cef4a h1:DM/gE/GYOfX1Qoydc0MMaxUWK8cBitdYhmjzRJoGGb0= -github.com/DataDog/datadog-api-client-go/v2 v2.4.1-0.20221101131815-3d65624cef4a/go.mod h1:98b/MtTwSAr/yhTfhCR1oxAqQ/4tMkdrgKH7fYiDA0g= +github.com/DataDog/datadog-api-client-go/v2 v2.4.1-0.20221108101128-e9dfeefa073e h1:betPumOqvY98AdoZagIKyPmght7lbysK59Jh5mBa1HM= +github.com/DataDog/datadog-api-client-go/v2 v2.4.1-0.20221108101128-e9dfeefa073e/go.mod h1:98b/MtTwSAr/yhTfhCR1oxAqQ/4tMkdrgKH7fYiDA0g= github.com/DataDog/datadog-go v4.4.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= From 2cc15dfb0fc53fc399c731a1ec1eafab187b324d Mon Sep 17 00:00:00 2001 From: Romain Berger Date: Thu, 13 Oct 2022 14:04:16 +0200 Subject: [PATCH 2/4] [Synthetics] Add support for xpath assertions --- datadog/resource_datadog_synthetics_test_.go | 117 ++++++++++++++++-- ...csAPITest_BasicNewAssertionsOptions.freeze | 2 +- ...ticsAPITest_BasicNewAssertionsOptions.yaml | 30 ++--- ...APITest_UpdatedNewAssertionsOptions.freeze | 2 +- ...csAPITest_UpdatedNewAssertionsOptions.yaml | 57 ++++----- .../resource_datadog_synthetics_test_test.go | 23 +++- 6 files changed, 175 insertions(+), 56 deletions(-) diff --git a/datadog/resource_datadog_synthetics_test_.go b/datadog/resource_datadog_synthetics_test_.go index 6df3e76de1..a5b4b0dea6 100644 --- a/datadog/resource_datadog_synthetics_test_.go +++ b/datadog/resource_datadog_synthetics_test_.go @@ -412,6 +412,31 @@ func syntheticsAPIAssertion() *schema.Schema { }, }, }, + "targetxpath": { + Description: "Expected structure if `operator` is `validatesXPath`. Exactly one nested block is allowed with the structure below.", + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "operator": { + Description: "The specific operator to use on the path.", + Type: schema.TypeString, + Required: true, + }, + "xpath": { + Description: "The xpath to assert.", + Type: schema.TypeString, + Required: true, + }, + "targetvalue": { + Description: "Expected matching value.", + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, }, }, } @@ -1622,6 +1647,7 @@ func buildAssertions(attr []interface{}) []datadogV1.SyntheticsAssertion { if v, ok := targetMap["jsonpath"]; ok { subTarget.SetJsonPath(v.(string)) } + operator, ok := targetMap["operator"] if ok { subTarget.SetOperator(operator.(string)) @@ -1634,7 +1660,9 @@ func buildAssertions(attr []interface{}) []datadogV1.SyntheticsAssertion { if match, _ := regexp.MatchString("{{\\s*([^{}]*?)\\s*}}", v.(string)); match { subTarget.SetTargetValue(v) } else { - setFloatTargetValue(subTarget, v.(string)) + if floatValue, err := strconv.ParseFloat(v.(string), 64); err == nil { + subTarget.SetTargetValue(floatValue) + } } default: subTarget.SetTargetValue(v) @@ -1643,9 +1671,46 @@ func buildAssertions(attr []interface{}) []datadogV1.SyntheticsAssertion { assertionJSONPathTarget.SetTarget(*subTarget) } if _, ok := assertionMap["target"]; ok { - log.Printf("[WARN] target shouldn't be specified for validateJSONPath operator, only targetjsonpath") + log.Printf("[WARN] target shouldn't be specified for validatesJSONPath operator, only targetjsonpath") } assertions = append(assertions, datadogV1.SyntheticsAssertionJSONPathTargetAsSyntheticsAssertion(assertionJSONPathTarget)) + } else if assertionOperator == string(datadogV1.SYNTHETICSASSERTIONXPATHOPERATOR_VALIDATES_X_PATH) { + assertionXPathTarget := datadogV1.NewSyntheticsAssertionXPathTarget(datadogV1.SyntheticsAssertionXPathOperator(assertionOperator), datadogV1.SyntheticsAssertionType(assertionType)) + if v, ok := assertionMap["property"].(string); ok && len(v) > 0 { + assertionXPathTarget.SetProperty(v) + } + if v, ok := assertionMap["targetxpath"].([]interface{}); ok && len(v) > 0 { + subTarget := datadogV1.NewSyntheticsAssertionXPathTargetTarget() + targetMap := v[0].(map[string]interface{}) + if v, ok := targetMap["xpath"]; ok { + subTarget.SetXPath(v.(string)) + } + operator, ok := targetMap["operator"] + if ok { + subTarget.SetOperator(operator.(string)) + } + if v, ok := targetMap["targetvalue"]; ok { + switch datadogV1.SyntheticsAssertionOperator(operator.(string)) { + case + datadogV1.SYNTHETICSASSERTIONOPERATOR_LESS_THAN, + datadogV1.SYNTHETICSASSERTIONOPERATOR_MORE_THAN: + if match, _ := regexp.MatchString("{{\\s*([^{}]*?)\\s*}}", v.(string)); match { + subTarget.SetTargetValue(v) + } else { + if floatValue, err := strconv.ParseFloat(v.(string), 64); err == nil { + subTarget.SetTargetValue(floatValue) + } + } + default: + subTarget.SetTargetValue(v) + } + } + assertionXPathTarget.SetTarget(*subTarget) + } + if _, ok := assertionMap["target"]; ok { + log.Printf("[WARN] target shouldn't be specified for validateXPath operator, only targetxpath") + } + assertions = append(assertions, datadogV1.SyntheticsAssertionXPathTargetAsSyntheticsAssertion(assertionXPathTarget)) } else { assertionTarget := datadogV1.NewSyntheticsAssertionTargetWithDefaults() assertionTarget.SetOperator(datadogV1.SyntheticsAssertionOperator(assertionOperator)) @@ -1665,7 +1730,10 @@ func buildAssertions(attr []interface{}) []datadogV1.SyntheticsAssertion { } } if v, ok := assertionMap["targetjsonpath"].([]interface{}); ok && len(v) > 0 { - log.Printf("[WARN] targetjsonpath shouldn't be specified for non-validateJSONPath operator, only target") + log.Printf("[WARN] targetjsonpath shouldn't be specified for non-validatesJSONPath operator, only target") + } + if v, ok := assertionMap["targetxpath"].([]interface{}); ok && len(v) > 0 { + log.Printf("[WARN] targetxpath shouldn't be specified for non-validatesXPath operator, only target") } assertions = append(assertions, datadogV1.SyntheticsAssertionTargetAsSyntheticsAssertion(assertionTarget)) } @@ -2138,6 +2206,37 @@ func buildLocalAssertions(actualAssertions []datadogV1.SyntheticsAssertion) (loc if v, ok := assertionTarget.GetTypeOk(); ok { localAssertion["type"] = string(*v) } + } else if assertion.SyntheticsAssertionXPathTarget != nil { + assertionTarget := assertion.SyntheticsAssertionXPathTarget + if v, ok := assertionTarget.GetOperatorOk(); ok { + localAssertion["operator"] = string(*v) + } + if assertionTarget.HasProperty() { + localAssertion["property"] = assertionTarget.GetProperty() + } + if target, ok := assertionTarget.GetTargetOk(); ok { + localTarget := make(map[string]string) + if v, ok := target.GetXPathOk(); ok { + localTarget["xpath"] = string(*v) + } + if v, ok := target.GetOperatorOk(); ok { + localTarget["operator"] = string(*v) + } + if v, ok := target.GetTargetValueOk(); ok { + val := (*v).(interface{}) + if vAsString, ok := val.(string); ok { + localTarget["targetvalue"] = vAsString + } else if vAsFloat, ok := val.(float64); ok { + localTarget["targetvalue"] = strconv.FormatFloat(vAsFloat, 'f', -1, 64) + } else { + return localAssertions, fmt.Errorf("unrecognized targetvalue type %v", v) + } + } + localAssertion["targetxpath"] = []map[string]string{localTarget} + } + if v, ok := assertionTarget.GetTypeOk(); ok { + localAssertion["type"] = string(*v) + } } localAssertions[i] = localAssertion } @@ -2845,17 +2944,15 @@ func convertToString(i interface{}) string { } } -func setFloatTargetValue(subTarget *datadogV1.SyntheticsAssertionJSONPathTargetTarget, value string) { - if floatValue, err := strconv.ParseFloat(value, 64); err == nil { - subTarget.SetTargetValue(floatValue) - } -} - func validateSyntheticsAssertionOperator(val interface{}, key string) (warns []string, errs []error) { _, err := datadogV1.NewSyntheticsAssertionOperatorFromValue(val.(string)) if err != nil { _, err2 := datadogV1.NewSyntheticsAssertionJSONPathOperatorFromValue(val.(string)) - if err2 != nil { + _, err3 := datadogV1.NewSyntheticsAssertionXPathOperatorFromValue(val.(string)) + + if err2 == nil || err3 == nil { + return + } else { errs = append(errs, err, err2) } } diff --git a/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions.freeze b/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions.freeze index 7ca977e932..83b8a3ffce 100644 --- a/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions.freeze +++ b/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions.freeze @@ -1 +1 @@ -2022-09-06T21:35:48.291246+02:00 \ No newline at end of file +2022-11-08T15:54:37.715516+01:00 \ No newline at end of file diff --git a/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions.yaml b/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions.yaml index 41e87f64c0..fe9e4f89a2 100644 --- a/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions.yaml +++ b/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions.yaml @@ -3,7 +3,7 @@ version: 1 interactions: - request: body: | - {"config":{"assertions":[{"operator":"contains","property":"content-type","target":"application/json","type":"header"},{"operator":"is","target":200,"type":"statusCode"},{"operator":"validatesJSONPath","target":{"jsonPath":"topKey","operator":"isNot","targetValue":"0"},"type":"body"},{"operator":"validatesJSONPath","target":{"jsonPath":"something","operator":"moreThan","targetValue":5},"type":"body"},{"operator":"isNot","target":200,"type":"statusCode"},{"operator":"matches","target":"20[04]","type":"statusCode"},{"operator":"doesNotMatch","target":"20[04]","type":"statusCode"},{"operator":"validatesJSONPath","target":{"jsonPath":"$.mykey","operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}"},"type":"body"}],"configVariables":[{"example":"1234","name":"TEST","pattern":"{{ numeric(4) }}","type":"text"}],"request":{"basicAuth":{"password":"secret","type":"web","username":"admin"},"body":"this is a body","certificate":{"cert":{"content":"content-certificate","filename":"Provided in Terraform config"},"key":{"content":"content-key","filename":"key"}},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"method":"GET","query":{"foo":"bar"},"timeout":30,"url":"https://www.datadoghq.com"}},"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions-local-1662492948","options":{"follow_redirects":true,"min_location_failed":1,"monitor_options":{"renotify_interval":120},"tick_every":60},"status":"paused","subtype":"http","tags":["foo:bar","baz"],"type":"api"} + {"config":{"assertions":[{"operator":"contains","property":"content-type","target":"application/json","type":"header"},{"operator":"is","target":200,"type":"statusCode"},{"operator":"validatesJSONPath","target":{"jsonPath":"topKey","operator":"isNot","targetValue":"0"},"type":"body"},{"operator":"validatesJSONPath","target":{"jsonPath":"something","operator":"moreThan","targetValue":5},"type":"body"},{"operator":"isNot","target":200,"type":"statusCode"},{"operator":"matches","target":"20[04]","type":"statusCode"},{"operator":"doesNotMatch","target":"20[04]","type":"statusCode"},{"operator":"validatesJSONPath","target":{"jsonPath":"$.mykey","operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}"},"type":"body"},{"operator":"validatesXPath","target":{"operator":"contains","targetValue":"12","xPath":"something"},"type":"body"}],"configVariables":[{"example":"1234","name":"TEST","pattern":"{{ numeric(4) }}","type":"text"}],"request":{"basicAuth":{"password":"secret","type":"web","username":"admin"},"body":"this is a body","certificate":{"cert":{"content":"content-certificate","filename":"Provided in Terraform config"},"key":{"content":"content-key","filename":"key"}},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"method":"GET","query":{"foo":"bar"},"timeout":30,"url":"https://www.datadoghq.com"}},"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions-local-1667919277","options":{"follow_redirects":true,"min_location_failed":1,"monitor_options":{"renotify_interval":120},"tick_every":60},"status":"paused","subtype":"http","tags":["foo:bar","baz"],"type":"api"} form: {} headers: Accept: @@ -14,7 +14,7 @@ interactions: method: POST response: body: | - {"status":"paused","public_id":"7sy-c6r-c3u","tags":["foo:bar","baz"],"org_id":321813,"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","deleted_at":null,"name":"tf-TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions-local-1662492948","monitor_id":84053589,"type":"api","created_at":"2022-09-06T19:35:50.638252+00:00","modified_at":"2022-09-06T19:35:50.638252+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} + {"status":"paused","public_id":"9du-4ii-4mi","tags":["foo:bar","baz"],"org_id":569509,"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","deleted_at":null,"name":"tf-TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions-local-1667919277","monitor_id":102363313,"type":"api","created_at":"2022-11-08T14:54:39.615149+00:00","modified_at":"2022-11-08T14:54:39.615149+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}},{"operator":"validatesXPath","type":"body","target":{"operator":"contains","targetValue":"12","xPath":"something"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} headers: Content-Type: - application/json @@ -27,11 +27,11 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/api/7sy-c6r-c3u + url: https://api.datadoghq.com/api/v1/synthetics/tests/api/9du-4ii-4mi method: GET response: body: | - {"status":"paused","public_id":"7sy-c6r-c3u","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions-local-1662492948","monitor_id":84053589,"type":"api","created_at":"2022-09-06T19:35:50.638252+00:00","creator":{"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"modified_at":"2022-09-06T19:35:50.638252+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} + {"status":"paused","public_id":"9du-4ii-4mi","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions-local-1667919277","monitor_id":102363313,"type":"api","created_at":"2022-11-08T14:54:39.615149+00:00","creator":{"handle":"frog@datadoghq.com","name":"Frog","email":"frog@datadoghq.com"},"modified_at":"2022-11-08T14:54:39.615149+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}},{"operator":"validatesXPath","type":"body","target":{"operator":"contains","targetValue":"12","xPath":"something"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} headers: Content-Type: - application/json @@ -44,11 +44,11 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/7sy-c6r-c3u + url: https://api.datadoghq.com/api/v1/synthetics/tests/9du-4ii-4mi method: GET response: body: | - {"status":"paused","public_id":"7sy-c6r-c3u","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions-local-1662492948","monitor_id":84053589,"type":"api","created_at":"2022-09-06T19:35:50.638252+00:00","creator":{"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"modified_at":"2022-09-06T19:35:50.638252+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} + {"status":"paused","public_id":"9du-4ii-4mi","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions-local-1667919277","monitor_id":102363313,"type":"api","created_at":"2022-11-08T14:54:39.615149+00:00","creator":{"handle":"frog@datadoghq.com","name":"Frog","email":"frog@datadoghq.com"},"modified_at":"2022-11-08T14:54:39.615149+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}},{"operator":"validatesXPath","type":"body","target":{"operator":"contains","targetValue":"12","xPath":"something"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} headers: Content-Type: - application/json @@ -61,11 +61,11 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/7sy-c6r-c3u + url: https://api.datadoghq.com/api/v1/synthetics/tests/9du-4ii-4mi method: GET response: body: | - {"status":"paused","public_id":"7sy-c6r-c3u","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions-local-1662492948","monitor_id":84053589,"type":"api","created_at":"2022-09-06T19:35:50.638252+00:00","creator":{"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"modified_at":"2022-09-06T19:35:50.638252+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} + {"status":"paused","public_id":"9du-4ii-4mi","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions-local-1667919277","monitor_id":102363313,"type":"api","created_at":"2022-11-08T14:54:39.615149+00:00","creator":{"handle":"frog@datadoghq.com","name":"Frog","email":"frog@datadoghq.com"},"modified_at":"2022-11-08T14:54:39.615149+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}},{"operator":"validatesXPath","type":"body","target":{"operator":"contains","targetValue":"12","xPath":"something"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} headers: Content-Type: - application/json @@ -78,11 +78,11 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/api/7sy-c6r-c3u + url: https://api.datadoghq.com/api/v1/synthetics/tests/api/9du-4ii-4mi method: GET response: body: | - {"status":"paused","public_id":"7sy-c6r-c3u","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions-local-1662492948","monitor_id":84053589,"type":"api","created_at":"2022-09-06T19:35:50.638252+00:00","creator":{"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"modified_at":"2022-09-06T19:35:50.638252+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} + {"status":"paused","public_id":"9du-4ii-4mi","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_BasicNewAssertionsOptions-local-1667919277","monitor_id":102363313,"type":"api","created_at":"2022-11-08T14:54:39.615149+00:00","creator":{"handle":"frog@datadoghq.com","name":"Frog","email":"frog@datadoghq.com"},"modified_at":"2022-11-08T14:54:39.615149+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}},{"operator":"validatesXPath","type":"body","target":{"operator":"contains","targetValue":"12","xPath":"something"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} headers: Content-Type: - application/json @@ -91,7 +91,7 @@ interactions: duration: "" - request: body: | - {"public_ids":["7sy-c6r-c3u"]} + {"public_ids":["9du-4ii-4mi"]} form: {} headers: Accept: @@ -101,7 +101,8 @@ interactions: url: https://api.datadoghq.com/api/v1/synthetics/tests/delete method: POST response: - body: '{"deleted_tests":[{"deleted_at":"2022-09-06T19:35:59.101937+00:00","public_id":"7sy-c6r-c3u"}]}' + body: | + {"deleted_tests":[{"deleted_at":"2022-11-08T14:54:41.307267+00:00","public_id":"9du-4ii-4mi"}]} headers: Content-Type: - application/json @@ -114,11 +115,10 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/7sy-c6r-c3u + url: https://api.datadoghq.com/api/v1/synthetics/tests/9du-4ii-4mi method: GET response: - body: | - {"errors":["Synthetics test not found"]} + body: '{"errors":["Synthetics test not found"]}' headers: Content-Type: - application/json diff --git a/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions.freeze b/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions.freeze index 74aef2e5cb..1ddc4b6433 100644 --- a/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions.freeze +++ b/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions.freeze @@ -1 +1 @@ -2022-09-06T21:35:30.248403+02:00 \ No newline at end of file +2022-11-08T15:55:05.545535+01:00 \ No newline at end of file diff --git a/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions.yaml b/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions.yaml index d3c17d39fb..b3d8d40118 100644 --- a/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions.yaml +++ b/datadog/tests/cassettes/TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions.yaml @@ -3,7 +3,7 @@ version: 1 interactions: - request: body: | - {"config":{"assertions":[{"operator":"contains","property":"content-type","target":"application/json","type":"header"},{"operator":"is","target":200,"type":"statusCode"},{"operator":"validatesJSONPath","target":{"jsonPath":"topKey","operator":"isNot","targetValue":"0"},"type":"body"},{"operator":"validatesJSONPath","target":{"jsonPath":"something","operator":"moreThan","targetValue":5},"type":"body"},{"operator":"isNot","target":200,"type":"statusCode"},{"operator":"matches","target":"20[04]","type":"statusCode"},{"operator":"doesNotMatch","target":"20[04]","type":"statusCode"},{"operator":"validatesJSONPath","target":{"jsonPath":"$.mykey","operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}"},"type":"body"}],"configVariables":[{"example":"1234","name":"TEST","pattern":"{{ numeric(4) }}","type":"text"}],"request":{"basicAuth":{"password":"secret","type":"web","username":"admin"},"body":"this is a body","certificate":{"cert":{"content":"content-certificate","filename":"Provided in Terraform config"},"key":{"content":"content-key","filename":"key"}},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"method":"GET","query":{"foo":"bar"},"timeout":30,"url":"https://www.datadoghq.com"}},"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1662492930","options":{"follow_redirects":true,"min_location_failed":1,"monitor_options":{"renotify_interval":120},"tick_every":60},"status":"paused","subtype":"http","tags":["foo:bar","baz"],"type":"api"} + {"config":{"assertions":[{"operator":"contains","property":"content-type","target":"application/json","type":"header"},{"operator":"is","target":200,"type":"statusCode"},{"operator":"validatesJSONPath","target":{"jsonPath":"topKey","operator":"isNot","targetValue":"0"},"type":"body"},{"operator":"validatesJSONPath","target":{"jsonPath":"something","operator":"moreThan","targetValue":5},"type":"body"},{"operator":"isNot","target":200,"type":"statusCode"},{"operator":"matches","target":"20[04]","type":"statusCode"},{"operator":"doesNotMatch","target":"20[04]","type":"statusCode"},{"operator":"validatesJSONPath","target":{"jsonPath":"$.mykey","operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}"},"type":"body"},{"operator":"validatesXPath","target":{"operator":"contains","targetValue":"12","xPath":"something"},"type":"body"}],"configVariables":[{"example":"1234","name":"TEST","pattern":"{{ numeric(4) }}","type":"text"}],"request":{"basicAuth":{"password":"secret","type":"web","username":"admin"},"body":"this is a body","certificate":{"cert":{"content":"content-certificate","filename":"Provided in Terraform config"},"key":{"content":"content-key","filename":"key"}},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"method":"GET","query":{"foo":"bar"},"timeout":30,"url":"https://www.datadoghq.com"}},"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1667919305","options":{"follow_redirects":true,"min_location_failed":1,"monitor_options":{"renotify_interval":120},"tick_every":60},"status":"paused","subtype":"http","tags":["foo:bar","baz"],"type":"api"} form: {} headers: Accept: @@ -14,7 +14,7 @@ interactions: method: POST response: body: | - {"status":"paused","public_id":"ewz-xcy-hfj","tags":["foo:bar","baz"],"org_id":321813,"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","deleted_at":null,"name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1662492930","monitor_id":84053521,"type":"api","created_at":"2022-09-06T19:35:32.250287+00:00","modified_at":"2022-09-06T19:35:32.250287+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} + {"status":"paused","public_id":"6cq-7um-yby","tags":["foo:bar","baz"],"org_id":569509,"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","deleted_at":null,"name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1667919305","monitor_id":102363353,"type":"api","created_at":"2022-11-08T14:55:07.319240+00:00","modified_at":"2022-11-08T14:55:07.319240+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}},{"operator":"validatesXPath","type":"body","target":{"operator":"contains","targetValue":"12","xPath":"something"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} headers: Content-Type: - application/json @@ -27,11 +27,11 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/api/ewz-xcy-hfj + url: https://api.datadoghq.com/api/v1/synthetics/tests/api/6cq-7um-yby method: GET response: body: | - {"status":"paused","public_id":"ewz-xcy-hfj","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1662492930","monitor_id":84053521,"type":"api","created_at":"2022-09-06T19:35:32.250287+00:00","creator":{"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"modified_at":"2022-09-06T19:35:32.250287+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} + {"status":"paused","public_id":"6cq-7um-yby","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1667919305","monitor_id":102363353,"type":"api","created_at":"2022-11-08T14:55:07.319240+00:00","creator":{"handle":"frog@datadoghq.com","name":"Frog","email":"frog@datadoghq.com"},"modified_at":"2022-11-08T14:55:07.319240+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}},{"operator":"validatesXPath","type":"body","target":{"operator":"contains","targetValue":"12","xPath":"something"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} headers: Content-Type: - application/json @@ -44,11 +44,11 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/ewz-xcy-hfj + url: https://api.datadoghq.com/api/v1/synthetics/tests/6cq-7um-yby method: GET response: body: | - {"status":"paused","public_id":"ewz-xcy-hfj","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1662492930","monitor_id":84053521,"type":"api","created_at":"2022-09-06T19:35:32.250287+00:00","creator":{"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"modified_at":"2022-09-06T19:35:32.250287+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} + {"status":"paused","public_id":"6cq-7um-yby","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1667919305","monitor_id":102363353,"type":"api","created_at":"2022-11-08T14:55:07.319240+00:00","creator":{"handle":"frog@datadoghq.com","name":"Frog","email":"frog@datadoghq.com"},"modified_at":"2022-11-08T14:55:07.319240+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}},{"operator":"validatesXPath","type":"body","target":{"operator":"contains","targetValue":"12","xPath":"something"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} headers: Content-Type: - application/json @@ -61,11 +61,11 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/ewz-xcy-hfj + url: https://api.datadoghq.com/api/v1/synthetics/tests/6cq-7um-yby method: GET response: body: | - {"status":"paused","public_id":"ewz-xcy-hfj","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1662492930","monitor_id":84053521,"type":"api","created_at":"2022-09-06T19:35:32.250287+00:00","creator":{"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"modified_at":"2022-09-06T19:35:32.250287+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} + {"status":"paused","public_id":"6cq-7um-yby","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1667919305","monitor_id":102363353,"type":"api","created_at":"2022-11-08T14:55:07.319240+00:00","creator":{"handle":"frog@datadoghq.com","name":"Frog","email":"frog@datadoghq.com"},"modified_at":"2022-11-08T14:55:07.319240+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}},{"operator":"validatesXPath","type":"body","target":{"operator":"contains","targetValue":"12","xPath":"something"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} headers: Content-Type: - application/json @@ -78,11 +78,11 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/api/ewz-xcy-hfj + url: https://api.datadoghq.com/api/v1/synthetics/tests/api/6cq-7um-yby method: GET response: body: | - {"status":"paused","public_id":"ewz-xcy-hfj","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1662492930","monitor_id":84053521,"type":"api","created_at":"2022-09-06T19:35:32.250287+00:00","creator":{"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"modified_at":"2022-09-06T19:35:32.250287+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} + {"status":"paused","public_id":"6cq-7um-yby","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1667919305","monitor_id":102363353,"type":"api","created_at":"2022-11-08T14:55:07.319240+00:00","creator":{"handle":"frog@datadoghq.com","name":"Frog","email":"frog@datadoghq.com"},"modified_at":"2022-11-08T14:55:07.319240+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}},{"operator":"validatesXPath","type":"body","target":{"operator":"contains","targetValue":"12","xPath":"something"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} headers: Content-Type: - application/json @@ -95,11 +95,11 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/ewz-xcy-hfj + url: https://api.datadoghq.com/api/v1/synthetics/tests/6cq-7um-yby method: GET response: body: | - {"status":"paused","public_id":"ewz-xcy-hfj","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1662492930","monitor_id":84053521,"type":"api","created_at":"2022-09-06T19:35:32.250287+00:00","creator":{"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"modified_at":"2022-09-06T19:35:32.250287+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} + {"status":"paused","public_id":"6cq-7um-yby","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1667919305","monitor_id":102363353,"type":"api","created_at":"2022-11-08T14:55:07.319240+00:00","creator":{"handle":"frog@datadoghq.com","name":"Frog","email":"frog@datadoghq.com"},"modified_at":"2022-11-08T14:55:07.319240+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}},{"operator":"validatesXPath","type":"body","target":{"operator":"contains","targetValue":"12","xPath":"something"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} headers: Content-Type: - application/json @@ -112,11 +112,11 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/api/ewz-xcy-hfj + url: https://api.datadoghq.com/api/v1/synthetics/tests/api/6cq-7um-yby method: GET response: body: | - {"status":"paused","public_id":"ewz-xcy-hfj","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1662492930","monitor_id":84053521,"type":"api","created_at":"2022-09-06T19:35:32.250287+00:00","creator":{"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"modified_at":"2022-09-06T19:35:32.250287+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} + {"status":"paused","public_id":"6cq-7um-yby","tags":["foo:bar","baz"],"locations":["aws:eu-central-1"],"message":"Notify @datadog.user","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1667919305","monitor_id":102363353,"type":"api","created_at":"2022-11-08T14:55:07.319240+00:00","creator":{"handle":"frog@datadoghq.com","name":"Frog","email":"frog@datadoghq.com"},"modified_at":"2022-11-08T14:55:07.319240+00:00","subtype":"http","config":{"request":{"body":"this is a body","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key"}},"url":"https://www.datadoghq.com","basicAuth":{"username":"admin","password":"secret","type":"web"},"headers":{"Accept":"application/json","X-Datadog-Trace-ID":"123456789"},"timeout":30,"query":{"foo":"bar"},"method":"GET"},"assertions":[{"operator":"contains","property":"content-type","type":"header","target":"application/json"},{"operator":"is","type":"statusCode","target":200},{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":5,"jsonPath":"something"}},{"operator":"isNot","type":"statusCode","target":200},{"operator":"matches","type":"statusCode","target":"20[04]"},{"operator":"doesNotMatch","type":"statusCode","target":"20[04]"},{"operator":"validatesJSONPath","type":"body","target":{"operator":"moreThan","targetValue":"{{ TEST_VAR_1 }}","jsonPath":"$.mykey"}},{"operator":"validatesXPath","type":"body","target":{"operator":"contains","targetValue":"12","xPath":"something"}}],"configVariables":[{"pattern":"{{ numeric(4) }}","type":"text","example":"1234","name":"TEST"}]},"options":{"follow_redirects":true,"monitor_options":{"include_tags":true,"renotify_interval":120,"notify_audit":false,"new_host_delay":300,"on_missing_data":"show_no_data"},"min_location_failed":1,"tick_every":60}} headers: Content-Type: - application/json @@ -125,17 +125,18 @@ interactions: duration: "" - request: body: | - {"config":{"assertions":[{"operator":"validatesJSONPath","target":{"jsonPath":"topKey","operator":"isNot","targetValue":"0"},"type":"body"}],"configVariables":[],"request":{"certificate":{"cert":{"content":"content-certificate-updated","filename":"Provided in Terraform config"},"key":{"content":"content-key-updated","filename":"key-updated"}},"method":"GET","timeout":60,"url":"https://docs.datadoghq.com"}},"locations":["aws:eu-central-1"],"message":"Notify @pagerduty","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1662492930updated","options":{"min_failure_duration":10,"min_location_failed":1,"monitor_options":{"renotify_interval":120},"tick_every":900},"status":"live","subtype":"http","tags":["foo:bar","foo","env:test"],"type":"api"} + {"config":{"assertions":[{"operator":"validatesJSONPath","target":{"jsonPath":"topKey","operator":"isNot","targetValue":"0"},"type":"body"}],"configVariables":[],"request":{"certificate":{"cert":{"content":"content-certificate-updated","filename":"Provided in Terraform config"},"key":{"content":"content-key-updated","filename":"key-updated"}},"method":"GET","timeout":60,"url":"https://docs.datadoghq.com"}},"locations":["aws:eu-central-1"],"message":"Notify @pagerduty","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1667919305updated","options":{"min_failure_duration":10,"min_location_failed":1,"monitor_options":{"renotify_interval":120},"tick_every":900},"status":"live","subtype":"http","tags":["foo:bar","foo","env:test"],"type":"api"} form: {} headers: Accept: - application/json Content-Type: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/api/ewz-xcy-hfj + url: https://api.datadoghq.com/api/v1/synthetics/tests/api/6cq-7um-yby method: PUT response: - body: '{"status":"live","public_id":"ewz-xcy-hfj","tags":["foo:bar","foo","env:test"],"org_id":321813,"locations":["aws:eu-central-1"],"message":"Notify @pagerduty","deleted_at":null,"name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1662492930updated","monitor_id":84053521,"type":"api","created_at":"2022-09-06T19:35:32.250287+00:00","modified_at":"2022-09-06T19:35:35.580459+00:00","subtype":"http","config":{"request":{"url":"https://docs.datadoghq.com","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key-updated"}},"method":"GET","timeout":60},"assertions":[{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}}],"configVariables":[]},"options":{"monitor_options":{"notify_audit":false,"include_tags":true,"new_host_delay":300,"on_missing_data":"show_no_data","renotify_interval":120},"tick_every":900,"min_failure_duration":10,"min_location_failed":1}}' + body: | + {"status":"live","public_id":"6cq-7um-yby","tags":["foo:bar","foo","env:test"],"org_id":569509,"locations":["aws:eu-central-1"],"message":"Notify @pagerduty","deleted_at":null,"name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1667919305updated","monitor_id":102363353,"type":"api","created_at":"2022-11-08T14:55:07.319240+00:00","modified_at":"2022-11-08T14:55:09.657692+00:00","subtype":"http","config":{"request":{"url":"https://docs.datadoghq.com","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key-updated"}},"method":"GET","timeout":60},"assertions":[{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}}],"configVariables":[]},"options":{"monitor_options":{"notify_audit":false,"include_tags":true,"new_host_delay":300,"on_missing_data":"show_no_data","renotify_interval":120},"tick_every":900,"min_failure_duration":10,"min_location_failed":1}} headers: Content-Type: - application/json @@ -148,11 +149,11 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/ewz-xcy-hfj + url: https://api.datadoghq.com/api/v1/synthetics/tests/6cq-7um-yby method: GET response: body: | - {"status":"live","public_id":"ewz-xcy-hfj","tags":["foo:bar","foo","env:test"],"locations":["aws:eu-central-1"],"message":"Notify @pagerduty","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1662492930updated","monitor_id":84053521,"type":"api","created_at":"2022-09-06T19:35:32.250287+00:00","creator":{"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"modified_at":"2022-09-06T19:35:35.580459+00:00","subtype":"http","config":{"request":{"url":"https://docs.datadoghq.com","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key-updated"}},"method":"GET","timeout":60},"assertions":[{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}}],"configVariables":[]},"options":{"monitor_options":{"renotify_interval":120},"tick_every":900,"min_failure_duration":10,"min_location_failed":1}} + {"status":"live","public_id":"6cq-7um-yby","tags":["foo:bar","foo","env:test"],"locations":["aws:eu-central-1"],"message":"Notify @pagerduty","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1667919305updated","monitor_id":102363353,"type":"api","created_at":"2022-11-08T14:55:07.319240+00:00","creator":{"handle":"frog@datadoghq.com","name":"Frog","email":"frog@datadoghq.com"},"modified_at":"2022-11-08T14:55:09.657692+00:00","subtype":"http","config":{"request":{"url":"https://docs.datadoghq.com","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key-updated"}},"method":"GET","timeout":60},"assertions":[{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}}],"configVariables":[]},"options":{"monitor_options":{"renotify_interval":120},"tick_every":900,"min_failure_duration":10,"min_location_failed":1}} headers: Content-Type: - application/json @@ -165,11 +166,11 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/ewz-xcy-hfj + url: https://api.datadoghq.com/api/v1/synthetics/tests/6cq-7um-yby method: GET response: body: | - {"status":"live","public_id":"ewz-xcy-hfj","tags":["foo:bar","foo","env:test"],"locations":["aws:eu-central-1"],"message":"Notify @pagerduty","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1662492930updated","monitor_id":84053521,"type":"api","created_at":"2022-09-06T19:35:32.250287+00:00","creator":{"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"modified_at":"2022-09-06T19:35:35.580459+00:00","subtype":"http","config":{"request":{"url":"https://docs.datadoghq.com","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key-updated"}},"method":"GET","timeout":60},"assertions":[{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}}],"configVariables":[]},"options":{"monitor_options":{"renotify_interval":120},"tick_every":900,"min_failure_duration":10,"min_location_failed":1}} + {"status":"live","public_id":"6cq-7um-yby","tags":["foo:bar","foo","env:test"],"locations":["aws:eu-central-1"],"message":"Notify @pagerduty","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1667919305updated","monitor_id":102363353,"type":"api","created_at":"2022-11-08T14:55:07.319240+00:00","creator":{"handle":"frog@datadoghq.com","name":"Frog","email":"frog@datadoghq.com"},"modified_at":"2022-11-08T14:55:09.657692+00:00","subtype":"http","config":{"request":{"url":"https://docs.datadoghq.com","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key-updated"}},"method":"GET","timeout":60},"assertions":[{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}}],"configVariables":[]},"options":{"monitor_options":{"renotify_interval":120},"tick_every":900,"min_failure_duration":10,"min_location_failed":1}} headers: Content-Type: - application/json @@ -182,11 +183,11 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/api/ewz-xcy-hfj + url: https://api.datadoghq.com/api/v1/synthetics/tests/api/6cq-7um-yby method: GET response: body: | - {"status":"live","public_id":"ewz-xcy-hfj","tags":["foo:bar","foo","env:test"],"locations":["aws:eu-central-1"],"message":"Notify @pagerduty","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1662492930updated","monitor_id":84053521,"type":"api","created_at":"2022-09-06T19:35:32.250287+00:00","creator":{"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"modified_at":"2022-09-06T19:35:35.580459+00:00","subtype":"http","config":{"request":{"url":"https://docs.datadoghq.com","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key-updated"}},"method":"GET","timeout":60},"assertions":[{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}}],"configVariables":[]},"options":{"monitor_options":{"renotify_interval":120},"tick_every":900,"min_failure_duration":10,"min_location_failed":1}} + {"status":"live","public_id":"6cq-7um-yby","tags":["foo:bar","foo","env:test"],"locations":["aws:eu-central-1"],"message":"Notify @pagerduty","name":"tf-TestAccDatadogSyntheticsAPITest_UpdatedNewAssertionsOptions-local-1667919305updated","monitor_id":102363353,"type":"api","created_at":"2022-11-08T14:55:07.319240+00:00","creator":{"handle":"frog@datadoghq.com","name":"Frog","email":"frog@datadoghq.com"},"modified_at":"2022-11-08T14:55:09.657692+00:00","subtype":"http","config":{"request":{"url":"https://docs.datadoghq.com","certificate":{"cert":{"filename":"Provided in Terraform config"},"key":{"filename":"key-updated"}},"method":"GET","timeout":60},"assertions":[{"operator":"validatesJSONPath","type":"body","target":{"operator":"isNot","targetValue":"0","jsonPath":"topKey"}}],"configVariables":[]},"options":{"monitor_options":{"renotify_interval":120},"tick_every":900,"min_failure_duration":10,"min_location_failed":1}} headers: Content-Type: - application/json @@ -195,7 +196,7 @@ interactions: duration: "" - request: body: | - {"public_ids":["ewz-xcy-hfj"]} + {"public_ids":["6cq-7um-yby"]} form: {} headers: Accept: @@ -205,7 +206,8 @@ interactions: url: https://api.datadoghq.com/api/v1/synthetics/tests/delete method: POST response: - body: '{"deleted_tests":[{"deleted_at":"2022-09-06T19:35:43.093371+00:00","public_id":"ewz-xcy-hfj"}]}' + body: | + {"deleted_tests":[{"deleted_at":"2022-11-08T14:55:11.405208+00:00","public_id":"6cq-7um-yby"}]} headers: Content-Type: - application/json @@ -218,11 +220,10 @@ interactions: headers: Accept: - application/json - url: https://api.datadoghq.com/api/v1/synthetics/tests/ewz-xcy-hfj + url: https://api.datadoghq.com/api/v1/synthetics/tests/6cq-7um-yby method: GET response: - body: | - {"errors":["Synthetics test not found"]} + body: '{"errors":["Synthetics test not found"]}' headers: Content-Type: - application/json diff --git a/datadog/tests/resource_datadog_synthetics_test_test.go b/datadog/tests/resource_datadog_synthetics_test_test.go index 411fc45d21..c4586ced0c 100644 --- a/datadog/tests/resource_datadog_synthetics_test_test.go +++ b/datadog/tests/resource_datadog_synthetics_test_test.go @@ -755,7 +755,7 @@ func createSyntheticsAPITestStepNewAssertionsOptions(ctx context.Context, accPro resource.TestCheckResourceAttr( "datadog_synthetics_test.bar", "request_client_certificate.0.key.0.filename", "key"), resource.TestCheckResourceAttr( - "datadog_synthetics_test.bar", "assertion.#", "8"), + "datadog_synthetics_test.bar", "assertion.#", "9"), resource.TestCheckResourceAttr( "datadog_synthetics_test.bar", "assertion.0.type", "header"), resource.TestCheckResourceAttr( @@ -824,6 +824,18 @@ func createSyntheticsAPITestStepNewAssertionsOptions(ctx context.Context, accPro "datadog_synthetics_test.bar", "assertion.7.targetjsonpath.0.operator", "moreThan"), resource.TestCheckResourceAttr( "datadog_synthetics_test.bar", "assertion.7.targetjsonpath.0.targetvalue", "{{ TEST_VAR_1 }}"), + resource.TestCheckResourceAttr( + "datadog_synthetics_test.bar", "assertion.8.type", "body"), + resource.TestCheckResourceAttr( + "datadog_synthetics_test.bar", "assertion.8.operator", "validatesXPath"), + resource.TestCheckResourceAttr( + "datadog_synthetics_test.bar", "assertion.8.targetxpath.#", "1"), + resource.TestCheckResourceAttr( + "datadog_synthetics_test.bar", "assertion.8.targetxpath.0.xpath", "something"), + resource.TestCheckResourceAttr( + "datadog_synthetics_test.bar", "assertion.8.targetxpath.0.operator", "contains"), + resource.TestCheckResourceAttr( + "datadog_synthetics_test.bar", "assertion.8.targetxpath.0.targetvalue", "12"), resource.TestCheckResourceAttr( "datadog_synthetics_test.bar", "locations.#", "1"), resource.TestCheckResourceAttr( @@ -950,6 +962,15 @@ resource "datadog_synthetics_test" "bar" { targetvalue = "{{ TEST_VAR_1 }}" } } + assertion { + type = "body" + operator = "validatesXPath" + targetxpath { + operator = "contains" + targetvalue = "12" + xpath = "something" + } + } locations = [ "aws:eu-central-1" ] options_list { From 8a58ad5c2e05c81d8b2952677e7743d88519df15 Mon Sep 17 00:00:00 2001 From: Romain Berger Date: Tue, 8 Nov 2022 15:57:32 +0100 Subject: [PATCH 3/4] Update docs --- docs/resources/synthetics_test.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/resources/synthetics_test.md b/docs/resources/synthetics_test.md index 79698c79ec..eb51d01525 100644 --- a/docs/resources/synthetics_test.md +++ b/docs/resources/synthetics_test.md @@ -340,6 +340,7 @@ Optional: - `property` (String) If assertion type is `header`, this is the header name. - `target` (String) Expected value. Depends on the assertion type, refer to [Datadog documentation](https://docs.datadoghq.com/api/latest/synthetics/#create-a-test) for details. - `targetjsonpath` (Block List, Max: 1) Expected structure if `operator` is `validatesJSONPath`. Exactly one nested block is allowed with the structure below. (see [below for nested schema](#nestedblock--api_step--assertion--targetjsonpath)) +- `targetxpath` (Block List, Max: 1) Expected structure if `operator` is `validatesXPath`. Exactly one nested block is allowed with the structure below. (see [below for nested schema](#nestedblock--api_step--assertion--targetxpath)) ### Nested Schema for `api_step.assertion.targetjsonpath` @@ -351,6 +352,16 @@ Required: - `targetvalue` (String) Expected matching value. + +### Nested Schema for `api_step.assertion.targetxpath` + +Required: + +- `operator` (String) The specific operator to use on the path. +- `targetvalue` (String) Expected matching value. +- `xpath` (String) The xpath to assert. + + ### Nested Schema for `api_step.extracted_value` @@ -487,6 +498,7 @@ Optional: - `property` (String) If assertion type is `header`, this is the header name. - `target` (String) Expected value. Depends on the assertion type, refer to [Datadog documentation](https://docs.datadoghq.com/api/latest/synthetics/#create-a-test) for details. - `targetjsonpath` (Block List, Max: 1) Expected structure if `operator` is `validatesJSONPath`. Exactly one nested block is allowed with the structure below. (see [below for nested schema](#nestedblock--assertion--targetjsonpath)) +- `targetxpath` (Block List, Max: 1) Expected structure if `operator` is `validatesXPath`. Exactly one nested block is allowed with the structure below. (see [below for nested schema](#nestedblock--assertion--targetxpath)) ### Nested Schema for `assertion.targetjsonpath` @@ -498,6 +510,16 @@ Required: - `targetvalue` (String) Expected matching value. + +### Nested Schema for `assertion.targetxpath` + +Required: + +- `operator` (String) The specific operator to use on the path. +- `targetvalue` (String) Expected matching value. +- `xpath` (String) The xpath to assert. + + ### Nested Schema for `browser_step` From e3974699c1a38a42bae0ee77fad1258055729e6d Mon Sep 17 00:00:00 2001 From: Sherzod Karimov Date: Wed, 9 Nov 2022 10:29:26 -0500 Subject: [PATCH 4/4] fmt test example --- .../tests/resource_datadog_synthetics_test_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/datadog/tests/resource_datadog_synthetics_test_test.go b/datadog/tests/resource_datadog_synthetics_test_test.go index c4586ced0c..a9be57bfea 100644 --- a/datadog/tests/resource_datadog_synthetics_test_test.go +++ b/datadog/tests/resource_datadog_synthetics_test_test.go @@ -963,12 +963,12 @@ resource "datadog_synthetics_test" "bar" { } } assertion { - type = "body" - operator = "validatesXPath" - targetxpath { - operator = "contains" - targetvalue = "12" - xpath = "something" + type = "body" + operator = "validatesXPath" + targetxpath { + operator = "contains" + targetvalue = "12" + xpath = "something" } }