From 1eab33c122e57839ce2e58f73ee5dfe8a5c8fae3 Mon Sep 17 00:00:00 2001 From: Gregory Date: Thu, 30 Apr 2020 16:46:28 +0200 Subject: [PATCH 1/6] migrate aws lambda arn resource --- ...urce_datadog_integration_aws_lambda_arn.go | 61 +++++++++---------- ...datadog_integration_aws_lambda_arn_test.go | 35 ++++++----- 2 files changed, 47 insertions(+), 49 deletions(-) diff --git a/datadog/resource_datadog_integration_aws_lambda_arn.go b/datadog/resource_datadog_integration_aws_lambda_arn.go index bc6a743004..57356a4e6c 100644 --- a/datadog/resource_datadog_integration_aws_lambda_arn.go +++ b/datadog/resource_datadog_integration_aws_lambda_arn.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" + datadogV1 "github.com/DataDog/datadog-api-client-go/api/v1/datadog" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "github.com/zorkian/go-datadog-api" ) func accountAndLambdaArnFromID(id string) (string, string, error) { @@ -16,15 +16,12 @@ func accountAndLambdaArnFromID(id string) (string, string, error) { return result[0], result[1], nil } -func buildDatadogIntegrationAwsLambdaArnStruct(d *schema.ResourceData) *datadog.IntegrationAWSLambdaARNRequest { +func buildDatadogIntegrationAwsLambdaArnStruct(d *schema.ResourceData) *datadogV1.AWSAccountAndLambdaRequest { accountID := d.Get("account_id").(string) lambdaArn := d.Get("lambda_arn").(string) - attachLambdaArnRequest := datadog.IntegrationAWSLambdaARNRequest{ - AccountID: &accountID, - LambdaARN: &lambdaArn, - } - return &attachLambdaArnRequest + attachLambdaArnRequest := datadogV1.NewAWSAccountAndLambdaRequest(accountID, lambdaArn) + return attachLambdaArnRequest } func resourceDatadogIntegrationAwsLambdaArn() *schema.Resource { @@ -56,9 +53,10 @@ func resourceDatadogIntegrationAwsLambdaArnExists(d *schema.ResourceData, meta i // Exists - This is called to verify a resource still exists. It is called prior to Read, // and lowers the burden of Read to be able to assume the resource exists. providerConf := meta.(*ProviderConfiguration) - client := providerConf.CommunityClient + datadogClientV1 := providerConf.DatadogClientV1 + authV1 := providerConf.AuthV1 - logCollections, err := client.GetIntegrationAWSLogCollection() + logCollections, _, err := datadogClientV1.AWSLogsIntegrationApi.ListAWSLogsIntegrations(authV1).Execute() if err != nil { return false, translateClientError(err, "error getting aws log integrations for datadog account.") } @@ -68,10 +66,10 @@ func resourceDatadogIntegrationAwsLambdaArnExists(d *schema.ResourceData, meta i return false, translateClientError(err, fmt.Sprintf("error getting aws account ID and lambda ARN from id: %s", d.Id())) } - for _, logCollection := range *logCollections { - if logCollection.GetAccountID() == accountID { - for _, logCollectionLambdaArn := range logCollection.LambdaARNs { - if lambdaArn == logCollectionLambdaArn.GetLambdaARN() { + for _, logCollection := range logCollections { + if logCollection.GetAccountId() == accountID { + for _, logCollectionLambdaArn := range logCollection.GetLambdas() { + if lambdaArn == logCollectionLambdaArn.GetArn() { return true, nil } } @@ -82,39 +80,40 @@ func resourceDatadogIntegrationAwsLambdaArnExists(d *schema.ResourceData, meta i func resourceDatadogIntegrationAwsLambdaArnCreate(d *schema.ResourceData, meta interface{}) error { providerConf := meta.(*ProviderConfiguration) - client := providerConf.CommunityClient + datadogClientV1 := providerConf.DatadogClientV1 + authV1 := providerConf.AuthV1 attachLambdaArnRequest := buildDatadogIntegrationAwsLambdaArnStruct(d) - err := client.AttachLambdaARNIntegrationAWS(attachLambdaArnRequest) - + _, _, err := datadogClientV1.AWSLogsIntegrationApi.CreateAWSLambdaARN(authV1).Body(*attachLambdaArnRequest).Execute() if err != nil { return translateClientError(err, "error attaching Lambda ARN to AWS integration account") } - d.SetId(fmt.Sprintf("%s %s", *attachLambdaArnRequest.AccountID, *attachLambdaArnRequest.LambdaARN)) + d.SetId(fmt.Sprintf("%s %s", attachLambdaArnRequest.AccountId, attachLambdaArnRequest.LambdaArn)) return resourceDatadogIntegrationAwsLambdaArnRead(d, meta) } func resourceDatadogIntegrationAwsLambdaArnRead(d *schema.ResourceData, meta interface{}) error { providerConf := meta.(*ProviderConfiguration) - client := providerConf.CommunityClient + datadogClientV1 := providerConf.DatadogClientV1 + authV1 := providerConf.AuthV1 accountID, lambdaArn, err := accountAndLambdaArnFromID(d.Id()) if err != nil { return translateClientError(err, fmt.Sprintf("error getting aws account ID and lambda ARN from id: %s", d.Id())) } - logCollections, err := client.GetIntegrationAWSLogCollection() + logCollections, _, err := datadogClientV1.AWSLogsIntegrationApi.ListAWSLogsIntegrations(authV1).Execute() if err != nil { return translateClientError(err, "error getting aws log integrations for datadog account.") } - for _, logCollection := range *logCollections { - if logCollection.GetAccountID() == accountID { - for _, logCollectionLambdaArn := range logCollection.LambdaARNs { - if lambdaArn == logCollectionLambdaArn.GetLambdaARN() { - d.Set("account_id", logCollection.GetAccountID()) - d.Set("lambda_arn", logCollectionLambdaArn.GetLambdaARN()) + for _, logCollection := range logCollections { + if logCollection.GetAccountId() == accountID { + for _, logCollectionLambdaArn := range logCollection.GetLambdas() { + if lambdaArn == logCollectionLambdaArn.GetArn() { + d.Set("account_id", logCollection.GetAccountId()) + d.Set("lambda_arn", logCollectionLambdaArn.GetArn()) return nil } } @@ -125,20 +124,16 @@ func resourceDatadogIntegrationAwsLambdaArnRead(d *schema.ResourceData, meta int func resourceDatadogIntegrationAwsLambdaArnDelete(d *schema.ResourceData, meta interface{}) error { providerConf := meta.(*ProviderConfiguration) - client := providerConf.CommunityClient + datadogClientV1 := providerConf.DatadogClientV1 + authV1 := providerConf.AuthV1 accountID, lambdaArn, err := accountAndLambdaArnFromID(d.Id()) if err != nil { return translateClientError(err, fmt.Sprintf("error parsing account ID and lamdba ARN from ID: %s", d.Id())) } - attachLambdaArnRequest := datadog.IntegrationAWSLambdaARNRequest{ - AccountID: &accountID, - LambdaARN: &lambdaArn, - } - - err = client.DeleteAWSLogCollection(&attachLambdaArnRequest) - + attachLambdaArnRequest := datadogV1.NewAWSAccountAndLambdaRequest(accountID, lambdaArn) + _, _, err = datadogClientV1.AWSLogsIntegrationApi.DeleteAWSLambdaARN(authV1).Body(*attachLambdaArnRequest).Execute() if err != nil { return translateClientError(err, "error deleting an AWS integration Lambda ARN") } diff --git a/datadog/resource_datadog_integration_aws_lambda_arn_test.go b/datadog/resource_datadog_integration_aws_lambda_arn_test.go index daccdd907b..a325771abc 100644 --- a/datadog/resource_datadog_integration_aws_lambda_arn_test.go +++ b/datadog/resource_datadog_integration_aws_lambda_arn_test.go @@ -1,13 +1,14 @@ package datadog import ( + "context" "fmt" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "github.com/zorkian/go-datadog-api" "strings" "testing" + datadogV1 "github.com/DataDog/datadog-api-client-go/api/v1/datadog" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/terraform" ) @@ -84,14 +85,15 @@ func TestAccDatadogIntegrationAWSLambdaArn(t *testing.T) { func checkIntegrationAWSLambdaArnExists(accProvider *schema.Provider) func(*terraform.State) error { return func(s *terraform.State) error { providerConf := accProvider.Meta().(*ProviderConfiguration) - client := providerConf.CommunityClient + datadogClientV1 := providerConf.DatadogClientV1 + authV1 := providerConf.AuthV1 - return checkIntegrationAwsLambdaArnExistsHelper(s, client) + return checkIntegrationAwsLambdaArnExistsHelper(authV1, s, datadogClientV1) } } -func checkIntegrationAwsLambdaArnExistsHelper(s *terraform.State, client *datadog.Client) error { - logCollections, err := client.GetIntegrationAWSLogCollection() +func checkIntegrationAwsLambdaArnExistsHelper(authV1 context.Context, s *terraform.State, datadogClientV1 *datadogV1.APIClient) error { + logCollections, _, err := datadogClientV1.AWSLogsIntegrationApi.ListAWSLogsIntegrations(authV1).Execute() if err != nil { return err } @@ -100,9 +102,9 @@ func checkIntegrationAwsLambdaArnExistsHelper(s *terraform.State, client *datado if strings.Contains(resourceType, "datadog_integration_aws_lambda_arn") { accountId := r.Primary.Attributes["account_id"] lambdaArn := r.Primary.Attributes["lambda_arn"] - for _, logCollection := range *logCollections { - for _, logCollectionLambdaArn := range logCollection.LambdaARNs { - if *logCollection.AccountID == accountId && *logCollectionLambdaArn.LambdaARN == lambdaArn { + for _, logCollection := range logCollections { + for _, logCollectionLambdaArn := range logCollection.GetLambdas() { + if logCollection.GetAccountId() == accountId && logCollectionLambdaArn.GetArn() == lambdaArn { return nil } } @@ -116,23 +118,24 @@ func checkIntegrationAwsLambdaArnExistsHelper(s *terraform.State, client *datado func checkIntegrationAWSLambdaArnDestroy(accProvider *schema.Provider) func(*terraform.State) error { return func(s *terraform.State) error { providerConf := accProvider.Meta().(*ProviderConfiguration) - client := providerConf.CommunityClient + datadogClientV1 := providerConf.DatadogClientV1 + authV1 := providerConf.AuthV1 - return checkIntegrationAWSLambdaArnDestroyHelper(s, client) + return checkIntegrationAWSLambdaArnDestroyHelper(authV1, s, datadogClientV1) } } -func checkIntegrationAWSLambdaArnDestroyHelper(s *terraform.State, client *datadog.Client) error { - logCollections, err := client.GetIntegrationAWSLogCollection() +func checkIntegrationAWSLambdaArnDestroyHelper(authV1 context.Context, s *terraform.State, datadogClientV1 *datadogV1.APIClient) error { + logCollections, _, err := datadogClientV1.AWSLogsIntegrationApi.ListAWSLogsIntegrations(authV1).Execute() if err != nil { return err } for _, r := range s.RootModule().Resources { accountId := r.Primary.Attributes["account_id"] lambdaArn := r.Primary.Attributes["lambda_arn"] - for _, logCollection := range *logCollections { - for _, logCollectionLambdaArn := range logCollection.LambdaARNs { - if *logCollection.AccountID == accountId && *logCollectionLambdaArn.LambdaARN == lambdaArn { + for _, logCollection := range logCollections { + for _, logCollectionLambdaArn := range logCollection.GetLambdas() { + if logCollection.GetAccountId() == accountId && logCollectionLambdaArn.GetArn() == lambdaArn { return fmt.Errorf("The AWS Lambda ARN is still attached to the account: accountId=%s, lambdaArn=%s", accountId, lambdaArn) } } From d029ce0092944ddfff5e05bc054580a8d401ed3e Mon Sep 17 00:00:00 2001 From: Gregory Date: Thu, 30 Apr 2020 19:37:08 +0200 Subject: [PATCH 2/6] Add cassette and migrate AWS intg tests --- .../TestAccDatadogIntegrationAWS.yaml | 146 +++++++---- ...TestAccDatadogIntegrationAWSLambdaArn.yaml | 248 +++++++++++------- ...AccDatadogIntegrationAWSLogCollection.yaml | 206 ++++++++------- datadog/resource_datadog_integration_aws.go | 5 +- .../resource_datadog_integration_aws_test.go | 32 ++- 5 files changed, 389 insertions(+), 248 deletions(-) diff --git a/datadog/cassettes/TestAccDatadogIntegrationAWS.yaml b/datadog/cassettes/TestAccDatadogIntegrationAWS.yaml index d07fa2d832..b96ab7193d 100644 --- a/datadog/cassettes/TestAccDatadogIntegrationAWS.yaml +++ b/datadog/cassettes/TestAccDatadogIntegrationAWS.yaml @@ -2,17 +2,22 @@ version: 1 interactions: - request: - body: '{"account_id":"1234567888","role_name":"testacc-datadog-integration-role","filter_tags":[],"host_tags":[],"account_specific_namespace_rules":{}}' + body: | + {"account_id":"1234567888","account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role"} form: {} headers: + Accept: + - application/json Content-Type: - application/json + Dd-Operation-Id: + - CreateAWSAccount User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: POST response: - body: '{"external_id":"30a32f0eb42140449394be28c38362f7"}' + body: '{"external_id":"c61a8dc9352c4a70966d0638e27198f0"}' headers: Cache-Control: - no-cache @@ -23,13 +28,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:09 GMT + - Thu, 30 Apr 2020 17:36:17 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:07 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:16 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -38,9 +43,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - 9KqlMq3gTLpkJSVJyvAwXe8+x8jjzLiadKiJ+urXt2iPIG7RDD8GegNJYYpRqZOo + - kqXz3OvR7iajEJOdRFWpzJtcDHRumYwGfjdF12Vd65Xt1uV9T6lEO/K0lkxmcRvl X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -50,12 +55,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567888","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567888","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -66,13 +75,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:10 GMT + - Thu, 30 Apr 2020 17:36:18 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:09 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:17 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -81,9 +90,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - JEThRmJp6qTNp8pxXQqPpRD40l23OvSASz6GutTWG+aCw+n9cF/5KqfPSziGHWsU + - ldNaA6dSEPDapjFoBolZNm9KKT/3iEJM/Q1IyMe2D0P7l2S/rGI4bTGzxgP0/9Zs X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -93,12 +102,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567888","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567888","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -109,13 +122,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:12 GMT + - Thu, 30 Apr 2020 17:36:19 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:10 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:18 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -124,9 +137,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - vlc9b/rJPByGsV/acj3ScS7B1lo9nEAbSgYCfkl0GH3egry4iXeiGBP0WX8DpJ/T + - QpzDmIoaO5Hufx014PqM5BuLw+G9k75nLqy12TEr4Iab1Fl7hIFT5DrERoBer8OF X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -136,12 +149,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567888","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567888","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -152,13 +169,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:13 GMT + - Thu, 30 Apr 2020 17:36:19 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:12 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:19 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -167,9 +184,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - GG9N5JNk6zUo5YQ1gmfpF0kYcSj/kjDOsFItaODUS7qQCwsMrhI3QWJVQns7uvtI + - IkXBg4ZNMRmDsobzMjEa2v35+NuPiQI0gFmho/o6e7+hfyyJl3rjuklsE4uVJo7l X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -179,12 +196,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567888","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567888","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -195,13 +216,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:14 GMT + - Thu, 30 Apr 2020 17:36:20 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:13 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:19 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -210,9 +231,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - xNK8D8E4U1PyLMVOdDgzcc4izX6UzMbP9Ygv1jJl/dgpKsJQ0NHsqPPadJ+IsqEV + - Z91NUpPIZnIQ9h7lBFWBkEPGVUEsn4/i71imPPwrChu4RPI5uNM5HGuodISK1HBR X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -222,12 +243,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567888","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567888","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -238,13 +263,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:15 GMT + - Thu, 30 Apr 2020 17:36:20 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:14 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:20 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -253,9 +278,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - og1WGdy+2nV+rkkclmd3Cf2I26XhV3/6yjBeQCP8aHbH2k2cKwC+X9WmhIghcJ94 + - wB7h0Rt2IYxDUBLtoJ4y0ZOq10ZaMdDZiRuFZ3d/FUUtC7gfBEZWTs0Y6dZhoLZS X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -265,12 +290,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567888","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567888","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -281,13 +310,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:15 GMT + - Thu, 30 Apr 2020 17:36:22 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:15 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:20 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -296,22 +325,27 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - aHo5LNOt81r33IYjVJvAW38EarOXxgJiaRes9P/xhrf7FT81LvjEnVLCvw9iPn7T + - wNaVyRyNliLxKeX4pqFHOJTBG1dRCwo1/ihrnAf0GXtGNGahc1XK8Xzj/ssA3R20 X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK code: 200 duration: "" - request: - body: '{"account_id":"1234567888","role_name":"testacc-datadog-integration-role"}' + body: | + {"account_id":"1234567888","account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role"} form: {} headers: + Accept: + - application/json Content-Type: - application/json + Dd-Operation-Id: + - DeleteAWSAccount User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: DELETE response: @@ -328,22 +362,22 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:16 GMT + - Thu, 30 Apr 2020 17:36:23 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:16 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:22 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; X-Content-Type-Options: - nosniff X-Dd-Debug: - - vwiIwb5QepaQFIQrmPfIwwVWkQ/z0inFQwNEDjqDDy4v3CsF5qbv9dnyfb7UGzLf + - Xj/PwLDKe3Ll1QwGP2SdQuyUcOtG0YD60hQDJ9tPEhK9OEMHkSCPXdZRvPX0YYGO X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -353,8 +387,12 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: @@ -371,22 +409,22 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:17 GMT + - Thu, 30 Apr 2020 17:36:24 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:16 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:24 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; X-Content-Type-Options: - nosniff X-Dd-Debug: - - GAK1J4mJd/EBZfEK4rqUw9OeB9GOeKgSyrXGtzNUi5zrv5sHYU56xJgA4bcbtgUA + - ldNaA6dSEPDapjFoBolZNm9KKT/3iEJM/Q1IyMe2D0P7l2S/rGI4bTGzxgP0/9Zs X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK diff --git a/datadog/cassettes/TestAccDatadogIntegrationAWSLambdaArn.yaml b/datadog/cassettes/TestAccDatadogIntegrationAWSLambdaArn.yaml index 0683ee04ed..d784cbbcb3 100644 --- a/datadog/cassettes/TestAccDatadogIntegrationAWSLambdaArn.yaml +++ b/datadog/cassettes/TestAccDatadogIntegrationAWSLambdaArn.yaml @@ -2,17 +2,22 @@ version: 1 interactions: - request: - body: '{"account_id":"1234567890","role_name":"testacc-datadog-integration-role","filter_tags":[],"host_tags":[],"account_specific_namespace_rules":{}}' + body: | + {"account_id":"1234567890","account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role"} form: {} headers: + Accept: + - application/json Content-Type: - application/json + Dd-Operation-Id: + - CreateAWSAccount User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: POST response: - body: '{"external_id":"372110f7a826431fb3f46df4fc59af1d"}' + body: '{"external_id":"ac11ee0888464ca4baf0337ae4a09023"}' headers: Cache-Control: - no-cache @@ -23,13 +28,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:00 GMT + - Thu, 30 Apr 2020 17:35:46 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:28:58 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:43 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -38,9 +43,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - rxkz+JB0yzarEINDeNWQGs9dk7PLNAMnAw2wV8MNkZOhKDtz+JOpGuIyyBUaWwyF + - UH1aMdrlnlnaxy/K+HUi5QUN2T0FBtGPSUC8sLrviqCK1XXfgHsSO5DneAd5J+6F X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -50,12 +55,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -66,13 +75,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:01 GMT + - Thu, 30 Apr 2020 17:35:47 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:00 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:46 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -81,22 +90,27 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - /Ib6MMQTHlX0/jTb6tlEMzSZs2crLqjkGjYkoQ/zb0RHtMaXT744DZRFpy23W0oi + - yqCkAb2Y8/4OgTSGYvedTl/k5gsPukDI7OLTlGSm9adIbRDVlGb00Ve5DDv9ImFD X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK code: 200 duration: "" - request: - body: '{"account_id":"1234567890","lambda_arn":"arn:aws:lambda:us-east-1:1234567890:function:datadog-forwarder-Forwarder"}' + body: | + {"account_id":"1234567890","lambda_arn":"arn:aws:lambda:us-east-1:1234567890:function:datadog-forwarder-Forwarder"} form: {} headers: + Accept: + - application/json Content-Type: - application/json + Dd-Operation-Id: + - CreateAWSLambdaARN User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: POST response: @@ -113,22 +127,22 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:01 GMT + - Thu, 30 Apr 2020 17:35:47 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:01 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:47 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; X-Content-Type-Options: - nosniff X-Dd-Debug: - - gVnECQ7ifaEfJ6BNPsXSglLjlU41ay4U8jXHC6V3+oC4U6gHkBb20H5zrSJj1zee + - rxkz+JB0yzarEINDeNWQGs9dk7PLNAMnAw2wV8MNkZOhKDtz+JOpGuIyyBUaWwyF X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -138,8 +152,12 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSLogsIntegrations User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: @@ -154,13 +172,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:02 GMT + - Thu, 30 Apr 2020 17:35:47 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:02 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:47 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -169,9 +187,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - SaHvyR/hQzhMjBxXmmuM76vwlwfocpgL0LhX3u6R0CFONYqUGm7Xe/7/HyTliTFX + - XsUcj00kgZUn78/yrMgBc2B4U9QizwFFNtN2OKmtTvmSRTdL165j4Ltg6xvjCzDU X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -181,8 +199,12 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSLogsIntegrations User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: @@ -197,13 +219,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:02 GMT + - Thu, 30 Apr 2020 17:35:47 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:02 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:47 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -212,9 +234,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - NueLa2zkdBcl9S7BHrRuWyjAeR9iWgPFe330KTY6Cp0/yUhjUktbxu5rG2fG6gBk + - ucJMu0SEwqvJ36fqkYRsP+glKObktTtdBf6X17lKXJ4+xOn7nFKnx11beu1ycofn X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -224,12 +246,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -240,13 +266,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:03 GMT + - Thu, 30 Apr 2020 17:35:48 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:02 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:48 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -255,9 +281,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - gH++OYwf8a2QZXnzDsHHnXqPhHbI48oqNvFjE/0p0ObpMBY4290QCI5SB0tU0MAF + - gCSZ7BDMU1GjNFaR6hO6ZgwcgG3iOVugDLAlbR+YVBEuMFHhC330JIFkvjLveHm3 X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -267,12 +293,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -283,13 +313,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:04 GMT + - Thu, 30 Apr 2020 17:35:49 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:03 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:48 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -298,9 +328,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - x4pYHtiOW9rUeREgXmH2iIgBaXVGD7x1RIZUg56H0ghPppdtz0ZBEK6nMs8tuoqc + - l+fZq7vW9gg1qInAzXkJZdt8f8e/094RDnN9pOEIlkXbx1jb6kpjgt1+syYCZyFC X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -310,8 +340,12 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSLogsIntegrations User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: @@ -326,13 +360,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:04 GMT + - Thu, 30 Apr 2020 17:35:49 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:04 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:49 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -341,9 +375,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - UmZMvwWLI5lgbGFBnw6J7jqO5hwyrvVF8Un8TwZ8TRQQ6jetE/6GVTSaoSUmQWRg + - vwiIwb5QepaQFIQrmPfIwwVWkQ/z0inFQwNEDjqDDy4v3CsF5qbv9dnyfb7UGzLf X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -353,8 +387,12 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSLogsIntegrations User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: @@ -369,13 +407,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:04 GMT + - Thu, 30 Apr 2020 17:35:50 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:04 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:50 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -384,9 +422,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - mGJe6qmS66N9ddKWdHwHEzQK9VHuaMNr7+EsVTKliCkGq+ayJZmadUyCSwID4him + - IYH6Ubmq2MBSPq8ODr3BCv3hq6/qfjckWAQPmybeluQn4umf0be4fk6ceyy1pnBw X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -396,12 +434,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -412,13 +454,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:05 GMT + - Thu, 30 Apr 2020 17:35:51 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:05 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:50 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -427,9 +469,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - PKDIrz8Hcluof9oNzY3q1BouPTowe6nlZ4slm6KLsMEc/9DaK1hteKVCh6mza/IQ + - pT9LlAdgAzlrCUxMXQkBRs/Qti76jKIHng1uB0/SctAaYjB4WqOgOZYpCbOMQKll X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -439,12 +481,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -455,13 +501,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:06 GMT + - Thu, 30 Apr 2020 17:35:52 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:05 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:51 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -470,9 +516,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - oiF9oLqSEnBWpAh9z89c+Ruy9xKAqrdZzQPjGsNOxlGQNWaw3sCTSoKaMkMdPunL + - 2VXDwI2pcuhRZeQ6xt/fJh1koMYSfGcgQg5wAzgLqeh10Zf5/W946U7T5w6SEIhy X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -482,8 +528,12 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSLogsIntegrations User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: @@ -498,13 +548,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:06 GMT + - Thu, 30 Apr 2020 17:35:52 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:06 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:52 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -513,9 +563,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - bJj7D3RvHsKo+7eO3lrtPpPG0z8SsAwLw7bNfLb4htD+N9Ub8bD3AFgh45XaVsFM + - QgRGXxkxV9A4PZPYRoesCGgupw+m7xaD1r9nbJHgAaPeprYV0FnzI0EYYO7x6f4+ X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -525,8 +575,12 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSLogsIntegrations User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: @@ -541,13 +595,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:06 GMT + - Thu, 30 Apr 2020 17:35:52 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:06 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:52 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -556,22 +610,27 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - vLqqOLcWkbQm3aIBHfcEmIwzrJtjtqNdArlWt57BFwl8nfWymjIeK67csuZ1woEb + - nwn8Akm+cp12Jtby9xyfYjHWK2KZDWf5LxY+SMa+2NK6hVIBcKsVHXjynaTEG+o0 X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK code: 200 duration: "" - request: - body: '{"account_id":"1234567890","lambda_arn":"arn:aws:lambda:us-east-1:1234567890:function:datadog-forwarder-Forwarder"}' + body: | + {"account_id":"1234567890","lambda_arn":"arn:aws:lambda:us-east-1:1234567890:function:datadog-forwarder-Forwarder"} form: {} headers: + Accept: + - application/json Content-Type: - application/json + Dd-Operation-Id: + - DeleteAWSLambdaARN User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: DELETE response: @@ -588,35 +647,40 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:06 GMT + - Thu, 30 Apr 2020 17:35:52 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:06 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:52 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; X-Content-Type-Options: - nosniff X-Dd-Debug: - - IRAJ1mQ+c3epm0CLGtZoe/y8O4TCss3jYw+fwQOm7+eSKRCE+p3OtawVnIQ5ts76 + - Wpac2a5DsHa/eqG3DjQhOxPXeBQRcLxZ18fT3wn3gFeruJMdJwvfZxTA9hAiHLHZ X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK code: 200 duration: "" - request: - body: '{"account_id":"1234567890","role_name":"testacc-datadog-integration-role"}' + body: | + {"account_id":"1234567890","account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role"} form: {} headers: + Accept: + - application/json Content-Type: - application/json + Dd-Operation-Id: + - DeleteAWSAccount User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: DELETE response: @@ -633,22 +697,22 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:07 GMT + - Thu, 30 Apr 2020 17:36:04 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:06 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:35:53 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; X-Content-Type-Options: - nosniff X-Dd-Debug: - - 3OCRM/4FZbkllI4iloi1acHDABD1SJi2aj2fysEPLLsOVOk5Ki6mi6IOsVG7JIay + - IkXBg4ZNMRmDsobzMjEa2v35+NuPiQI0gFmho/o6e7+hfyyJl3rjuklsE4uVJo7l X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -658,8 +722,12 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSLogsIntegrations User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: @@ -674,13 +742,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 15:29:07 GMT + - Thu, 30 Apr 2020 17:36:04 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 15:29:07 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:04 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -689,9 +757,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - 69kiClanS8NcBSsdd51HHifvhQSGoRbJJjhU9l40yqxQHVNrndFN9zVtFJW1OcSf + - nDs7oXQtOYsvIIpPzuNZX0qDgGBu3ENkec7da4phztYl7kD88B7t5enRlUQmZVgO X-Dd-Version: - - "35.2282937" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK diff --git a/datadog/cassettes/TestAccDatadogIntegrationAWSLogCollection.yaml b/datadog/cassettes/TestAccDatadogIntegrationAWSLogCollection.yaml index 04fb9d83fd..a468fba489 100644 --- a/datadog/cassettes/TestAccDatadogIntegrationAWSLogCollection.yaml +++ b/datadog/cassettes/TestAccDatadogIntegrationAWSLogCollection.yaml @@ -2,17 +2,22 @@ version: 1 interactions: - request: - body: '{"account_id":"1234567890","role_name":"testacc-datadog-integration-role","filter_tags":[],"host_tags":[],"account_specific_namespace_rules":{}}' + body: | + {"account_id":"1234567890","account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role"} form: {} headers: + Accept: + - application/json Content-Type: - application/json + Dd-Operation-Id: + - CreateAWSAccount User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: POST response: - body: '{"external_id":"f30492baff3a43c98527ba73ed8fc615"}' + body: '{"external_id":"7a4c3f9f1e064f21af2694e107a28280"}' headers: Cache-Control: - no-cache @@ -23,13 +28,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:49 GMT + - Thu, 30 Apr 2020 17:36:06 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:48 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:05 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -38,9 +43,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - 6TICFxDFBNq65Lw6aA0hO1z7nxUSiTzUAT0k7ln4UasEU6/emXomwtYWMJdIuxUV + - MZCX71FNdAUQ6AMWRBKW1fkNpiPTypOoXE57zLYE3lG5gigqB2nroYJ/8uMn9muy X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -50,12 +55,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -66,13 +75,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:50 GMT + - Thu, 30 Apr 2020 17:36:07 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:49 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:07 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -81,9 +90,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - o1rjyOSbDnvYaQgtO33vwWSNsIwHafzLqam2amG/PbTP69SVY965ZpWutdoYJB30 + - bZImwKnIO3sUAXCuyRs9fWaEMDsBOTeSFh5dFNajdvBKpGDGzy05mj4PBPSf18hx X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -96,7 +105,7 @@ interactions: Content-Type: - application/json User-Agent: - - Datadog/dev/terraform (go1.13.4) + - Datadog/dev/terraform (go1.13) url: https://api.datadoghq.com/api/v1/integration/aws/logs/services method: POST response: @@ -113,22 +122,22 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:50 GMT + - Thu, 30 Apr 2020 17:36:08 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:50 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:07 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; X-Content-Type-Options: - nosniff X-Dd-Debug: - - QgRGXxkxV9A4PZPYRoesCGgupw+m7xaD1r9nbJHgAaPeprYV0FnzI0EYYO7x6f4+ + - xKFgbVhCHArG4Y0sXMtZ5P8r3tuxi63adTKFxNzM7f4aJAAu82zS1Bp7ak9HjM4Y X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -139,7 +148,7 @@ interactions: form: {} headers: User-Agent: - - Datadog/dev/terraform (go1.13.4) + - Datadog/dev/terraform (go1.13) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: @@ -154,13 +163,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:50 GMT + - Thu, 30 Apr 2020 17:36:08 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:50 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:08 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -169,9 +178,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - KHJbOoqp3I4BOBzIFnc/Ois3eg3Rjmudy0YalRpnXQEDXDoppykpDMDaJPIufi9t + - OdMYjD4Lcx2EOYJ2NSqLNRIyMqxNYyUQxCcT6zY9ZmZ+zl9yipXz0nuLjH5hVxTY X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -182,7 +191,7 @@ interactions: form: {} headers: User-Agent: - - Datadog/dev/terraform (go1.13.4) + - Datadog/dev/terraform (go1.13) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: @@ -197,13 +206,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:51 GMT + - Thu, 30 Apr 2020 17:36:08 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:51 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:08 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -212,9 +221,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - Wi4QF3nhe5s0sRyfZvyTHLc/3mQu/jJVn8BZnev44SXt+VBNA1+haKi5VcNZFpaP + - KKQq2SiaDLpychKSp47ffvU6SRxUV+VzBWr187ESkULBuGOI+kREfb/2NCy8DAWC X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -224,12 +233,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -240,13 +253,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:52 GMT + - Thu, 30 Apr 2020 17:36:09 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:51 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:08 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -255,9 +268,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - Wpac2a5DsHa/eqG3DjQhOxPXeBQRcLxZ18fT3wn3gFeruJMdJwvfZxTA9hAiHLHZ + - HIunaScoW4AWw8tnSbk8zc5V6c9XLV6++/KbgzaC4HIb212+evjUYL1yRLeLtS2T X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -267,12 +280,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -283,13 +300,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:52 GMT + - Thu, 30 Apr 2020 17:36:10 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:52 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:09 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -298,9 +315,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - og1WGdy+2nV+rkkclmd3Cf2I26XhV3/6yjBeQCP8aHbH2k2cKwC+X9WmhIghcJ94 + - QgRGXxkxV9A4PZPYRoesCGgupw+m7xaD1r9nbJHgAaPeprYV0FnzI0EYYO7x6f4+ X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -311,7 +328,7 @@ interactions: form: {} headers: User-Agent: - - Datadog/dev/terraform (go1.13.4) + - Datadog/dev/terraform (go1.13) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: @@ -326,13 +343,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:52 GMT + - Thu, 30 Apr 2020 17:36:10 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:52 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:10 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -341,9 +358,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - Xj/PwLDKe3Ll1QwGP2SdQuyUcOtG0YD60hQDJ9tPEhK9OEMHkSCPXdZRvPX0YYGO + - vLqqOLcWkbQm3aIBHfcEmIwzrJtjtqNdArlWt57BFwl8nfWymjIeK67csuZ1woEb X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -354,7 +371,7 @@ interactions: form: {} headers: User-Agent: - - Datadog/dev/terraform (go1.13.4) + - Datadog/dev/terraform (go1.13) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: @@ -369,13 +386,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:52 GMT + - Thu, 30 Apr 2020 17:36:10 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:52 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:10 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -384,9 +401,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - OGWvqyuIWnbl6WkXpkkRXBvKLURJhdDx+xXZ6vxnnyjZzYdefkAlNGOfG85GcOUu + - pdoE+6MDHF3ASB0y6TdRZq9HO/3uAKc0XPY7EkyNyaFqpXeeAHwz2Ce2QWIN714X X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -396,12 +413,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -412,13 +433,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:53 GMT + - Thu, 30 Apr 2020 17:36:11 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:52 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:10 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -427,9 +448,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - j9H0Mt41m875GBjR2i9r831ZILGOU6+Jata5+JJkOQgIsO+SrMkmgWN80SCun0Sk + - skwclWwYkKW38qisoeAm0+G71HHbXaQZSRP+zaGh2pZ7dRVTlLXlAp6DZVg5jg4x X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -439,12 +460,16 @@ interactions: body: "" form: {} headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: GET response: - body: '{"accounts":[{"errors":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role","filter_tags":[]}]}' + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' headers: Cache-Control: - no-cache @@ -455,13 +480,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:53 GMT + - Thu, 30 Apr 2020 17:36:12 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:53 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:11 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -470,9 +495,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - 2VXDwI2pcuhRZeQ6xt/fJh1koMYSfGcgQg5wAzgLqeh10Zf5/W946U7T5w6SEIhy + - PmDXJXCpOnq24qtagNCLPTUoILSRgi3DGaXUca70kUEAM8DZBLYkwSVilYSYEHCG X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -483,7 +508,7 @@ interactions: form: {} headers: User-Agent: - - Datadog/dev/terraform (go1.13.4) + - Datadog/dev/terraform (go1.13) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: @@ -498,13 +523,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:54 GMT + - Thu, 30 Apr 2020 17:36:12 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:54 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:12 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -513,9 +538,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - x4pYHtiOW9rUeREgXmH2iIgBaXVGD7x1RIZUg56H0ghPppdtz0ZBEK6nMs8tuoqc + - sAPKocoLMDEnM5qY2PL6SCQ+dkENYAR/6IistAQ5iiTU/UnJHAba158nxOvVRvKJ X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -526,7 +551,7 @@ interactions: form: {} headers: User-Agent: - - Datadog/dev/terraform (go1.13.4) + - Datadog/dev/terraform (go1.13) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: @@ -541,13 +566,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:54 GMT + - Thu, 30 Apr 2020 17:36:12 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:54 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:12 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -556,9 +581,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - Dpx7DG2N4VEOVm8I4W97n4HwOzBXFJSj1QrKca/nHpAZ6o7/LrJ0o2qyQx0XjNXl + - YNGrI7M9aLfuf6Npp7n/51e6xDtYCO9Rm/LB+HGbX4I6A/e7rnC+cgQxIZnsU+fj X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -571,7 +596,7 @@ interactions: Content-Type: - application/json User-Agent: - - Datadog/dev/terraform (go1.13.4) + - Datadog/dev/terraform (go1.13) url: https://api.datadoghq.com/api/v1/integration/aws/logs/services method: POST response: @@ -588,35 +613,40 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:54 GMT + - Thu, 30 Apr 2020 17:36:13 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:54 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:12 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; X-Content-Type-Options: - nosniff X-Dd-Debug: - - sAPKocoLMDEnM5qY2PL6SCQ+dkENYAR/6IistAQ5iiTU/UnJHAba158nxOvVRvKJ + - gCSZ7BDMU1GjNFaR6hO6ZgwcgG3iOVugDLAlbR+YVBEuMFHhC330JIFkvjLveHm3 X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK code: 200 duration: "" - request: - body: '{"account_id":"1234567890","role_name":"testacc-datadog-integration-role"}' + body: | + {"account_id":"1234567890","account_specific_namespace_rules":{},"role_name":"testacc-datadog-integration-role"} form: {} headers: + Accept: + - application/json Content-Type: - application/json + Dd-Operation-Id: + - DeleteAWSAccount User-Agent: - - Datadog/dev/terraform (go1.13.4) + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) url: https://api.datadoghq.com/api/v1/integration/aws method: DELETE response: @@ -633,22 +663,22 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:55 GMT + - Thu, 30 Apr 2020 17:36:15 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:54 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:13 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; X-Content-Type-Options: - nosniff X-Dd-Debug: - - +24qoGfe5Pp4qbS1m8KO9qioq2P4fxuj80XQhtr/9vInDLECmYZT0VSsbqISZgqC + - DAk/CQntZmry+u4cYsuVOELuKFo1I3NzKRNwPlY9WvlbH+rffk5VylB8tKDaSRWP X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -659,7 +689,7 @@ interactions: form: {} headers: User-Agent: - - Datadog/dev/terraform (go1.13.4) + - Datadog/dev/terraform (go1.13) url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: @@ -674,13 +704,13 @@ interactions: Content-Type: - application/json Date: - - Mon, 16 Mar 2020 17:55:55 GMT + - Thu, 30 Apr 2020 17:36:15 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=179; Max-Age=604800; Path=/; expires=Mon, 23-Mar-2020 17:55:55 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 07-May-2020 17:36:15 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -689,9 +719,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - vlc9b/rJPByGsV/acj3ScS7B1lo9nEAbSgYCfkl0GH3egry4iXeiGBP0WX8DpJ/T + - aERr2Ftx8O/BR8oAhSymZ3bVROQEC+81YMSphOQK1me4DxXSbMIcFkB0Di4ggZ++ X-Dd-Version: - - "35.2283769" + - "35.2453033" X-Frame-Options: - SAMEORIGIN status: 200 OK diff --git a/datadog/resource_datadog_integration_aws.go b/datadog/resource_datadog_integration_aws.go index f16ef28fcc..d2013d8034 100644 --- a/datadog/resource_datadog_integration_aws.go +++ b/datadog/resource_datadog_integration_aws.go @@ -102,6 +102,7 @@ func resourceDatadogIntegrationAwsPrepareCreateRequest(d *schema.ResourceData, a for _, s := range attr.([]interface{}) { filterTags = append(filterTags, s.(string)) } + iaws.SetFilterTags(filterTags) } var hostTags []string @@ -110,6 +111,7 @@ func resourceDatadogIntegrationAwsPrepareCreateRequest(d *schema.ResourceData, a for _, s := range attr.([]interface{}) { hostTags = append(hostTags, s.(string)) } + iaws.SetHostTags(hostTags) } accountSpecificNamespaceRules := make(map[string]bool) @@ -120,8 +122,7 @@ func resourceDatadogIntegrationAwsPrepareCreateRequest(d *schema.ResourceData, a accountSpecificNamespaceRules[k] = v.(bool) } } - iaws.SetFilterTags(filterTags) - iaws.SetHostTags(hostTags) + iaws.SetAccountSpecificNamespaceRules(accountSpecificNamespaceRules) return iaws } diff --git a/datadog/resource_datadog_integration_aws_test.go b/datadog/resource_datadog_integration_aws_test.go index 8f9ad9a451..19b74de45b 100644 --- a/datadog/resource_datadog_integration_aws_test.go +++ b/datadog/resource_datadog_integration_aws_test.go @@ -1,12 +1,14 @@ package datadog import ( + "context" "fmt" + "testing" + + datadogV1 "github.com/DataDog/datadog-api-client-go/api/v1/datadog" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/terraform" - "github.com/zorkian/go-datadog-api" - "testing" ) func TestAccountAndRoleFromID(t *testing.T) { @@ -76,21 +78,22 @@ func TestAccDatadogIntegrationAWS(t *testing.T) { func checkIntegrationAWSExists(accProvider *schema.Provider) func(*terraform.State) error { return func(s *terraform.State) error { providerConf := accProvider.Meta().(*ProviderConfiguration) - client := providerConf.CommunityClient + datadogClientV1 := providerConf.DatadogClientV1 + authV1 := providerConf.AuthV1 - return checkIntegrationAWSExistsHelper(s, client) + return checkIntegrationAWSExistsHelper(authV1, s, datadogClientV1) } } -func checkIntegrationAWSExistsHelper(s *terraform.State, client *datadog.Client) error { - integrations, err := client.GetIntegrationAWS() +func checkIntegrationAWSExistsHelper(authV1 context.Context, s *terraform.State, datadogClientV1 *datadogV1.APIClient) error { + integrations, _, err := datadogClientV1.AWSIntegrationApi.ListAWSAccounts(authV1).Execute() if err != nil { return err } for _, r := range s.RootModule().Resources { accountId := r.Primary.Attributes["account_id"] - for _, integration := range *integrations { - if *integration.AccountID == accountId { + for _, account := range integrations.GetAccounts() { + if account.GetAccountId() == accountId { return nil } } @@ -102,21 +105,22 @@ func checkIntegrationAWSExistsHelper(s *terraform.State, client *datadog.Client) func checkIntegrationAWSDestroy(accProvider *schema.Provider) func(*terraform.State) error { return func(s *terraform.State) error { providerConf := accProvider.Meta().(*ProviderConfiguration) - client := providerConf.CommunityClient + datadogClientV1 := providerConf.DatadogClientV1 + authV1 := providerConf.AuthV1 - return checkIntegrationAWSDestroyHelper(s, client) + return checkIntegrationAWSDestroyHelper(authV1, s, datadogClientV1) } } -func checkIntegrationAWSDestroyHelper(s *terraform.State, client *datadog.Client) error { - integrations, err := client.GetIntegrationAWS() +func checkIntegrationAWSDestroyHelper(authV1 context.Context, s *terraform.State, datadogClientV1 *datadogV1.APIClient) error { + integrations, _, err := datadogClientV1.AWSIntegrationApi.ListAWSAccounts(authV1).Execute() if err != nil { return err } for _, r := range s.RootModule().Resources { accountId := r.Primary.Attributes["account_id"] - for _, integration := range *integrations { - if *integration.AccountID == accountId { + for _, account := range integrations.GetAccounts() { + if account.GetAccountId() == accountId { return fmt.Errorf("The AWS integration still exists for account: accountId=%s", accountId) } } From 7d039e6a4869e7cdaf95547a681a262185697e79 Mon Sep 17 00:00:00 2001 From: Gregory Date: Thu, 7 May 2020 15:27:06 +0200 Subject: [PATCH 3/6] clean u --- datadog/resource_datadog_integration_aws.go | 1 + 1 file changed, 1 insertion(+) diff --git a/datadog/resource_datadog_integration_aws.go b/datadog/resource_datadog_integration_aws.go index c4efb30b2e..030703bd89 100644 --- a/datadog/resource_datadog_integration_aws.go +++ b/datadog/resource_datadog_integration_aws.go @@ -122,6 +122,7 @@ func buildDatadogIntegrationAwsStruct(d *schema.ResourceData, accountID string, } iaws.SetAccountSpecificNamespaceRules(accountSpecificNamespaceRules) } + return iaws } From a8b6962fc592fc6078e44269a813259a0b7263be Mon Sep 17 00:00:00 2001 From: Gregory Date: Thu, 7 May 2020 15:36:36 +0200 Subject: [PATCH 4/6] use getters --- datadog/resource_datadog_integration_aws_lambda_arn.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datadog/resource_datadog_integration_aws_lambda_arn.go b/datadog/resource_datadog_integration_aws_lambda_arn.go index 57356a4e6c..eb666bf372 100644 --- a/datadog/resource_datadog_integration_aws_lambda_arn.go +++ b/datadog/resource_datadog_integration_aws_lambda_arn.go @@ -89,7 +89,7 @@ func resourceDatadogIntegrationAwsLambdaArnCreate(d *schema.ResourceData, meta i return translateClientError(err, "error attaching Lambda ARN to AWS integration account") } - d.SetId(fmt.Sprintf("%s %s", attachLambdaArnRequest.AccountId, attachLambdaArnRequest.LambdaArn)) + d.SetId(fmt.Sprintf("%s %s", attachLambdaArnRequest.GetAccountId(), attachLambdaArnRequest.GetLambdaArn())) return resourceDatadogIntegrationAwsLambdaArnRead(d, meta) } From 5d5e98b771e01318f627a5f53e79d4313a6a982f Mon Sep 17 00:00:00 2001 From: Gregory Date: Fri, 8 May 2020 09:19:30 +0200 Subject: [PATCH 5/6] new cassette ; : --- ...AccDatadogIntegrationAWSLogCollection.yaml | 415 ++++++++++++++++-- 1 file changed, 373 insertions(+), 42 deletions(-) diff --git a/datadog/cassettes/TestAccDatadogIntegrationAWSLogCollection.yaml b/datadog/cassettes/TestAccDatadogIntegrationAWSLogCollection.yaml index fabca29019..71d0624e9e 100644 --- a/datadog/cassettes/TestAccDatadogIntegrationAWSLogCollection.yaml +++ b/datadog/cassettes/TestAccDatadogIntegrationAWSLogCollection.yaml @@ -17,7 +17,7 @@ interactions: url: https://api.datadoghq.com/api/v1/integration/aws method: POST response: - body: '{"external_id":"fc32d64ab78a45608447e417edaa390a"}' + body: '{"external_id":"ab4a716d1c704c1a98f6d3100b95d7d6"}' headers: Cache-Control: - no-cache @@ -28,13 +28,13 @@ interactions: Content-Type: - application/json Date: - - Thu, 07 May 2020 12:22:59 GMT + - Fri, 08 May 2020 07:16:05 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 14-May-2020 12:22:57 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:04 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -43,9 +43,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - yqCkAb2Y8/4OgTSGYvedTl/k5gsPukDI7OLTlGSm9adIbRDVlGb00Ve5DDv9ImFD + - pEDVi2191MvoIMwusdL+COAxndBmcRhJtxAtWxDDnECWDI8Z99hIoBZbpR57tJKz X-Dd-Version: - - "35.2476680" + - "35.2479740" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -75,13 +75,13 @@ interactions: Content-Type: - application/json Date: - - Thu, 07 May 2020 12:23:00 GMT + - Fri, 08 May 2020 07:16:06 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 14-May-2020 12:22:59 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:05 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -90,9 +90,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - oQ/oy4ezTZ+/WzL4afBMlDjLd5w62e5H15hF5BJChw1Gte+Sq8B8tB7i6vlTiLL0 + - 1/ye/L7/S9djtmh0CDbapYOAoYP2Xz5NE904aTai4cgQw/Kmmv343hpHqBIP3PC5 X-Dd-Version: - - "35.2476680" + - "35.2479740" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -114,25 +114,71 @@ interactions: url: https://api.datadoghq.com/api/v1/integration/aws/logs/services method: POST response: - body: '{"status":"error","errors":[{"message":"AWS account 1234567890 has no lambda - config to update","code":"no_such_config"}]}' + body: '{}' headers: Cache-Control: - no-cache Connection: - keep-alive + Content-Length: + - "2" Content-Security-Policy: - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report Content-Type: - application/json Date: - - Thu, 07 May 2020 12:23:00 GMT + - Fri, 08 May 2020 07:16:06 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 14-May-2020 12:23:00 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:06 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - JEThRmJp6qTNp8pxXQqPpRD40l23OvSASz6GutTWG+aCw+n9cF/5KqfPSziGHWsU + X-Dd-Version: + - "35.2479740" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSLogsIntegrations + User-Agent: + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/integration/aws/logs + method: GET + response: + body: '[{"services":["lambda"],"account_id":"1234567890","lambdas":[]}]' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 08 May 2020 07:16:07 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:07 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -141,9 +187,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - CFSDBBie5Okt4N1oWVJNTAqpt778eCo7VQZ0NhVFWw8MHYFUwuA7DURhpFRYY+Wy + - J7vOWsxZd7Grxzg2TIaQpn2nGjrOScgI4Kwzur8V2oOTYInX6xbVT4leinNkGLPk X-Dd-Version: - - "35.2476680" + - "35.2479740" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -162,7 +208,7 @@ interactions: url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: - body: '[{"services":["s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"go_770660668","lambdas":[{"arn":"arn:aws:lambda:us-east-1:123456789101:function:GoClientTest"}]},{"services":["s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"go_647547415","lambdas":[]},{"services":["s3","elb","elbv2","cloudfront","redshift","lambda","s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"java_3298598","lambdas":[]},{"services":["s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"go_352373262","lambdas":[{"arn":"arn:aws:lambda:us-east-1:123456789101:function:GoClientTest"}]},{"services":["s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"go_853343891","lambdas":[]}]' + body: '[{"services":["lambda"],"account_id":"1234567890","lambdas":[]}]' headers: Cache-Control: - no-cache @@ -173,13 +219,13 @@ interactions: Content-Type: - application/json Date: - - Thu, 07 May 2020 12:23:00 GMT + - Fri, 08 May 2020 07:16:07 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 14-May-2020 12:23:00 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:07 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -188,9 +234,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - Iy6HNgrdx6jplabT1ZfQVzkCrk+jqjHEQw0NvfR/5Sb/NsvSUgBv2AbCahJdaB7p + - sAPKocoLMDEnM5qY2PL6SCQ+dkENYAR/6IistAQ5iiTU/UnJHAba158nxOvVRvKJ X-Dd-Version: - - "35.2476680" + - "35.2479740" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -220,13 +266,13 @@ interactions: Content-Type: - application/json Date: - - Thu, 07 May 2020 12:23:01 GMT + - Fri, 08 May 2020 07:16:09 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 14-May-2020 12:23:00 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:08 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -235,9 +281,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - gVnECQ7ifaEfJ6BNPsXSglLjlU41ay4U8jXHC6V3+oC4U6gHkBb20H5zrSJj1zee + - RngFxOd8mVeT14auLfzsH/6kz142QLoKkYXZjfmXpXDkZ/eN6uoCM3cTScXuFEa0 X-Dd-Version: - - "35.2476554" + - "35.2479740" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -267,13 +313,13 @@ interactions: Content-Type: - application/json Date: - - Thu, 07 May 2020 12:23:01 GMT + - Fri, 08 May 2020 07:16:10 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 14-May-2020 12:23:01 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:10 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -282,9 +328,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - 2VXDwI2pcuhRZeQ6xt/fJh1koMYSfGcgQg5wAzgLqeh10Zf5/W946U7T5w6SEIhy + - OxP+mFpjAbASiVhNf+t4MttAs95ZlMiGosIRnYJJGFoApNgv2oxtdzpnmNlMOki6 X-Dd-Version: - - "35.2476554" + - "35.2479740" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -303,7 +349,7 @@ interactions: url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: - body: '[{"services":["s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"go_770660668","lambdas":[{"arn":"arn:aws:lambda:us-east-1:123456789101:function:GoClientTest"}]},{"services":["s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"go_647547415","lambdas":[]},{"services":["s3","elb","elbv2","cloudfront","redshift","lambda","s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"java_3298598","lambdas":[]},{"services":["s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"go_352373262","lambdas":[{"arn":"arn:aws:lambda:us-east-1:123456789101:function:GoClientTest"}]},{"services":["s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"go_853343891","lambdas":[]}]' + body: '[{"services":["lambda"],"account_id":"1234567890","lambdas":[]}]' headers: Cache-Control: - no-cache @@ -314,13 +360,13 @@ interactions: Content-Type: - application/json Date: - - Thu, 07 May 2020 12:23:01 GMT + - Fri, 08 May 2020 07:16:11 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 14-May-2020 12:23:01 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:11 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -329,9 +375,294 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - jety+2H6BA1H4x31+wzy5BjqI2NDwh54fgbjSYyrLU0p2tWQPCCTKspX7sHO7u1n + - Lo9psmCk9egobltaxBGqrQFhgCcgUTQoFZpr2xiSR+6tucB/owychJvFjr9YMWzu X-Dd-Version: - - "35.2476554" + - "35.2479740" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSLogsIntegrations + User-Agent: + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/integration/aws/logs + method: GET + response: + body: '[{"services":["lambda"],"account_id":"1234567890","lambdas":[]}]' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 08 May 2020 07:16:11 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:11 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - sAPKocoLMDEnM5qY2PL6SCQ+dkENYAR/6IistAQ5iiTU/UnJHAba158nxOvVRvKJ + X-Dd-Version: + - "35.2479740" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts + User-Agent: + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/integration/aws + method: GET + response: + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 08 May 2020 07:16:12 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:11 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - QpzDmIoaO5Hufx014PqM5BuLw+G9k75nLqy12TEr4Iab1Fl7hIFT5DrERoBer8OF + X-Dd-Version: + - "35.2479740" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSAccounts + User-Agent: + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/integration/aws + method: GET + response: + body: '{"accounts":[{"role_name":"testacc-datadog-integration-role","excluded_regions":[],"account_id":"1234567890","host_tags":[],"account_specific_namespace_rules":{},"errors":[],"filter_tags":[]}]}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 08 May 2020 07:16:13 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:12 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - HIunaScoW4AWw8tnSbk8zc5V6c9XLV6++/KbgzaC4HIb212+evjUYL1yRLeLtS2T + X-Dd-Version: + - "35.2479740" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSLogsIntegrations + User-Agent: + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/integration/aws/logs + method: GET + response: + body: '[{"services":["lambda"],"account_id":"1234567890","lambdas":[]}]' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 08 May 2020 07:16:13 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:13 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - btzHvL7Rg/f/n1wMP2CFVXsuErrwOO9p2hvsBofLQbxzRkmZbfvXcB18pURNtIOI + X-Dd-Version: + - "35.2479740" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - ListAWSLogsIntegrations + User-Agent: + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/integration/aws/logs + method: GET + response: + body: '[{"services":["lambda"],"account_id":"1234567890","lambdas":[]}]' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 08 May 2020 07:16:17 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:17 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - GG9N5JNk6zUo5YQ1gmfpF0kYcSj/kjDOsFItaODUS7qQCwsMrhI3QWJVQns7uvtI + X-Dd-Version: + - "35.2479740" + X-Frame-Options: + - SAMEORIGIN + status: 200 OK + code: 200 + duration: "" +- request: + body: | + {"account_id":"1234567890","services":[]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + Dd-Operation-Id: + - EnableAWSLogServices + User-Agent: + - datadog-api-client-go/1.0.0-beta.1+dev.1 (go go1.13; os darwin; arch amd64) + url: https://api.datadoghq.com/api/v1/integration/aws/logs/services + method: POST + response: + body: '{}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Length: + - "2" + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Fri, 08 May 2020 07:16:17 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:17 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - 2VXDwI2pcuhRZeQ6xt/fJh1koMYSfGcgQg5wAzgLqeh10Zf5/W946U7T5w6SEIhy + X-Dd-Version: + - "35.2479740" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -366,22 +697,22 @@ interactions: Content-Type: - application/json Date: - - Thu, 07 May 2020 12:23:02 GMT + - Fri, 08 May 2020 07:16:18 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 14-May-2020 12:23:01 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:18 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; X-Content-Type-Options: - nosniff X-Dd-Debug: - - sAPKocoLMDEnM5qY2PL6SCQ+dkENYAR/6IistAQ5iiTU/UnJHAba158nxOvVRvKJ + - NueLa2zkdBcl9S7BHrRuWyjAeR9iWgPFe330KTY6Cp0/yUhjUktbxu5rG2fG6gBk X-Dd-Version: - - "35.2476554" + - "35.2479740" X-Frame-Options: - SAMEORIGIN status: 200 OK @@ -400,7 +731,7 @@ interactions: url: https://api.datadoghq.com/api/v1/integration/aws/logs method: GET response: - body: '[{"services":["s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"go_770660668","lambdas":[{"arn":"arn:aws:lambda:us-east-1:123456789101:function:GoClientTest"}]},{"services":["s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"go_647547415","lambdas":[]},{"services":["s3","elb","elbv2","cloudfront","redshift","lambda","s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"java_3298598","lambdas":[]},{"services":["s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"go_352373262","lambdas":[{"arn":"arn:aws:lambda:us-east-1:123456789101:function:GoClientTest"}]},{"services":["s3","elb","elbv2","cloudfront","redshift","lambda"],"account_id":"go_853343891","lambdas":[]}]' + body: '[{"services":[],"account_id":"1234567890","lambdas":[]}]' headers: Cache-Control: - no-cache @@ -411,13 +742,13 @@ interactions: Content-Type: - application/json Date: - - Thu, 07 May 2020 12:23:02 GMT + - Fri, 08 May 2020 07:16:19 GMT Dd-Pool: - dogweb Pragma: - no-cache Set-Cookie: - - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Thu, 14-May-2020 12:23:02 GMT; + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Fri, 15-May-2020 07:16:18 GMT; secure; HttpOnly Strict-Transport-Security: - max-age=15724800; @@ -426,9 +757,9 @@ interactions: X-Content-Type-Options: - nosniff X-Dd-Debug: - - aiFdvD+ESSGWQuLeXGShIAaySBrTSq6aZf+crfPnDVFrMRUU9f0HobLUCBopvakz + - IRAJ1mQ+c3epm0CLGtZoe/y8O4TCss3jYw+fwQOm7+eSKRCE+p3OtawVnIQ5ts76 X-Dd-Version: - - "35.2476554" + - "35.2479740" X-Frame-Options: - SAMEORIGIN status: 200 OK From 907ea814c471e2a4ae02d5a8872f7777a80134c3 Mon Sep 17 00:00:00 2001 From: Gregory Date: Fri, 8 May 2020 09:42:55 +0200 Subject: [PATCH 6/6] fix tests --- datadog/resource_datadog_monitor.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/datadog/resource_datadog_monitor.go b/datadog/resource_datadog_monitor.go index 34e53eb03f..ed000c3b06 100644 --- a/datadog/resource_datadog_monitor.go +++ b/datadog/resource_datadog_monitor.go @@ -281,14 +281,7 @@ func buildMonitorStruct(d *schema.ResourceData) *datadogV1.Monitor { } monitorType := datadogV1.MonitorType(d.Get("type").(string)) - m := datadogV1.NewMonitor() - m.SetType(monitorType) - m.SetQuery(d.Get("query").(string)) - m.SetName(d.Get("name").(string)) - m.SetMessage(d.Get("message").(string)) - m.SetOptions(o) - - if m.GetType() == datadogV1.MONITORTYPE_LOG_ALERT { + if monitorType == datadogV1.MONITORTYPE_LOG_ALERT { if attr, ok := d.GetOk("enable_logs_sample"); ok { o.SetEnableLogsSample(attr.(bool)) } else { @@ -296,6 +289,13 @@ func buildMonitorStruct(d *schema.ResourceData) *datadogV1.Monitor { } } + m := datadogV1.NewMonitor() + m.SetType(monitorType) + m.SetQuery(d.Get("query").(string)) + m.SetName(d.Get("name").(string)) + m.SetMessage(d.Get("message").(string)) + m.SetOptions(o) + tags := make([]string, 0) if attr, ok := d.GetOk("tags"); ok { for _, s := range attr.(*schema.Set).List() {