From 990fb3c0de4f471699718aa41762c82b82541f03 Mon Sep 17 00:00:00 2001 From: Jocelyn Giroux Date: Tue, 17 Oct 2017 12:24:08 -0400 Subject: [PATCH 0001/1054] Add support for metadata on s3 objects --- aws/resource_aws_s3_bucket_object.go | 16 ++++++++++++++++ website/docs/r/s3_bucket_object.html.markdown | 1 + 2 files changed, 17 insertions(+) diff --git a/aws/resource_aws_s3_bucket_object.go b/aws/resource_aws_s3_bucket_object.go index fb2791ce4a14..4022f5bc8f43 100644 --- a/aws/resource_aws_s3_bucket_object.go +++ b/aws/resource_aws_s3_bucket_object.go @@ -60,6 +60,11 @@ func resourceAwsS3BucketObject() *schema.Resource { Optional: true, }, + "metadata": &schema.Schema{ + Type: schema.TypeMap, + Optional: true, + }, + "content_type": { Type: schema.TypeString, Optional: true, @@ -177,6 +182,16 @@ func resourceAwsS3BucketObjectPut(d *schema.ResourceData, meta interface{}) erro putInput.ContentType = aws.String(v.(string)) } + if v, ok := d.GetOk("metadata"); ok { + meta := make(map[string]*string) + for key, value := range v.(map[string]interface{}) { + valueStr := fmt.Sprintf("%v", value) + meta[key] = &valueStr + } + + putInput.Metadata = meta + } + if v, ok := d.GetOk("content_encoding"); ok { putInput.ContentEncoding = aws.String(v.(string)) } @@ -258,6 +273,7 @@ func resourceAwsS3BucketObjectRead(d *schema.ResourceData, meta interface{}) err d.Set("content_encoding", resp.ContentEncoding) d.Set("content_language", resp.ContentLanguage) d.Set("content_type", resp.ContentType) + d.Set("metadata", pointersMapToStringList(resp.Metadata)) d.Set("version_id", resp.VersionId) d.Set("server_side_encryption", resp.ServerSideEncryption) d.Set("website_redirect", resp.WebsiteRedirectLocation) diff --git a/website/docs/r/s3_bucket_object.html.markdown b/website/docs/r/s3_bucket_object.html.markdown index b786238a5f69..356dfc187328 100644 --- a/website/docs/r/s3_bucket_object.html.markdown +++ b/website/docs/r/s3_bucket_object.html.markdown @@ -86,6 +86,7 @@ This attribute is not compatible with `kms_key_id`. This value is a fully qualified **ARN** of the KMS Key. If using `aws_kms_key`, use the exported `arn` attribute: `kms_key_id = "${aws_kms_key.foo.arn}"` +* `metadata` - (Optional) A mapping of keys/values to provision metadata (automatically prefixed by `x-amz-meta-`). * `tags` - (Optional) A mapping of tags to assign to the object. Either `source` or `content` must be provided to specify the bucket content. From 8165453729cc39918912a534d1b0be2608ecba20 Mon Sep 17 00:00:00 2001 From: Julien Duchesne Date: Fri, 10 Nov 2017 18:44:12 -0500 Subject: [PATCH 0002/1054] Write metadata as lower case --- aws/resource_aws_s3_bucket_object.go | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_s3_bucket_object.go b/aws/resource_aws_s3_bucket_object.go index 4022f5bc8f43..6564533073e7 100644 --- a/aws/resource_aws_s3_bucket_object.go +++ b/aws/resource_aws_s3_bucket_object.go @@ -61,8 +61,9 @@ func resourceAwsS3BucketObject() *schema.Resource { }, "metadata": &schema.Schema{ - Type: schema.TypeMap, - Optional: true, + Type: schema.TypeMap, + ValidateFunc: validateMetadataIsLowerCase, + Optional: true, }, "content_type": { @@ -273,7 +274,15 @@ func resourceAwsS3BucketObjectRead(d *schema.ResourceData, meta interface{}) err d.Set("content_encoding", resp.ContentEncoding) d.Set("content_language", resp.ContentLanguage) d.Set("content_type", resp.ContentType) - d.Set("metadata", pointersMapToStringList(resp.Metadata)) + metadata := pointersMapToStringList(resp.Metadata) + + // AWS Go SDK capitalizes metadata, this is a workaround. https://github.com/aws/aws-sdk-go/issues/445 + for k, v := range metadata { + delete(metadata, k) + metadata[strings.ToLower(k)] = v + } + + d.Set("metadata", metadata) d.Set("version_id", resp.VersionId) d.Set("server_side_encryption", resp.ServerSideEncryption) d.Set("website_redirect", resp.WebsiteRedirectLocation) @@ -431,3 +440,15 @@ func validateS3BucketObjectServerSideEncryption(v interface{}, k string) (ws []s } return } + +func validateMetadataIsLowerCase(v interface{}, k string) (ws []string, errors []error) { + value := v.(map[string]interface{}) + + for k := range value { + if k != strings.ToLower(k) { + errors = append(errors, fmt.Errorf( + "Metadata must be lowercase only. Offending key: %q", k)) + } + } + return +} From 6ac55c86ad092ec838699306b08e96ed0021881f Mon Sep 17 00:00:00 2001 From: Jocelyn Giroux Date: Fri, 10 Nov 2017 19:44:26 -0500 Subject: [PATCH 0003/1054] Adjust the documentation. --- website/docs/r/s3_bucket_object.html.markdown | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/website/docs/r/s3_bucket_object.html.markdown b/website/docs/r/s3_bucket_object.html.markdown index 356dfc187328..ab0fa766870e 100644 --- a/website/docs/r/s3_bucket_object.html.markdown +++ b/website/docs/r/s3_bucket_object.html.markdown @@ -77,16 +77,12 @@ The following arguments are supported: * `content_language` - (Optional) The language the content is in e.g. en-US or en-GB. * `content_type` - (Optional) A standard MIME type describing the format of the object data, e.g. application/octet-stream. All Valid MIME Types are valid for this input. * `website_redirect` - (Optional) Specifies a target URL for [website redirect](http://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html). -* `storage_class` - (Optional) Specifies the desired [Storage Class](http://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html) -for the object. Can be either "`STANDARD`", "`REDUCED_REDUNDANCY`", or "`STANDARD_IA`". Defaults to "`STANDARD`". -* `etag` - (Optional) Used to trigger updates. The only meaningful value is `${md5(file("path/to/file"))}`. -This attribute is not compatible with `kms_key_id`. +* `storage_class` - (Optional) Specifies the desired [Storage Class](http://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html) for the object. Can be either "`STANDARD`", "`REDUCED_REDUNDANCY`", or "`STANDARD_IA`". Defaults to "`STANDARD`". +* `etag` - (Optional) Used to trigger updates. The only meaningful value is `${md5(file("path/to/file"))}`. This attribute is not compatible with `kms_key_id`. * `server_side_encryption` - (Optional) Specifies server-side encryption of the object in S3. Valid values are "`AES256`" and "`aws:kms`". -* `kms_key_id` - (Optional) Specifies the AWS KMS Key ARN to use for object encryption. -This value is a fully qualified **ARN** of the KMS Key. If using `aws_kms_key`, -use the exported `arn` attribute: +* `kms_key_id` - (Optional) Specifies the AWS KMS Key ARN to use for object encryption. This value is a fully qualified **ARN** of the KMS Key. If using `aws_kms_key`, use the exported `arn` attribute: `kms_key_id = "${aws_kms_key.foo.arn}"` -* `metadata` - (Optional) A mapping of keys/values to provision metadata (automatically prefixed by `x-amz-meta-`). +* `metadata` - (Optional) A mapping of keys/values to provision metadata (will be automatically prefixed by `x-amz-meta-, note that only lowercase label are currently supported by the AWS Go API). * `tags` - (Optional) A mapping of tags to assign to the object. Either `source` or `content` must be provided to specify the bucket content. @@ -98,5 +94,4 @@ The following attributes are exported * `id` - the `key` of the resource supplied above * `etag` - the ETag generated for the object (an MD5 sum of the object content). -* `version_id` - A unique version ID value for the object, if bucket versioning -is enabled. +* `version_id` - A unique version ID value for the object, if bucket versioning is enabled. From 68d9d7daeca0dc8c64bfddfea6b90918304b2ce1 Mon Sep 17 00:00:00 2001 From: Gareth Oakley Date: Sun, 22 Apr 2018 19:07:33 +0100 Subject: [PATCH 0004/1054] r/aws_fms_admin_account: New resource --- aws/provider.go | 1 + aws/resource_aws_fms_admin_account.go | 132 +++++++++++++++++++++ aws/resource_aws_fms_admin_account_test.go | 108 +++++++++++++++++ website/aws.erb | 11 ++ website/docs/r/fms_admin_account.markdown | 33 ++++++ 5 files changed, 285 insertions(+) create mode 100644 aws/resource_aws_fms_admin_account.go create mode 100644 aws/resource_aws_fms_admin_account_test.go create mode 100644 website/docs/r/fms_admin_account.markdown diff --git a/aws/provider.go b/aws/provider.go index 851e1d7a3ae4..c8e289fce13b 100644 --- a/aws/provider.go +++ b/aws/provider.go @@ -377,6 +377,7 @@ func Provider() terraform.ResourceProvider { "aws_emr_instance_group": resourceAwsEMRInstanceGroup(), "aws_emr_security_configuration": resourceAwsEMRSecurityConfiguration(), "aws_flow_log": resourceAwsFlowLog(), + "aws_fms_admin_account": resourceAwsFmsAdminAccount(), "aws_gamelift_alias": resourceAwsGameliftAlias(), "aws_gamelift_build": resourceAwsGameliftBuild(), "aws_gamelift_fleet": resourceAwsGameliftFleet(), diff --git a/aws/resource_aws_fms_admin_account.go b/aws/resource_aws_fms_admin_account.go new file mode 100644 index 000000000000..90ba556cd2b3 --- /dev/null +++ b/aws/resource_aws_fms_admin_account.go @@ -0,0 +1,132 @@ +package aws + +import ( + "fmt" + "log" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/fms" + + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/helper/schema" +) + +func resourceAwsFmsAdminAccount() *schema.Resource { + return &schema.Resource{ + Create: resourceAwsFmsAdminAccountPut, + Read: resourceAwsFmsAdminAccountRead, + Delete: resourceAwsFmsAdminAccountDelete, + + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(1 * time.Minute), + }, + + Schema: map[string]*schema.Schema{ + "account_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validateAwsAccountId, + }, + }, + } +} + +func resourceAwsFmsAdminAccountPut(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).fmsconn + + accountId := meta.(*AWSClient).accountid + if v, ok := d.GetOk("account_id"); ok && v != "" { + accountId = v.(string) + } + + stateConf := &resource.StateChangeConf{ + Target: []string{accountId}, + Refresh: associateAdminAccountRefreshFunc(conn, accountId), + Timeout: d.Timeout(schema.TimeoutCreate), + Delay: 10 * time.Second, + MinTimeout: 3 * time.Second, + } + + log.Printf("[DEBUG] Waiting for firewall manager admin account association: %v", accountId) + _, sterr := stateConf.WaitForState() + if sterr != nil { + return fmt.Errorf("Error waiting for firewall manager admin account association (%s): %s", accountId, sterr) + } + + d.SetId(accountId) + return nil +} + +func associateAdminAccountRefreshFunc(conn *fms.FMS, accountId string) resource.StateRefreshFunc { + // This is all wrapped in a refresh func since AssociateAdminAccount returns + // success even though it failed if called too quickly after creating an organization + return func() (interface{}, string, error) { + req := &fms.AssociateAdminAccountInput{ + AdminAccount: aws.String(accountId), + } + + _, aserr := conn.AssociateAdminAccount(req) + if aserr != nil { + return nil, "", aserr + } + + res, err := conn.GetAdminAccount(&fms.GetAdminAccountInput{}) + if err != nil { + // FMS returns an AccessDeniedException if no account is associated, + // but does not define this in its error codes + if isAWSErr(err, "AccessDeniedException", "is not currently delegated by AWS FM") { + return nil, "", nil + } + return nil, "", err + } + return *res, *res.AdminAccount, err + } +} + +func resourceAwsFmsAdminAccountRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).fmsconn + + res, err := conn.GetAdminAccount(&fms.GetAdminAccountInput{}) + if err != nil { + // FMS returns an AccessDeniedException if no account is associated, + // but does not define this in its error codes + if isAWSErr(err, "AccessDeniedException", "is not currently delegated by AWS FM") { + log.Printf("[WARN] No associated firewall manager admin account found, removing from state: %s", d.Id()) + d.SetId("") + return nil + } + return err + } + + if d.Id() != aws.StringValue(res.AdminAccount) { + log.Printf("[WARN] FMS Admin Account does not match, removing from state: %s", d.Id()) + d.SetId("") + return nil + } + + d.Set("account_id", res.AdminAccount) + return nil +} + +func resourceAwsFmsAdminAccountDelete(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).fmsconn + + _, err := conn.DisassociateAdminAccount(&fms.DisassociateAdminAccountInput{}) + if err != nil { + // FMS returns an AccessDeniedException if no account is associated, + // but does not define this in its error codes + if isAWSErr(err, "AccessDeniedException", "is not currently delegated by AWS FM") { + log.Printf("[WARN] No associated firewall manager admin account found, removing from state: %s", d.Id()) + return nil + } + return fmt.Errorf("Error disassociating firewall manager admin account: %s", err) + } + + return nil +} diff --git a/aws/resource_aws_fms_admin_account_test.go b/aws/resource_aws_fms_admin_account_test.go new file mode 100644 index 000000000000..52e969831a3b --- /dev/null +++ b/aws/resource_aws_fms_admin_account_test.go @@ -0,0 +1,108 @@ +package aws + +import ( + "fmt" + "log" + "regexp" + "testing" + + "github.com/aws/aws-sdk-go/service/fms" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +func init() { + resource.AddTestSweepers("aws_fms_admin_account", &resource.Sweeper{ + Name: "aws_fms_admin_account", + F: testSweepFmsAdminAccount, + }) +} + +func testSweepFmsAdminAccount(region string) error { + client, err := sharedClientForRegion(region) + if err != nil { + return fmt.Errorf("Error getting client: %s", err) + } + conn := client.(*AWSClient).fmsconn + + _, err = conn.GetAdminAccount(&fms.GetAdminAccountInput{}) + if err != nil { + // FMS returns an AccessDeniedException if no account is associated, + // but does not define this in its error codes + if isAWSErr(err, "AccessDeniedException", "is not currently delegated by AWS FM") { + log.Print("[DEBUG] No associated firewall manager admin account to sweep") + return nil + } + return fmt.Errorf("Error retrieving firewall manager admin account: %s", err) + } + + _, err = conn.DisassociateAdminAccount(&fms.DisassociateAdminAccountInput{}) + if err != nil { + // FMS returns an AccessDeniedException if no account is associated, + // but does not define this in its error codes + if isAWSErr(err, "AccessDeniedException", "is not currently delegated by AWS FM") { + log.Print("[DEBUG] No associated firewall manager admin account to sweep") + return nil + } + return fmt.Errorf("Error disassociating firewall manager admin account: %s", err) + } + + return nil +} + +func TestAccFmsAdminAccount_basic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckFmsAdminAccountDestroy, + Steps: []resource.TestStep{ + { + Config: testAccFmsAdminAccountConfig_basic, + Check: resource.ComposeTestCheckFunc( + resource.TestMatchResourceAttr("aws_fms_admin_account.example", "account_id", regexp.MustCompile("^\\d{12}$")), + ), + }, + }, + }) +} + +func testAccCheckFmsAdminAccountDestroy(s *terraform.State) error { + conn := testAccProvider.Meta().(*AWSClient).fmsconn + + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_fms_admin_account" { + continue + } + + res, err := conn.GetAdminAccount(&fms.GetAdminAccountInput{}) + if err != nil { + // FMS returns an AccessDeniedException if no account is associated, + // but does not define this in its error codes + if isAWSErr(err, "AccessDeniedException", "is not currently delegated by AWS FM") { + log.Print("[DEBUG] No associated firewall manager admin account") + return nil + } + } + + return fmt.Errorf("Firewall manager admin account still exists: %v", res.AdminAccount) + } + + return nil +} + +const testAccFmsAdminAccountConfig_basic = ` +provider "aws" { + region = "us-east-1" +} + +resource "aws_fms_admin_account" "example" { + depends_on = ["aws_organizations_organization.example"] + account_id = "${data.aws_caller_identity.current.account_id}" # Required +} + +resource "aws_organizations_organization" "example" { + feature_set = "ALL" +} + +data "aws_caller_identity" "current" {} +` diff --git a/website/aws.erb b/website/aws.erb index 8f1f078d61c5..7fda1d5609f6 100644 --- a/website/aws.erb +++ b/website/aws.erb @@ -1034,6 +1034,17 @@ + > + Firewall Manager Resources + + + > Gamelift Resources + > + FSx Resources + + + > Gamelift Resources +
  • + Service Quotas Resources + +
  • +
  • Shield Resources
  • +
  • + DataPipeline Resources + +
  • +
  • DataSync Resources
  • diff --git a/website/docs/r/athena_workgroup.html.markdown b/website/docs/r/athena_workgroup.html.markdown new file mode 100644 index 000000000000..35dc0ab963df --- /dev/null +++ b/website/docs/r/athena_workgroup.html.markdown @@ -0,0 +1,80 @@ +--- +layout: "aws" +page_title: "AWS: aws_athena_workgroup" +sidebar_current: "docs-aws-resource-athena-workgroup" +description: |- + Manages an Athena Workgroup. +--- + +# Resource: aws_athena_workgroup + +Provides an Athena Workgroup. + +## Example Usage + +```hcl +resource "aws_athena_workgroup" "example" { + name = "example" + + configuration { + enforce_workgroup_configuration = true + publish_cloudwatch_metrics_enabled = true + + result_configuration { + output_location = "s3://{aws_s3_bucket.example.bucket}/output/" + + encryption_configuration { + encryption_option = "SSE-KMS" + kms_key_arn = "${aws_kms_key.example.arn}" + } + } + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) Name of the workgroup. +* `configuration` - (Optional) Configuration block with various settings for the workgroup. Documented below. +* `description` - (Optional) Description of the workgroup. +* `state` - (Optional) State of the workgroup. Valid values are `DISABLED` or `ENABLED`. Defaults to `ENABLED`. +* `tags` - (Optional) Key-value mapping of resource tags for the workgroup. + +### configuration Argument Reference + +The `configuration` configuration block supports the following arguments: + +* `bytes_scanned_cutoff_per_query` - (Optional) Integer for the upper data usage limit (cutoff) for the amount of bytes a single query in a workgroup is allowed to scan. Must be at least `10485760`. +* `enforce_workgroup_configuration` - (Optional) Boolean whether the settings for the workgroup override client-side settings. For more information, see [Workgroup Settings Override Client-Side Settings](https://docs.aws.amazon.com/athena/latest/ug/workgroups-settings-override.html). +* `publish_cloudwatch_metrics_enabled` - (Optional) Boolean whether Amazon CloudWatch metrics are enabled for the workgroup. +* `result_configuration` - (Optional) Configuration block with result settings. Documented below. + +#### result_configuration Argument Reference + +The `result_configuration` configuration block within the `configuration` supports the following arguments: + +* `encryption_configuration` - (Optional) Configuration block with encryption settings. Documented below. +* `output_location` - (Optional) The location in Amazon S3 where your query results are stored, such as `s3://path/to/query/bucket/`. For more information, see [Queries and Query Result Files](https://docs.aws.amazon.com/athena/latest/ug/querying.html). + +##### encryption_configuration Argument Reference + +The `encryption_configuration` configuration block within the `result_configuration` of the `configuration` supports the following arguments: + +* `encryption_option` - (Required) Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (SSE-S3), server-side encryption with KMS-managed keys (SSE-KMS), or client-side encryption with KMS-managed keys (CSE-KMS) is used. If a query runs in a workgroup and the workgroup overrides client-side settings, then the workgroup's setting for encryption is used. It specifies whether query results must be encrypted, for all queries that run in this workgroup. +* `kms_key_arn` - (Optional) For SSE-KMS and CSE-KMS, this is the KMS key Amazon Resource Name (ARN). + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - The workgroup name + +## Import + +Athena Workgroups can be imported using their name, e.g. + +``` +$ terraform import aws_athena_workgroup.example example +``` From 7f25cb77d48c2ae68083c3d0ec5a6cfa6536916c Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 10:52:18 -0400 Subject: [PATCH 0141/1054] tests/resource/aws_athena_workgroup: Consolidate duplicate argument testing --- aws/resource_aws_athena_workgroup_test.go | 134 ++-------------------- 1 file changed, 7 insertions(+), 127 deletions(-) diff --git a/aws/resource_aws_athena_workgroup_test.go b/aws/resource_aws_athena_workgroup_test.go index 835a290a5f0f..ee1b2daa29d4 100644 --- a/aws/resource_aws_athena_workgroup_test.go +++ b/aws/resource_aws_athena_workgroup_test.go @@ -28,27 +28,7 @@ func TestAccAWSAthenaWorkGroup_basic(t *testing.T) { }) } -func TestAccAWSAthenaWorkGroup_withDescription(t *testing.T) { - rName := acctest.RandString(5) - rDescription := acctest.RandString(20) - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAthenaWorkGroupConfigDescription(rName, rDescription), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.desc"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.desc", "description", rDescription), - ), - }, - }, - }) -} - -func TestAccAWSAthenaWorkGroup_withDescriptionUpdate(t *testing.T) { +func TestAccAWSAthenaWorkGroup_Description(t *testing.T) { rName := acctest.RandString(5) rDescription := acctest.RandString(20) rDescriptionUpdate := acctest.RandString(20) @@ -78,27 +58,7 @@ func TestAccAWSAthenaWorkGroup_withDescriptionUpdate(t *testing.T) { }) } -func TestAccAWSAthenaWorkGroup_withBytesScannedCutoffPerQuery(t *testing.T) { - rName := acctest.RandString(5) - rBytesScannedCutoffPerQuery := "10485760" - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAthenaWorkGroupConfigBytesScannedCutoffPerQuery(rName, rBytesScannedCutoffPerQuery), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.bytes"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.bytes", "bytes_scanned_cutoff_per_query", rBytesScannedCutoffPerQuery), - ), - }, - }, - }) -} - -func TestAccAWSAthenaWorkGroup_withBytesScannedCutoffPerQueryUpdate(t *testing.T) { +func TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery(t *testing.T) { rName := acctest.RandString(5) rBytesScannedCutoffPerQuery := "10485760" rBytesScannedCutoffPerQueryUpdate := "12582912" @@ -127,27 +87,7 @@ func TestAccAWSAthenaWorkGroup_withBytesScannedCutoffPerQueryUpdate(t *testing.T }) } -func TestAccAWSAthenaWorkGroup_withEnforceWorkgroupConfiguration(t *testing.T) { - rName := acctest.RandString(5) - rEnforce := "true" - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAthenaWorkGroupConfigEnforceWorkgroupConfiguration(rName, rEnforce), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.enforce"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.enforce", "enforce_workgroup_configuration", rEnforce), - ), - }, - }, - }) -} - -func TestAccAWSAthenaWorkGroup_withEnforceWorkgroupConfigurationUpdate(t *testing.T) { +func TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration(t *testing.T) { rName := acctest.RandString(5) rEnforce := "true" rEnforceUpdate := "false" @@ -176,27 +116,7 @@ func TestAccAWSAthenaWorkGroup_withEnforceWorkgroupConfigurationUpdate(t *testin }) } -func TestAccAWSAthenaWorkGroup_withPublishCloudWatchMetricsEnabled(t *testing.T) { - rName := acctest.RandString(5) - rEnabled := "true" - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAthenaWorkGroupConfigPublishCloudWatchMetricsEnabled(rName, rEnabled), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.enable"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.enable", "publish_cloudwatch_metrics_enabled", rEnabled), - ), - }, - }, - }) -} - -func TestAccAWSAthenaWorkGroup_withPublishCloudWatchMetricsEnabledUpdate(t *testing.T) { +func TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled(t *testing.T) { rName := acctest.RandString(5) rEnabled := "true" rEnabledUpdate := "false" @@ -225,27 +145,7 @@ func TestAccAWSAthenaWorkGroup_withPublishCloudWatchMetricsEnabledUpdate(t *test }) } -func TestAccAWSAthenaWorkGroup_withOutputLocation(t *testing.T) { - rName := acctest.RandString(5) - rOutputLocation := acctest.RandString(10) - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAthenaWorkGroupConfigOutputLocation(rName, rOutputLocation), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.output"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.output", "output_location", "s3://"+rOutputLocation+"/test/output"), - ), - }, - }, - }) -} - -func TestAccAWSAthenaWorkGroup_withOutputLocationUpdate(t *testing.T) { +func TestAccAWSAthenaWorkGroup_OutputLocation(t *testing.T) { rName := acctest.RandString(5) rOutputLocation1 := acctest.RandString(10) rOutputLocation2 := acctest.RandString(10) @@ -274,7 +174,7 @@ func TestAccAWSAthenaWorkGroup_withOutputLocationUpdate(t *testing.T) { }) } -func TestAccAWSAthenaWorkGroup_withSseS3Encryption(t *testing.T) { +func TestAccAWSAthenaWorkGroup_SseS3Encryption(t *testing.T) { rName := acctest.RandString(5) rEncryption := athena.EncryptionOptionSseS3 resource.ParallelTest(t, resource.TestCase{ @@ -294,27 +194,7 @@ func TestAccAWSAthenaWorkGroup_withSseS3Encryption(t *testing.T) { }) } -func TestAccAWSAthenaWorkGroup_withKmsEncryption(t *testing.T) { - rName := acctest.RandString(5) - rEncryption := athena.EncryptionOptionSseKms - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAthenaWorkGroupConfigEncryptionKms(rName, rEncryption), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.encryptionkms"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.encryptionkms", "encryption_option", rEncryption), - ), - }, - }, - }) -} - -func TestAccAWSAthenaWorkGroup_withKmsEncryptionUpdate(t *testing.T) { +func TestAccAWSAthenaWorkGroup_KmsEncryption(t *testing.T) { rName := acctest.RandString(5) rEncryption := athena.EncryptionOptionSseKms rEncryption2 := athena.EncryptionOptionCseKms From c932741a1424a3d5786ca0118e92790d9ed2da4e Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 11:15:25 -0400 Subject: [PATCH 0142/1054] tests/resource/aws_athena_workgroup: Consistently use rName for full naming and resourceName Output from acceptance testing: ``` --- PASS: TestAccAWSAthenaWorkGroup_basic (14.00s) --- PASS: TestAccAWSAthenaWorkGroup_SseS3Encryption (14.37s) --- PASS: TestAccAWSAthenaWorkGroup_Description (17.85s) --- PASS: TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled (19.08s) --- PASS: TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration (19.61s) --- PASS: TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery (21.42s) --- PASS: TestAccAWSAthenaWorkGroup_KmsEncryption (49.26s) --- PASS: TestAccAWSAthenaWorkGroup_OutputLocation (55.55s) PASS ``` --- aws/resource_aws_athena_workgroup_test.go | 213 ++++++++++------------ 1 file changed, 100 insertions(+), 113 deletions(-) diff --git a/aws/resource_aws_athena_workgroup_test.go b/aws/resource_aws_athena_workgroup_test.go index ee1b2daa29d4..59f61b3ec9a4 100644 --- a/aws/resource_aws_athena_workgroup_test.go +++ b/aws/resource_aws_athena_workgroup_test.go @@ -13,15 +13,18 @@ import ( ) func TestAccAWSAthenaWorkGroup_basic(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_athena_workgroup.test" + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ { - Config: testAccAthenaWorkGroupConfig(acctest.RandString(5)), + Config: testAccAthenaWorkGroupConfig(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.foo"), + testAccCheckAWSAthenaWorkGroupExists(resourceName), ), }, }, @@ -29,7 +32,8 @@ func TestAccAWSAthenaWorkGroup_basic(t *testing.T) { } func TestAccAWSAthenaWorkGroup_Description(t *testing.T) { - rName := acctest.RandString(5) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_athena_workgroup.test" rDescription := acctest.RandString(20) rDescriptionUpdate := acctest.RandString(20) @@ -41,17 +45,15 @@ func TestAccAWSAthenaWorkGroup_Description(t *testing.T) { { Config: testAccAthenaWorkGroupConfigDescription(rName, rDescription), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.desc"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.desc", "description", rDescription), + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "description", rDescription), ), }, { Config: testAccAthenaWorkGroupConfigDescription(rName, rDescriptionUpdate), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.desc"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.desc", "description", rDescriptionUpdate), + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "description", rDescriptionUpdate), ), }, }, @@ -59,9 +61,11 @@ func TestAccAWSAthenaWorkGroup_Description(t *testing.T) { } func TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery(t *testing.T) { - rName := acctest.RandString(5) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_athena_workgroup.test" rBytesScannedCutoffPerQuery := "10485760" rBytesScannedCutoffPerQueryUpdate := "12582912" + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -70,17 +74,15 @@ func TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery(t *testing.T) { { Config: testAccAthenaWorkGroupConfigBytesScannedCutoffPerQuery(rName, rBytesScannedCutoffPerQuery), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.bytes"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.bytes", "bytes_scanned_cutoff_per_query", rBytesScannedCutoffPerQuery), + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "bytes_scanned_cutoff_per_query", rBytesScannedCutoffPerQuery), ), }, { Config: testAccAthenaWorkGroupConfigBytesScannedCutoffPerQuery(rName, rBytesScannedCutoffPerQueryUpdate), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.bytes"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.bytes", "bytes_scanned_cutoff_per_query", rBytesScannedCutoffPerQueryUpdate), + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "bytes_scanned_cutoff_per_query", rBytesScannedCutoffPerQueryUpdate), ), }, }, @@ -88,9 +90,11 @@ func TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery(t *testing.T) { } func TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration(t *testing.T) { - rName := acctest.RandString(5) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_athena_workgroup.test" rEnforce := "true" rEnforceUpdate := "false" + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -99,17 +103,15 @@ func TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration(t *testing.T) { { Config: testAccAthenaWorkGroupConfigEnforceWorkgroupConfiguration(rName, rEnforce), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.enforce"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.enforce", "enforce_workgroup_configuration", rEnforce), + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "enforce_workgroup_configuration", rEnforce), ), }, { Config: testAccAthenaWorkGroupConfigEnforceWorkgroupConfiguration(rName, rEnforceUpdate), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.enforce"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.enforce", "enforce_workgroup_configuration", rEnforceUpdate), + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "enforce_workgroup_configuration", rEnforceUpdate), ), }, }, @@ -117,9 +119,11 @@ func TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration(t *testing.T) { } func TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled(t *testing.T) { - rName := acctest.RandString(5) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_athena_workgroup.test" rEnabled := "true" rEnabledUpdate := "false" + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -128,17 +132,15 @@ func TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled(t *testing.T) { { Config: testAccAthenaWorkGroupConfigPublishCloudWatchMetricsEnabled(rName, rEnabled), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.enable"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.enable", "publish_cloudwatch_metrics_enabled", rEnabled), + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "publish_cloudwatch_metrics_enabled", rEnabled), ), }, { Config: testAccAthenaWorkGroupConfigPublishCloudWatchMetricsEnabled(rName, rEnabledUpdate), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.enable"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.enable", "publish_cloudwatch_metrics_enabled", rEnabledUpdate), + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "publish_cloudwatch_metrics_enabled", rEnabledUpdate), ), }, }, @@ -146,9 +148,11 @@ func TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled(t *testing.T) { } func TestAccAWSAthenaWorkGroup_OutputLocation(t *testing.T) { - rName := acctest.RandString(5) - rOutputLocation1 := acctest.RandString(10) - rOutputLocation2 := acctest.RandString(10) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_athena_workgroup.test" + rOutputLocation1 := fmt.Sprintf("%s-1", rName) + rOutputLocation2 := fmt.Sprintf("%s-2", rName) + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -157,17 +161,15 @@ func TestAccAWSAthenaWorkGroup_OutputLocation(t *testing.T) { { Config: testAccAthenaWorkGroupConfigOutputLocation(rName, rOutputLocation1), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.output"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.output", "output_location", "s3://"+rOutputLocation1+"/test/output"), + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "output_location", "s3://"+rOutputLocation1+"/test/output"), ), }, { Config: testAccAthenaWorkGroupConfigOutputLocation(rName, rOutputLocation2), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.output"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.output", "output_location", "s3://"+rOutputLocation2+"/test/output"), + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "output_location", "s3://"+rOutputLocation2+"/test/output"), ), }, }, @@ -175,8 +177,10 @@ func TestAccAWSAthenaWorkGroup_OutputLocation(t *testing.T) { } func TestAccAWSAthenaWorkGroup_SseS3Encryption(t *testing.T) { - rName := acctest.RandString(5) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_athena_workgroup.test" rEncryption := athena.EncryptionOptionSseS3 + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -185,9 +189,8 @@ func TestAccAWSAthenaWorkGroup_SseS3Encryption(t *testing.T) { { Config: testAccAthenaWorkGroupConfigEncryptionS3(rName, rEncryption), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.encryption"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.encryption", "encryption_option", rEncryption), + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "encryption_option", rEncryption), ), }, }, @@ -195,9 +198,11 @@ func TestAccAWSAthenaWorkGroup_SseS3Encryption(t *testing.T) { } func TestAccAWSAthenaWorkGroup_KmsEncryption(t *testing.T) { - rName := acctest.RandString(5) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_athena_workgroup.test" rEncryption := athena.EncryptionOptionSseKms rEncryption2 := athena.EncryptionOptionCseKms + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -206,17 +211,15 @@ func TestAccAWSAthenaWorkGroup_KmsEncryption(t *testing.T) { { Config: testAccAthenaWorkGroupConfigEncryptionKms(rName, rEncryption), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.encryptionkms"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.encryptionkms", "encryption_option", rEncryption), + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "encryption_option", rEncryption), ), }, { Config: testAccAthenaWorkGroupConfigEncryptionKms(rName, rEncryption2), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists("aws_athena_workgroup.encryptionkms"), - resource.TestCheckResourceAttr( - "aws_athena_workgroup.encryptionkms", "encryption_option", rEncryption2), + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "encryption_option", rEncryption2), ), }, }, @@ -268,98 +271,82 @@ func testAccCheckAWSAthenaWorkGroupExists(name string) resource.TestCheckFunc { func testAccAthenaWorkGroupConfig(rName string) string { return fmt.Sprintf(` -resource "aws_athena_workgroup" "foo" { - name = "tf-athena-workgroup-%s" +resource "aws_athena_workgroup" "test" { + name = %[1]q } - `, rName) +`, rName) } func testAccAthenaWorkGroupConfigDescription(rName string, rDescription string) string { return fmt.Sprintf(` - resource "aws_athena_workgroup" "desc" { - name = "tf-athena-workgroup-%s" - description = "%s" - } - `, rName, rDescription) +resource "aws_athena_workgroup" "test" { + description = %[2]q + name = %[1]q +} +`, rName, rDescription) } func testAccAthenaWorkGroupConfigBytesScannedCutoffPerQuery(rName string, rBytesScannedCutoffPerQuery string) string { return fmt.Sprintf(` - resource "aws_athena_workgroup" "bytes" { - name = "tf-athena-workgroup-%s" - bytes_scanned_cutoff_per_query = %s - } - `, rName, rBytesScannedCutoffPerQuery) +resource "aws_athena_workgroup" "test" { + bytes_scanned_cutoff_per_query = %[2]s + name = %[1]q +} +`, rName, rBytesScannedCutoffPerQuery) } func testAccAthenaWorkGroupConfigEnforceWorkgroupConfiguration(rName string, rEnforce string) string { return fmt.Sprintf(` - resource "aws_athena_workgroup" "enforce" { - name = "tf-athena-workgroup-%s" - enforce_workgroup_configuration = %s - } - `, rName, rEnforce) +resource "aws_athena_workgroup" "test" { + enforce_workgroup_configuration = %[2]s + name = %[1]q +} +`, rName, rEnforce) } func testAccAthenaWorkGroupConfigPublishCloudWatchMetricsEnabled(rName string, rEnable string) string { return fmt.Sprintf(` - resource "aws_athena_workgroup" "enable" { - name = "tf-athena-workgroup-%s" - publish_cloudwatch_metrics_enabled = %s - } - `, rName, rEnable) +resource "aws_athena_workgroup" "test" { + name = %[1]q + publish_cloudwatch_metrics_enabled = %[2]s +} +`, rName, rEnable) } func testAccAthenaWorkGroupConfigOutputLocation(rName string, rOutputLocation string) string { return fmt.Sprintf(` - resource "aws_s3_bucket" "output-bucket"{ - bucket = "%s" - force_destroy = true - } +resource "aws_s3_bucket" "test"{ + bucket = %[2]q + force_destroy = true +} - resource "aws_athena_workgroup" "output" { - name = "tf-athena-workgroup-%s" - output_location = "s3://${aws_s3_bucket.output-bucket.bucket}/test/output" - } - `, rOutputLocation, rName) +resource "aws_athena_workgroup" "test" { + name = %[1]q + output_location = "s3://${aws_s3_bucket.test.bucket}/test/output" +} +`, rName, rOutputLocation) } func testAccAthenaWorkGroupConfigEncryptionS3(rName string, rEncryption string) string { return fmt.Sprintf(` - resource "aws_athena_workgroup" "encryption" { - name = "tf-athena-workgroup-%s" - encryption_option = "%s" - } - `, rName, rEncryption) +resource "aws_athena_workgroup" "test" { + encryption_option = %[2]q + name = %[1]q +} +`, rName, rEncryption) } func testAccAthenaWorkGroupConfigEncryptionKms(rName string, rEncryption string) string { return fmt.Sprintf(` - resource "aws_kms_key" "kmstest" { - description = "EncryptionKmsTest" - policy = < Date: Tue, 9 Jul 2019 11:24:40 -0400 Subject: [PATCH 0143/1054] service/athena: Ensure overlapping tags are removed during updates Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/7052 --- aws/tagsAthena.go | 31 +++++++++++------------ aws/tagsAthena_test.go | 56 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 61 insertions(+), 26 deletions(-) diff --git a/aws/tagsAthena.go b/aws/tagsAthena.go index db8880566101..ba004e8786e5 100644 --- a/aws/tagsAthena.go +++ b/aws/tagsAthena.go @@ -21,26 +21,23 @@ func setTagsAthena(conn *athena.Athena, d *schema.ResourceData, arn string) erro // Set tags if len(remove) > 0 { - log.Printf("[DEBUG] Removing tags: %#v", remove) - k := make([]*string, len(remove)) - for i, t := range remove { - k[i] = t.Key - } - - _, err := conn.UntagResource(&athena.UntagResourceInput{ + input := athena.UntagResourceInput{ ResourceARN: aws.String(arn), - TagKeys: k, - }) + TagKeys: remove, + } + log.Printf("[DEBUG] Removing Athena tags: %s", input) + _, err := conn.UntagResource(&input) if err != nil { return err } } if len(create) > 0 { - log.Printf("[DEBUG] Creating tags: %#v", create) - _, err := conn.TagResource(&athena.TagResourceInput{ + input := athena.TagResourceInput{ ResourceARN: aws.String(arn), Tags: create, - }) + } + log.Printf("[DEBUG] Adding Athena tags: %s", input) + _, err := conn.TagResource(&input) if err != nil { return err } @@ -53,7 +50,7 @@ func setTagsAthena(conn *athena.Athena, d *schema.ResourceData, arn string) erro // diffTags takes our tags locally and the ones remotely and returns // the set of tags that must be created, and the set of tags that must // be destroyed. -func diffTagsAthena(oldTags, newTags []*athena.Tag) ([]*athena.Tag, []*athena.Tag) { +func diffTagsAthena(oldTags, newTags []*athena.Tag) ([]*athena.Tag, []*string) { // First, we're creating everything we have create := make(map[string]interface{}) for _, t := range newTags { @@ -61,12 +58,14 @@ func diffTagsAthena(oldTags, newTags []*athena.Tag) ([]*athena.Tag, []*athena.Ta } // Build the list of what to remove - var remove []*athena.Tag + var remove []*string for _, t := range oldTags { old, ok := create[aws.StringValue(t.Key)] if !ok || old != aws.StringValue(t.Value) { - // Delete it! - remove = append(remove, t) + remove = append(remove, t.Key) + } else if ok { + // already present so remove from new + delete(create, aws.StringValue(t.Key)) } } diff --git a/aws/tagsAthena_test.go b/aws/tagsAthena_test.go index 89113487e7dc..63f4bdeab48c 100644 --- a/aws/tagsAthena_test.go +++ b/aws/tagsAthena_test.go @@ -11,23 +11,23 @@ import ( // go test -v -run="TestDiffAthenaTags" func TestDiffAthenaTags(t *testing.T) { cases := []struct { - Old, New map[string]interface{} - Create, Remove map[string]string + Old, New map[string]interface{} + Create map[string]string + Remove []string }{ - // Basic add/remove + // Add { Old: map[string]interface{}{ "foo": "bar", }, New: map[string]interface{}{ + "foo": "bar", "bar": "baz", }, Create: map[string]string{ "bar": "baz", }, - Remove: map[string]string{ - "foo": "bar", - }, + Remove: []string{}, }, // Modify @@ -41,8 +41,41 @@ func TestDiffAthenaTags(t *testing.T) { Create: map[string]string{ "foo": "baz", }, - Remove: map[string]string{ + Remove: []string{ + "foo", + }, + }, + + // Overlap + { + Old: map[string]interface{}{ + "foo": "bar", + "hello": "world", + }, + New: map[string]interface{}{ + "foo": "baz", + "hello": "world", + }, + Create: map[string]string{ + "foo": "baz", + }, + Remove: []string{ + "foo", + }, + }, + + // Remove + { + Old: map[string]interface{}{ "foo": "bar", + "bar": "baz", + }, + New: map[string]interface{}{ + "foo": "bar", + }, + Create: map[string]string{}, + Remove: []string{ + "bar", }, }, } @@ -50,12 +83,15 @@ func TestDiffAthenaTags(t *testing.T) { for i, tc := range cases { c, r := diffTagsAthena(tagsFromMapAthena(tc.Old), tagsFromMapAthena(tc.New)) cm := tagsToMapAthena(c) - rm := tagsToMapAthena(r) + rl := []string{} + for _, tagName := range r { + rl = append(rl, *tagName) + } if !reflect.DeepEqual(cm, tc.Create) { t.Fatalf("%d: bad create: %#v", i, cm) } - if !reflect.DeepEqual(rm, tc.Remove) { - t.Fatalf("%d: bad remove: %#v", i, rm) + if !reflect.DeepEqual(rl, tc.Remove) { + t.Fatalf("%d: bad remove: %#v", i, rl) } } } From 58050b2c0fa30b2d21772431f0e0f2a1bf34361e Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 11:40:34 -0400 Subject: [PATCH 0144/1054] resource/aws_athena_workgroup: Implement tags support Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/7667 Output from acceptance testing: ``` --- PASS: TestAccAWSAthenaWorkGroup_SseS3Encryption (15.52s) --- PASS: TestAccAWSAthenaWorkGroup_basic (17.55s) --- PASS: TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration (20.21s) --- PASS: TestAccAWSAthenaWorkGroup_Description (20.46s) --- PASS: TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled (22.00s) --- PASS: TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery (26.63s) --- PASS: TestAccAWSAthenaWorkGroup_Tags (32.47s) --- PASS: TestAccAWSAthenaWorkGroup_OutputLocation (54.68s) --- PASS: TestAccAWSAthenaWorkGroup_KmsEncryption (60.36s) ``` --- aws/resource_aws_athena_workgroup.go | 26 +++++++++ aws/resource_aws_athena_workgroup_test.go | 64 +++++++++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/aws/resource_aws_athena_workgroup.go b/aws/resource_aws_athena_workgroup.go index bb3a876eb3c5..edc97fbfadb4 100644 --- a/aws/resource_aws_athena_workgroup.go +++ b/aws/resource_aws_athena_workgroup.go @@ -138,6 +138,12 @@ func resourceAwsAthenaWorkgroupCreate(d *schema.ResourceData, meta interface{}) } } + // Prevent the below error: + // InvalidRequestException: Tags provided upon WorkGroup creation must not be empty + if v := d.Get("tags").(map[string]interface{}); len(v) > 0 { + input.Tags = tagsFromMapAthena(v) + } + _, err := conn.CreateWorkGroup(input) if err != nil { @@ -215,6 +221,18 @@ func resourceAwsAthenaWorkgroupRead(d *schema.ResourceData, meta interface{}) er } } + err = saveTagsAthena(conn, d, d.Get("arn").(string)) + + if isAWSErr(err, athena.ErrCodeInvalidRequestException, d.Id()) { + log.Printf("[WARN] Athena WorkGroup (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + + if err != nil { + return fmt.Errorf("error setting tags: %s", err) + } + return nil } @@ -335,5 +353,13 @@ func resourceAwsAthenaWorkgroupUpdate(d *schema.ResourceData, meta interface{}) } } + if d.HasChange("tags") { + err := setTagsAthena(conn, d, d.Get("arn").(string)) + + if err != nil { + return fmt.Errorf("error updating tags: %s", err) + } + } + return resourceAwsAthenaWorkgroupRead(d, meta) } diff --git a/aws/resource_aws_athena_workgroup_test.go b/aws/resource_aws_athena_workgroup_test.go index 59f61b3ec9a4..34dec61696e0 100644 --- a/aws/resource_aws_athena_workgroup_test.go +++ b/aws/resource_aws_athena_workgroup_test.go @@ -25,6 +25,7 @@ func TestAccAWSAthenaWorkGroup_basic(t *testing.T) { Config: testAccAthenaWorkGroupConfig(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, }, @@ -226,6 +227,44 @@ func TestAccAWSAthenaWorkGroup_KmsEncryption(t *testing.T) { }) } +func TestAccAWSAthenaWorkGroup_Tags(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_athena_workgroup.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAthenaWorkGroupConfigTags1(rName, "key1", "value1"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + Config: testAccAthenaWorkGroupConfigTags2(rName, "key1", "value1updated", "key2", "value2"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1updated"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + { + Config: testAccAthenaWorkGroupConfigTags1(rName, "key2", "value2"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAthenaWorkGroupExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + }, + }) +} + func testAccCheckAWSAthenaWorkGroupDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).athenaconn for _, rs := range s.RootModule().Resources { @@ -350,3 +389,28 @@ resource "aws_athena_workgroup" "test" { } `, rName, rEncryption) } + +func testAccAthenaWorkGroupConfigTags1(rName, tagKey1, tagValue1 string) string { + return fmt.Sprintf(` +resource "aws_athena_workgroup" "test" { + name = %[1]q + + tags = { + %[2]q = %[3]q + } +} +`, rName, tagKey1, tagValue1) +} + +func testAccAthenaWorkGroupConfigTags2(rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { + return fmt.Sprintf(` +resource "aws_athena_workgroup" "test" { + name = %[1]q + + tags = { + %[2]q = %[3]q + %[4]q = %[5]q + } +} +`, rName, tagKey1, tagValue1, tagKey2, tagValue2) +} From 7a76856f5bb7ea63ddd34c32485d86ddb1c11232 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 11:56:21 -0400 Subject: [PATCH 0145/1054] resource/aws_athena_workground: Implement disappears testing and ensure error message contains "is not found" for triggering recreation Output from acceptance testing: ``` --- PASS: TestAccAWSAthenaWorkGroup_disappears (9.80s) --- PASS: TestAccAWSAthenaWorkGroup_basic (13.86s) --- PASS: TestAccAWSAthenaWorkGroup_SseS3Encryption (16.05s) --- PASS: TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled (20.70s) --- PASS: TestAccAWSAthenaWorkGroup_Description (22.30s) --- PASS: TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery (24.07s) --- PASS: TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration (26.29s) --- PASS: TestAccAWSAthenaWorkGroup_Tags (34.70s) --- PASS: TestAccAWSAthenaWorkGroup_OutputLocation (54.73s) --- PASS: TestAccAWSAthenaWorkGroup_KmsEncryption (60.03s) PASS ``` --- aws/resource_aws_athena_workgroup.go | 13 +-- aws/resource_aws_athena_workgroup_test.go | 99 ++++++++++++++++++----- 2 files changed, 84 insertions(+), 28 deletions(-) diff --git a/aws/resource_aws_athena_workgroup.go b/aws/resource_aws_athena_workgroup.go index edc97fbfadb4..80f76a50dcc1 100644 --- a/aws/resource_aws_athena_workgroup.go +++ b/aws/resource_aws_athena_workgroup.go @@ -164,12 +164,13 @@ func resourceAwsAthenaWorkgroupRead(d *schema.ResourceData, meta interface{}) er resp, err := conn.GetWorkGroup(input) + if isAWSErr(err, athena.ErrCodeInvalidRequestException, "is not found") { + log.Printf("[WARN] Athena WorkGroup (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + if err != nil { - if isAWSErr(err, athena.ErrCodeInvalidRequestException, d.Id()) { - log.Printf("[WARN] Athena WorkGroup (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } return err } @@ -223,7 +224,7 @@ func resourceAwsAthenaWorkgroupRead(d *schema.ResourceData, meta interface{}) er err = saveTagsAthena(conn, d, d.Get("arn").(string)) - if isAWSErr(err, athena.ErrCodeInvalidRequestException, d.Id()) { + if isAWSErr(err, athena.ErrCodeInvalidRequestException, "is not found") { log.Printf("[WARN] Athena WorkGroup (%s) not found, removing from state", d.Id()) d.SetId("") return nil diff --git a/aws/resource_aws_athena_workgroup_test.go b/aws/resource_aws_athena_workgroup_test.go index 34dec61696e0..679eaf416db6 100644 --- a/aws/resource_aws_athena_workgroup_test.go +++ b/aws/resource_aws_athena_workgroup_test.go @@ -13,6 +13,7 @@ import ( ) func TestAccAWSAthenaWorkGroup_basic(t *testing.T) { + var workgroup1 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" @@ -24,7 +25,7 @@ func TestAccAWSAthenaWorkGroup_basic(t *testing.T) { { Config: testAccAthenaWorkGroupConfig(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, @@ -32,7 +33,30 @@ func TestAccAWSAthenaWorkGroup_basic(t *testing.T) { }) } +func TestAccAWSAthenaWorkGroup_disappears(t *testing.T) { + var workgroup1 athena.WorkGroup + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_athena_workgroup.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAthenaWorkGroupConfig(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), + testAccCheckAWSAthenaWorkGroupDisappears(&workgroup1), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + func TestAccAWSAthenaWorkGroup_Description(t *testing.T) { + var workgroup1, workgroup2 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" rDescription := acctest.RandString(20) @@ -46,14 +70,14 @@ func TestAccAWSAthenaWorkGroup_Description(t *testing.T) { { Config: testAccAthenaWorkGroupConfigDescription(rName, rDescription), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), resource.TestCheckResourceAttr(resourceName, "description", rDescription), ), }, { Config: testAccAthenaWorkGroupConfigDescription(rName, rDescriptionUpdate), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), resource.TestCheckResourceAttr(resourceName, "description", rDescriptionUpdate), ), }, @@ -62,6 +86,7 @@ func TestAccAWSAthenaWorkGroup_Description(t *testing.T) { } func TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery(t *testing.T) { + var workgroup1, workgroup2 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" rBytesScannedCutoffPerQuery := "10485760" @@ -75,14 +100,14 @@ func TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery(t *testing.T) { { Config: testAccAthenaWorkGroupConfigBytesScannedCutoffPerQuery(rName, rBytesScannedCutoffPerQuery), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), resource.TestCheckResourceAttr(resourceName, "bytes_scanned_cutoff_per_query", rBytesScannedCutoffPerQuery), ), }, { Config: testAccAthenaWorkGroupConfigBytesScannedCutoffPerQuery(rName, rBytesScannedCutoffPerQueryUpdate), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), resource.TestCheckResourceAttr(resourceName, "bytes_scanned_cutoff_per_query", rBytesScannedCutoffPerQueryUpdate), ), }, @@ -91,6 +116,7 @@ func TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery(t *testing.T) { } func TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration(t *testing.T) { + var workgroup1, workgroup2 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" rEnforce := "true" @@ -104,14 +130,14 @@ func TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration(t *testing.T) { { Config: testAccAthenaWorkGroupConfigEnforceWorkgroupConfiguration(rName, rEnforce), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), resource.TestCheckResourceAttr(resourceName, "enforce_workgroup_configuration", rEnforce), ), }, { Config: testAccAthenaWorkGroupConfigEnforceWorkgroupConfiguration(rName, rEnforceUpdate), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), resource.TestCheckResourceAttr(resourceName, "enforce_workgroup_configuration", rEnforceUpdate), ), }, @@ -120,6 +146,7 @@ func TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration(t *testing.T) { } func TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled(t *testing.T) { + var workgroup1, workgroup2 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" rEnabled := "true" @@ -133,14 +160,14 @@ func TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled(t *testing.T) { { Config: testAccAthenaWorkGroupConfigPublishCloudWatchMetricsEnabled(rName, rEnabled), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), resource.TestCheckResourceAttr(resourceName, "publish_cloudwatch_metrics_enabled", rEnabled), ), }, { Config: testAccAthenaWorkGroupConfigPublishCloudWatchMetricsEnabled(rName, rEnabledUpdate), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), resource.TestCheckResourceAttr(resourceName, "publish_cloudwatch_metrics_enabled", rEnabledUpdate), ), }, @@ -149,6 +176,7 @@ func TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled(t *testing.T) { } func TestAccAWSAthenaWorkGroup_OutputLocation(t *testing.T) { + var workgroup1, workgroup2 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" rOutputLocation1 := fmt.Sprintf("%s-1", rName) @@ -162,14 +190,14 @@ func TestAccAWSAthenaWorkGroup_OutputLocation(t *testing.T) { { Config: testAccAthenaWorkGroupConfigOutputLocation(rName, rOutputLocation1), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), resource.TestCheckResourceAttr(resourceName, "output_location", "s3://"+rOutputLocation1+"/test/output"), ), }, { Config: testAccAthenaWorkGroupConfigOutputLocation(rName, rOutputLocation2), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), resource.TestCheckResourceAttr(resourceName, "output_location", "s3://"+rOutputLocation2+"/test/output"), ), }, @@ -178,6 +206,7 @@ func TestAccAWSAthenaWorkGroup_OutputLocation(t *testing.T) { } func TestAccAWSAthenaWorkGroup_SseS3Encryption(t *testing.T) { + var workgroup1 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" rEncryption := athena.EncryptionOptionSseS3 @@ -190,7 +219,7 @@ func TestAccAWSAthenaWorkGroup_SseS3Encryption(t *testing.T) { { Config: testAccAthenaWorkGroupConfigEncryptionS3(rName, rEncryption), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), resource.TestCheckResourceAttr(resourceName, "encryption_option", rEncryption), ), }, @@ -199,6 +228,7 @@ func TestAccAWSAthenaWorkGroup_SseS3Encryption(t *testing.T) { } func TestAccAWSAthenaWorkGroup_KmsEncryption(t *testing.T) { + var workgroup1, workgroup2 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" rEncryption := athena.EncryptionOptionSseKms @@ -212,14 +242,14 @@ func TestAccAWSAthenaWorkGroup_KmsEncryption(t *testing.T) { { Config: testAccAthenaWorkGroupConfigEncryptionKms(rName, rEncryption), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), resource.TestCheckResourceAttr(resourceName, "encryption_option", rEncryption), ), }, { Config: testAccAthenaWorkGroupConfigEncryptionKms(rName, rEncryption2), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), resource.TestCheckResourceAttr(resourceName, "encryption_option", rEncryption2), ), }, @@ -228,6 +258,7 @@ func TestAccAWSAthenaWorkGroup_KmsEncryption(t *testing.T) { } func TestAccAWSAthenaWorkGroup_Tags(t *testing.T) { + var workgroup1, workgroup2, workgroup3 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" @@ -239,7 +270,7 @@ func TestAccAWSAthenaWorkGroup_Tags(t *testing.T) { { Config: testAccAthenaWorkGroupConfigTags1(rName, "key1", "value1"), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), ), @@ -247,7 +278,7 @@ func TestAccAWSAthenaWorkGroup_Tags(t *testing.T) { { Config: testAccAthenaWorkGroupConfigTags2(rName, "key1", "value1updated", "key2", "value2"), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1updated"), resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), @@ -256,7 +287,7 @@ func TestAccAWSAthenaWorkGroup_Tags(t *testing.T) { { Config: testAccAthenaWorkGroupConfigTags1(rName, "key2", "value2"), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName), + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup3), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), ), @@ -277,12 +308,15 @@ func testAccCheckAWSAthenaWorkGroupDestroy(s *terraform.State) error { } resp, err := conn.GetWorkGroup(input) + + if isAWSErr(err, athena.ErrCodeInvalidRequestException, "is not found") { + continue + } + if err != nil { - if isAWSErr(err, athena.ErrCodeInvalidRequestException, rs.Primary.ID) { - return nil - } return err } + if resp.WorkGroup != nil { return fmt.Errorf("Athena WorkGroup (%s) found", rs.Primary.ID) } @@ -290,7 +324,7 @@ func testAccCheckAWSAthenaWorkGroupDestroy(s *terraform.State) error { return nil } -func testAccCheckAWSAthenaWorkGroupExists(name string) resource.TestCheckFunc { +func testAccCheckAWSAthenaWorkGroupExists(name string, workgroup *athena.WorkGroup) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] if !ok { @@ -303,7 +337,28 @@ func testAccCheckAWSAthenaWorkGroupExists(name string) resource.TestCheckFunc { WorkGroup: aws.String(rs.Primary.ID), } - _, err := conn.GetWorkGroup(input) + output, err := conn.GetWorkGroup(input) + + if err != nil { + return err + } + + *workgroup = *output.WorkGroup + + return nil + } +} + +func testAccCheckAWSAthenaWorkGroupDisappears(workgroup *athena.WorkGroup) resource.TestCheckFunc { + return func(s *terraform.State) error { + conn := testAccProvider.Meta().(*AWSClient).athenaconn + + input := &athena.DeleteWorkGroupInput{ + WorkGroup: workgroup.Name, + } + + _, err := conn.DeleteWorkGroup(input) + return err } } From bb32f52ed3757f07bc80c274fcb382f8703b72ba Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 11:58:22 -0400 Subject: [PATCH 0146/1054] resource/aws_athena_workgroup: Return error message context --- aws/resource_aws_athena_workgroup.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/aws/resource_aws_athena_workgroup.go b/aws/resource_aws_athena_workgroup.go index 80f76a50dcc1..9a080ee0da7c 100644 --- a/aws/resource_aws_athena_workgroup.go +++ b/aws/resource_aws_athena_workgroup.go @@ -147,7 +147,7 @@ func resourceAwsAthenaWorkgroupCreate(d *schema.ResourceData, meta interface{}) _, err := conn.CreateWorkGroup(input) if err != nil { - return err + return fmt.Errorf("error creating Athena WorkGroup: %s", err) } d.SetId(name) @@ -171,7 +171,7 @@ func resourceAwsAthenaWorkgroupRead(d *schema.ResourceData, meta interface{}) er } if err != nil { - return err + return fmt.Errorf("error reading Athena WorkGroup (%s): %s", d.Id(), err) } d.Set("name", *resp.WorkGroup.Name) @@ -246,7 +246,11 @@ func resourceAwsAthenaWorkgroupDelete(d *schema.ResourceData, meta interface{}) _, err := conn.DeleteWorkGroup(input) - return err + if err != nil { + return fmt.Errorf("error deleting Athena WorkGroup (%s): %s", d.Id(), err) + } + + return nil } func resourceAwsAthenaWorkgroupUpdate(d *schema.ResourceData, meta interface{}) error { @@ -350,7 +354,7 @@ func resourceAwsAthenaWorkgroupUpdate(d *schema.ResourceData, meta interface{}) _, err := conn.UpdateWorkGroup(input) if err != nil { - return fmt.Errorf("Error updating Athena WorkGroup (%s): %s", d.Id(), err) + return fmt.Errorf("error updating Athena WorkGroup (%s): %s", d.Id(), err) } } From 19fe5d14f0d5ae41c405f4b018eab0730c1b4715 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 12:02:51 -0400 Subject: [PATCH 0147/1054] resource/aws_athena_workgroup: Pass pointers directly to ResourceData.Set() Output from acceptance testing: ``` --- PASS: TestAccAWSAthenaWorkGroup_basic (13.65s) --- PASS: TestAccAWSAthenaWorkGroup_disappears (22.50s) --- PASS: TestAccAWSAthenaWorkGroup_Description (22.89s) --- PASS: TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration (24.08s) --- PASS: TestAccAWSAthenaWorkGroup_SseS3Encryption (24.58s) --- PASS: TestAccAWSAthenaWorkGroup_Tags (28.98s) --- PASS: TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled (30.44s) --- PASS: TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery (36.83s) --- PASS: TestAccAWSAthenaWorkGroup_KmsEncryption (56.71s) --- PASS: TestAccAWSAthenaWorkGroup_OutputLocation (58.03s) PASS ``` --- aws/resource_aws_athena_workgroup.go | 43 +++++++--------------------- 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/aws/resource_aws_athena_workgroup.go b/aws/resource_aws_athena_workgroup.go index 9a080ee0da7c..ae58633fd5b3 100644 --- a/aws/resource_aws_athena_workgroup.go +++ b/aws/resource_aws_athena_workgroup.go @@ -174,50 +174,29 @@ func resourceAwsAthenaWorkgroupRead(d *schema.ResourceData, meta interface{}) er return fmt.Errorf("error reading Athena WorkGroup (%s): %s", d.Id(), err) } - d.Set("name", *resp.WorkGroup.Name) - - if resp.WorkGroup.Description != nil { - d.Set("description", *resp.WorkGroup.Description) - } - - client := meta.(*AWSClient) - arn := arn.ARN{ - Partition: client.partition, - Region: client.region, + Partition: meta.(*AWSClient).partition, + Region: meta.(*AWSClient).region, Service: "athena", - AccountID: client.accountid, + AccountID: meta.(*AWSClient).accountid, Resource: fmt.Sprintf("workgroup/%s", d.Id()), } d.Set("arn", arn.String()) + d.Set("description", resp.WorkGroup.Description) + d.Set("name", resp.WorkGroup.Name) if resp.WorkGroup.Configuration != nil { - if resp.WorkGroup.Configuration.BytesScannedCutoffPerQuery != nil { - d.Set("bytes_scanned_cutoff_per_query", *resp.WorkGroup.Configuration.BytesScannedCutoffPerQuery) - } - - if resp.WorkGroup.Configuration.EnforceWorkGroupConfiguration != nil { - d.Set("enforce_workgroup_configuration", *resp.WorkGroup.Configuration.EnforceWorkGroupConfiguration) - } - - if resp.WorkGroup.Configuration.PublishCloudWatchMetricsEnabled != nil { - d.Set("publish_cloudwatch_metrics_enabled", *resp.WorkGroup.Configuration.PublishCloudWatchMetricsEnabled) - } + d.Set("bytes_scanned_cutoff_per_query", resp.WorkGroup.Configuration.BytesScannedCutoffPerQuery) + d.Set("enforce_workgroup_configuration", resp.WorkGroup.Configuration.EnforceWorkGroupConfiguration) + d.Set("publish_cloudwatch_metrics_enabled", resp.WorkGroup.Configuration.PublishCloudWatchMetricsEnabled) if resp.WorkGroup.Configuration.ResultConfiguration != nil { - if resp.WorkGroup.Configuration.ResultConfiguration.OutputLocation != nil { - d.Set("output_location", *resp.WorkGroup.Configuration.ResultConfiguration.OutputLocation) - } + d.Set("output_location", resp.WorkGroup.Configuration.ResultConfiguration.OutputLocation) if resp.WorkGroup.Configuration.ResultConfiguration.EncryptionConfiguration != nil { - if resp.WorkGroup.Configuration.ResultConfiguration.EncryptionConfiguration.EncryptionOption != nil { - d.Set("encryption_option", *resp.WorkGroup.Configuration.ResultConfiguration.EncryptionConfiguration.EncryptionOption) - } - - if resp.WorkGroup.Configuration.ResultConfiguration.EncryptionConfiguration.KmsKey != nil { - d.Set("kms_key", *resp.WorkGroup.Configuration.ResultConfiguration.EncryptionConfiguration.KmsKey) - } + d.Set("encryption_option", resp.WorkGroup.Configuration.ResultConfiguration.EncryptionConfiguration.EncryptionOption) + d.Set("kms_key", resp.WorkGroup.Configuration.ResultConfiguration.EncryptionConfiguration.KmsKey) } } } From 48cd05287df442b2057f84df74494824e4a9c6d2 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 12:06:23 -0400 Subject: [PATCH 0148/1054] resource/aws_athena_workgroup: Support resource import Output from acceptance testing: ``` --- PASS: TestAccAWSAthenaWorkGroup_disappears (8.22s) --- PASS: TestAccAWSAthenaWorkGroup_basic (17.59s) --- PASS: TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled (22.79s) --- PASS: TestAccAWSAthenaWorkGroup_SseS3Encryption (24.16s) --- PASS: TestAccAWSAthenaWorkGroup_Description (24.87s) --- PASS: TestAccAWSAthenaWorkGroup_Tags (31.45s) --- PASS: TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery (31.49s) --- PASS: TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration (36.48s) --- PASS: TestAccAWSAthenaWorkGroup_OutputLocation (52.29s) --- PASS: TestAccAWSAthenaWorkGroup_KmsEncryption (52.68s) PASS ``` --- aws/resource_aws_athena_workgroup.go | 3 ++ aws/resource_aws_athena_workgroup_test.go | 45 +++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/aws/resource_aws_athena_workgroup.go b/aws/resource_aws_athena_workgroup.go index ae58633fd5b3..40207efca38e 100644 --- a/aws/resource_aws_athena_workgroup.go +++ b/aws/resource_aws_athena_workgroup.go @@ -18,6 +18,9 @@ func resourceAwsAthenaWorkgroup() *schema.Resource { Read: resourceAwsAthenaWorkgroupRead, Update: resourceAwsAthenaWorkgroupUpdate, Delete: resourceAwsAthenaWorkgroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": { diff --git a/aws/resource_aws_athena_workgroup_test.go b/aws/resource_aws_athena_workgroup_test.go index 679eaf416db6..a30790ed585d 100644 --- a/aws/resource_aws_athena_workgroup_test.go +++ b/aws/resource_aws_athena_workgroup_test.go @@ -29,6 +29,11 @@ func TestAccAWSAthenaWorkGroup_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -74,6 +79,11 @@ func TestAccAWSAthenaWorkGroup_Description(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "description", rDescription), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, { Config: testAccAthenaWorkGroupConfigDescription(rName, rDescriptionUpdate), Check: resource.ComposeTestCheckFunc( @@ -104,6 +114,11 @@ func TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "bytes_scanned_cutoff_per_query", rBytesScannedCutoffPerQuery), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, { Config: testAccAthenaWorkGroupConfigBytesScannedCutoffPerQuery(rName, rBytesScannedCutoffPerQueryUpdate), Check: resource.ComposeTestCheckFunc( @@ -134,6 +149,11 @@ func TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enforce_workgroup_configuration", rEnforce), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, { Config: testAccAthenaWorkGroupConfigEnforceWorkgroupConfiguration(rName, rEnforceUpdate), Check: resource.ComposeTestCheckFunc( @@ -164,6 +184,11 @@ func TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "publish_cloudwatch_metrics_enabled", rEnabled), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, { Config: testAccAthenaWorkGroupConfigPublishCloudWatchMetricsEnabled(rName, rEnabledUpdate), Check: resource.ComposeTestCheckFunc( @@ -194,6 +219,11 @@ func TestAccAWSAthenaWorkGroup_OutputLocation(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "output_location", "s3://"+rOutputLocation1+"/test/output"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, { Config: testAccAthenaWorkGroupConfigOutputLocation(rName, rOutputLocation2), Check: resource.ComposeTestCheckFunc( @@ -223,6 +253,11 @@ func TestAccAWSAthenaWorkGroup_SseS3Encryption(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "encryption_option", rEncryption), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -246,6 +281,11 @@ func TestAccAWSAthenaWorkGroup_KmsEncryption(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "encryption_option", rEncryption), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, { Config: testAccAthenaWorkGroupConfigEncryptionKms(rName, rEncryption2), Check: resource.ComposeTestCheckFunc( @@ -275,6 +315,11 @@ func TestAccAWSAthenaWorkGroup_Tags(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, { Config: testAccAthenaWorkGroupConfigTags2(rName, "key1", "value1updated", "key2", "value2"), Check: resource.ComposeTestCheckFunc( From 31c275ddb22368f5f2c2f29e2f5ed0f284c9c93b Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 12:20:28 -0400 Subject: [PATCH 0149/1054] resource/aws_athena_workgroup: Implement state argument Output from acceptance testing: ``` --- PASS: TestAccAWSAthenaWorkGroup_disappears (9.19s) --- PASS: TestAccAWSAthenaWorkGroup_basic (15.71s) --- PASS: TestAccAWSAthenaWorkGroup_SseS3Encryption (16.68s) --- PASS: TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled (21.81s) --- PASS: TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery (29.38s) --- PASS: TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration (30.03s) --- PASS: TestAccAWSAthenaWorkGroup_Tags (35.51s) --- PASS: TestAccAWSAthenaWorkGroup_State (36.61s) --- PASS: TestAccAWSAthenaWorkGroup_Description (38.45s) --- PASS: TestAccAWSAthenaWorkGroup_KmsEncryption (53.81s) --- PASS: TestAccAWSAthenaWorkGroup_OutputLocation (55.70s) PASS ``` --- aws/resource_aws_athena_workgroup.go | 26 ++++++++++++ aws/resource_aws_athena_workgroup_test.go | 50 +++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/aws/resource_aws_athena_workgroup.go b/aws/resource_aws_athena_workgroup.go index 40207efca38e..4925727fc9d0 100644 --- a/aws/resource_aws_athena_workgroup.go +++ b/aws/resource_aws_athena_workgroup.go @@ -63,6 +63,15 @@ func resourceAwsAthenaWorkgroup() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "state": { + Type: schema.TypeString, + Optional: true, + Default: athena.WorkGroupStateEnabled, + ValidateFunc: validation.StringInSlice([]string{ + athena.WorkGroupStateDisabled, + athena.WorkGroupStateEnabled, + }, false), + }, "arn": { Type: schema.TypeString, Computed: true, @@ -155,6 +164,17 @@ func resourceAwsAthenaWorkgroupCreate(d *schema.ResourceData, meta interface{}) d.SetId(name) + if v := d.Get("state").(string); v == athena.WorkGroupStateDisabled { + input := &athena.UpdateWorkGroupInput{ + State: aws.String(v), + WorkGroup: aws.String(d.Id()), + } + + if _, err := conn.UpdateWorkGroup(input); err != nil { + return fmt.Errorf("error disabling Athena WorkGroup (%s): %s", d.Id(), err) + } + } + return resourceAwsAthenaWorkgroupRead(d, meta) } @@ -188,6 +208,7 @@ func resourceAwsAthenaWorkgroupRead(d *schema.ResourceData, meta interface{}) er d.Set("arn", arn.String()) d.Set("description", resp.WorkGroup.Description) d.Set("name", resp.WorkGroup.Name) + d.Set("state", resp.WorkGroup.State) if resp.WorkGroup.Configuration != nil { d.Set("bytes_scanned_cutoff_per_query", resp.WorkGroup.Configuration.BytesScannedCutoffPerQuery) @@ -320,6 +341,11 @@ func resourceAwsAthenaWorkgroupUpdate(d *schema.ResourceData, meta interface{}) } } + if d.HasChange("state") { + workGroupUpdate = true + input.State = aws.String(d.Get("state").(string)) + } + if workGroupUpdate { if configUpdate { input.ConfigurationUpdates = inputConfigurationUpdates diff --git a/aws/resource_aws_athena_workgroup_test.go b/aws/resource_aws_athena_workgroup_test.go index a30790ed585d..b298e41b0a38 100644 --- a/aws/resource_aws_athena_workgroup_test.go +++ b/aws/resource_aws_athena_workgroup_test.go @@ -26,6 +26,7 @@ func TestAccAWSAthenaWorkGroup_basic(t *testing.T) { Config: testAccAthenaWorkGroupConfig(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), + resource.TestCheckResourceAttr(resourceName, "state", athena.WorkGroupStateEnabled), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, @@ -297,6 +298,46 @@ func TestAccAWSAthenaWorkGroup_KmsEncryption(t *testing.T) { }) } +func TestAccAWSAthenaWorkGroup_State(t *testing.T) { + var workgroup1, workgroup2, workgroup3 athena.WorkGroup + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_athena_workgroup.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAthenaWorkGroupConfigState(rName, athena.WorkGroupStateDisabled), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), + resource.TestCheckResourceAttr(resourceName, "state", athena.WorkGroupStateDisabled), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccAthenaWorkGroupConfigState(rName, athena.WorkGroupStateEnabled), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), + resource.TestCheckResourceAttr(resourceName, "state", athena.WorkGroupStateEnabled), + ), + }, + { + Config: testAccAthenaWorkGroupConfigState(rName, athena.WorkGroupStateDisabled), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup3), + resource.TestCheckResourceAttr(resourceName, "state", athena.WorkGroupStateDisabled), + ), + }, + }, + }) +} + func TestAccAWSAthenaWorkGroup_Tags(t *testing.T) { var workgroup1, workgroup2, workgroup3 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") @@ -490,6 +531,15 @@ resource "aws_athena_workgroup" "test" { `, rName, rEncryption) } +func testAccAthenaWorkGroupConfigState(rName, state string) string { + return fmt.Sprintf(` +resource "aws_athena_workgroup" "test" { + name = %[1]q + state = %[2]q +} +`, rName, state) +} + func testAccAthenaWorkGroupConfigTags1(rName, tagKey1, tagValue1 string) string { return fmt.Sprintf(` resource "aws_athena_workgroup" "test" { From 1ae7693c730cb721a42a56f4bde2399e9b5e7964 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 12:21:09 -0400 Subject: [PATCH 0150/1054] docs/resource/aws_athena_workgroup: Ensure arn attribute is documented --- website/docs/r/athena_workgroup.html.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/r/athena_workgroup.html.markdown b/website/docs/r/athena_workgroup.html.markdown index 35dc0ab963df..bf4943feeecc 100644 --- a/website/docs/r/athena_workgroup.html.markdown +++ b/website/docs/r/athena_workgroup.html.markdown @@ -69,6 +69,7 @@ The `encryption_configuration` configuration block within the `result_configurat In addition to all arguments above, the following attributes are exported: +* `arn` - Amazon Resource Name (ARN) of the workgroup * `id` - The workgroup name ## Import From 12d5b5c0a0a04bd34b4b251fab394b0811de333f Mon Sep 17 00:00:00 2001 From: Shaun Haber Date: Tue, 12 Feb 2019 17:57:32 -0800 Subject: [PATCH 0151/1054] Add logs_config schema to aws_codebuild_project Fix test fixture --- aws/resource_aws_codebuild_project.go | 240 ++++++++++++++++++ aws/resource_aws_codebuild_project_test.go | 62 +++++ .../docs/r/codebuild_project.html.markdown | 30 +++ 3 files changed, 332 insertions(+) diff --git a/aws/resource_aws_codebuild_project.go b/aws/resource_aws_codebuild_project.go index 19bc7ad0489f..6e8be68d779d 100644 --- a/aws/resource_aws_codebuild_project.go +++ b/aws/resource_aws_codebuild_project.go @@ -6,6 +6,7 @@ import ( "log" "regexp" "strconv" + "strings" "time" "github.com/aws/aws-sdk-go/aws" @@ -221,6 +222,95 @@ func resourceAwsCodeBuildProject() *schema.Resource { }, Set: resourceAwsCodeBuildProjectEnvironmentHash, }, + "logs_config": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cloudwatch_logs": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "status": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + codebuild.LogsConfigStatusTypeDisabled, + codebuild.LogsConfigStatusTypeEnabled, + }, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if old == codebuild.LogsConfigStatusTypeEnabled && new == "" { + return true + } + return false + }, + }, + "group_name": { + Type: schema.TypeString, + Optional: true, + }, + "stream_name": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if old == "1" && new == "0" { + return true + } + return false + }, + }, + "s3_logs": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "status": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + codebuild.LogsConfigStatusTypeDisabled, + codebuild.LogsConfigStatusTypeEnabled, + }, false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if old == codebuild.LogsConfigStatusTypeDisabled && new == "" { + return true + } + return false + }, + }, + "location": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateAwsCodeBuildProjectS3LogsLocation, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return strings.TrimPrefix(new, "arn:aws:s3:::") == old + }, + }, + }, + }, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if old == "1" && new == "0" { + return true + } + return false + }, + }, + }, + }, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if old == "1" && new == "0" { + return true + } + return false + }, + }, "name": { Type: schema.TypeString, Required: true, @@ -482,6 +572,7 @@ func resourceAwsCodeBuildProjectCreate(d *schema.ResourceData, meta interface{}) projectArtifacts := expandProjectArtifacts(d) projectSecondaryArtifacts := expandProjectSecondaryArtifacts(d) projectSecondarySources := expandProjectSecondarySources(d) + projectLogsConfig := expandProjectLogsConfig(d) if aws.StringValue(projectSource.Type) == codebuild.SourceTypeNoSource { if aws.StringValue(projectSource.Buildspec) == "" { @@ -500,6 +591,7 @@ func resourceAwsCodeBuildProjectCreate(d *schema.ResourceData, meta interface{}) Artifacts: &projectArtifacts, SecondaryArtifacts: projectSecondaryArtifacts, SecondarySources: projectSecondarySources, + LogsConfig: projectLogsConfig, } if v, ok := d.GetOk("cache"); ok { @@ -727,6 +819,82 @@ func expandProjectEnvironment(d *schema.ResourceData) *codebuild.ProjectEnvironm return projectEnv } +func expandProjectLogsConfig(d *schema.ResourceData) *codebuild.LogsConfig { + logsConfig := &codebuild.LogsConfig{} + + if v, ok := d.GetOk("logs_config"); ok { + configList := v.([]interface{}) + data := configList[0].(map[string]interface{}) + + if v, ok := data["cloudwatch_logs"]; ok { + logsConfig.CloudWatchLogs = expandCodeBuildCloudWatchLogsConfig(v.([]interface{})) + } + + if v, ok := data["s3_logs"]; ok { + logsConfig.S3Logs = expandCodeBuildS3LogsConfig(v.([]interface{})) + } + } + + if logsConfig.CloudWatchLogs == nil { + logsConfig.CloudWatchLogs = &codebuild.CloudWatchLogsConfig{ + Status: aws.String(codebuild.LogsConfigStatusTypeEnabled), + } + } + + if logsConfig.S3Logs == nil { + logsConfig.S3Logs = &codebuild.S3LogsConfig{ + Status: aws.String(codebuild.LogsConfigStatusTypeDisabled), + } + } + + return logsConfig +} + +func expandCodeBuildCloudWatchLogsConfig(configList []interface{}) *codebuild.CloudWatchLogsConfig { + data := configList[0].(map[string]interface{}) + + status := data["status"].(string) + + cloudWatchLogsConfig := &codebuild.CloudWatchLogsConfig{ + Status: aws.String(status), + } + + if v, ok := data["group_name"]; ok { + groupName := v.(string) + if len(groupName) > 0 { + cloudWatchLogsConfig.GroupName = aws.String(groupName) + } + } + + if v, ok := data["stream_name"]; ok { + streamName := v.(string) + if len(streamName) > 0 { + cloudWatchLogsConfig.StreamName = aws.String(streamName) + } + } + + return cloudWatchLogsConfig +} + +func expandCodeBuildS3LogsConfig(configList []interface{}) *codebuild.S3LogsConfig { + data := configList[0].(map[string]interface{}) + + status := data["status"].(string) + + s3LogsConfig := &codebuild.S3LogsConfig{ + Status: aws.String(status), + } + + if v, ok := data["location"]; ok { + location := strings.TrimPrefix(v.(string), "arn:aws:s3:::") + if len(location) > 0 { + s3LogsConfig.Location = aws.String(location) + } + } + + return s3LogsConfig +} + func expandCodeBuildVpcConfig(rawVpcConfig []interface{}) *codebuild.VpcConfig { vpcConfig := codebuild.VpcConfig{} if len(rawVpcConfig) == 0 || rawVpcConfig[0] == nil { @@ -837,6 +1005,10 @@ func resourceAwsCodeBuildProjectRead(d *schema.ResourceData, meta interface{}) e return err } + if err := d.Set("logs_config", flattenAwsCodeBuildLogsConfig(project.LogsConfig)); err != nil { + return err + } + if err := d.Set("secondary_artifacts", flattenAwsCodeBuildProjectSecondaryArtifacts(project.SecondaryArtifacts)); err != nil { return err } @@ -910,6 +1082,11 @@ func resourceAwsCodeBuildProjectUpdate(d *schema.ResourceData, meta interface{}) params.VpcConfig = expandCodeBuildVpcConfig(d.Get("vpc_config").([]interface{})) } + if d.HasChange("logs_config") { + logsConfig := expandProjectLogsConfig(d) + params.LogsConfig = logsConfig + } + if d.HasChange("cache") { if v, ok := d.GetOk("cache"); ok { params.Cache = expandProjectCache(v.([]interface{})) @@ -981,6 +1158,51 @@ func resourceAwsCodeBuildProjectDelete(d *schema.ResourceData, meta interface{}) return err } +func flattenAwsCodeBuildLogsConfig(logsConfig *codebuild.LogsConfig) []interface{} { + if logsConfig == nil { + return []interface{}{} + } + + values := map[string]interface{}{} + + if v := logsConfig.CloudWatchLogs; v != nil { + values["cloudwatch_logs"] = flattenAwsCodeBuildCloudWatchLogs(v) + } + + if v := logsConfig.S3Logs; v != nil { + values["s3_logs"] = flattenAwsCodeBuildS3Logs(v) + } + + return []interface{}{values} +} + +func flattenAwsCodeBuildCloudWatchLogs(cloudWatchLogsConfig *codebuild.CloudWatchLogsConfig) []interface{} { + if cloudWatchLogsConfig == nil { + return []interface{}{} + } + + values := map[string]interface{}{ + "status": aws.StringValue(cloudWatchLogsConfig.Status), + "group_name": aws.StringValue(cloudWatchLogsConfig.GroupName), + "stream_name": aws.StringValue(cloudWatchLogsConfig.StreamName), + } + + return []interface{}{values} +} + +func flattenAwsCodeBuildS3Logs(s3LogsConfig *codebuild.S3LogsConfig) []interface{} { + if s3LogsConfig == nil { + return []interface{}{} + } + + values := map[string]interface{}{ + "status": aws.StringValue(s3LogsConfig.Status), + "location": aws.StringValue(s3LogsConfig.Location), + } + + return []interface{}{values} +} + func flattenAwsCodeBuildProjectSecondaryArtifacts(artifactsList []*codebuild.ProjectArtifacts) *schema.Set { artifactSet := schema.Set{ F: resourceAwsCodeBuildProjectArtifactsHash, @@ -1282,3 +1504,21 @@ func validateAwsCodeBuildProjectName(v interface{}, k string) (ws []string, erro return } + +func validateAwsCodeBuildProjectS3LogsLocation(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + + if _, errs := validateArn(v, k); len(errs) == 0 { + errors = append(errors, errs...) + return + } + + simplePattern := `^[a-z0-9][^/]*\/(.+)$` + if !regexp.MustCompile(simplePattern).MatchString(value) { + errors = append(errors, fmt.Errorf( + "%q does not match pattern (%q): %q", + k, simplePattern, value)) + } + + return +} diff --git a/aws/resource_aws_codebuild_project_test.go b/aws/resource_aws_codebuild_project_test.go index 007ba89302fd..1ddf349e14f4 100644 --- a/aws/resource_aws_codebuild_project_test.go +++ b/aws/resource_aws_codebuild_project_test.go @@ -381,6 +381,32 @@ func TestAccAWSCodeBuildProject_Environment_Certificate(t *testing.T) { }) } +func TestAccAWSCodeBuildProject_LogsConfig(t *testing.T) { + var project codebuild.Project + rName := acctest.RandomWithPrefix("tf-acc-test") + bName := acctest.RandomWithPrefix("tf-acc-test-bucket") + resourceName := "aws_codebuild_project.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSCodeBuildProjectConfig_LogsConfig(rName, bName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSCodeBuildProjectExists(resourceName, &project), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.cloudwatch_logs.0.status", "ENABLED"), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.cloudwatch_logs.0.group_name", "build-log"), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.cloudwatch_logs.0.stream_name", "build-log"), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.s3_logs.0.status", "ENABLED"), + resource.TestMatchResourceAttr(resourceName, "logs_config.0.s3_logs.0.location", regexp.MustCompile(`tf-acc-test-bucket-[0-9]+/build-log$`)), + ), + }, + }, + }) +} + func TestAccAWSCodeBuildProject_Source_Auth(t *testing.T) { var project codebuild.Project rName := acctest.RandomWithPrefix("tf-acc-test") @@ -1510,6 +1536,42 @@ resource "aws_secretsmanager_secret_version" "test" { `, rName) } +func testAccAWSCodeBuildProjectConfig_LogsConfig(rName, bName string) string { + return testAccAWSCodeBuildProjectConfig_Base_ServiceRole(rName) + testAccAWSCodeBuildProjectConfig_Base_Bucket(bName) + fmt.Sprintf(` +resource "aws_codebuild_project" "test" { + name = "%s" + service_role = "${aws_iam_role.test.arn}" + + artifacts { + type = "NO_ARTIFACTS" + } + + environment { + compute_type = "BUILD_GENERAL1_SMALL" + image = "2" + type = "LINUX_CONTAINER" + } + + source { + location = "https://github.com/hashicorp/packer.git" + type = "GITHUB" + } + + logs_config { + cloudwatch_logs { + status = "ENABLED" + group_name = "build-log" + stream_name = "build-log" + } + s3_logs { + status = "ENABLED" + location = "${aws_s3_bucket.test.arn}/build-log" + } + } +} +`, rName) +} + func testAccAWSCodeBuildProjectConfig_Source_Auth(rName, authResource, authType string) string { return testAccAWSCodeBuildProjectConfig_Base_ServiceRole(rName) + fmt.Sprintf(` resource "aws_codebuild_project" "test" { diff --git a/website/docs/r/codebuild_project.html.markdown b/website/docs/r/codebuild_project.html.markdown index 783705e6248a..0fe313f90ad5 100644 --- a/website/docs/r/codebuild_project.html.markdown +++ b/website/docs/r/codebuild_project.html.markdown @@ -116,6 +116,19 @@ resource "aws_codebuild_project" "example" { } } + logs_config { + cloudwatch_logs { + status = "ENABLED" + group_name = "log-group" + stream_name = "log-stream" + } + + s3_logs { + status = "ENABLED" + location = "${aws_s3_bucket.example.arn}/build-log" + } + } + source { type = "GITHUB" location = "https://github.com/mitchellh/packer.git" @@ -193,6 +206,7 @@ The following arguments are supported: * `cache` - (Optional) Information about the cache storage for the project. Cache blocks are documented below. * `description` - (Optional) A short description of the project. * `encryption_key` - (Optional) The AWS Key Management Service (AWS KMS) customer master key (CMK) to be used for encrypting the build project's build output artifacts. +* `logs_config` - (Optional) Configuration for the builds to store log data to CloudWatch or S3. * `service_role` - (Required) The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that enables AWS CodeBuild to interact with dependent AWS services on behalf of the AWS account. * `tags` - (Optional) A mapping of tags to assign to the resource. * `vpc_config` - (Optional) Configuration for the builds to run inside a VPC. VPC config blocks are documented below. @@ -232,6 +246,22 @@ The following arguments are supported: * `value` - (Required) The environment variable's value. * `type` - (Optional) The type of environment variable. Valid values: `PARAMETER_STORE`, `PLAINTEXT`. +`logs_config` supports the following: + +* `cloudwatch_logs` - (Optional) Configuration for the builds to store logs to CloudWatch +* `s3_logs` - (Optional) Configuration for the builds to store logs to S3. + +`cloudwatch_logs` supports the following: + +* `status` - (Required) Current status of logs in CloudWatch Logs for a build project. Valid values: `ENABLED`, `DISABLED`. +* `group_name` - (Optional) The group name of the logs in CloudWatch Logs. +* `stream_name` - (Optional) The stream name of the logs in CloudWatch Logs. + +`s3_logs` supports the following: + +* `status` - (Required) Current status of logs in S3 for a build project. Valid values: `ENABLED`, `DISABLED`. +* `location` - (Optional) The ARN of the S3 bucket and the path prefix for S3 logs. + `source` supports the following: * `type` - (Required) The type of repository that contains the source code to be built. Valid values for this parameter are: `CODECOMMIT`, `CODEPIPELINE`, `GITHUB`, `GITHUB_ENTERPRISE`, `BITBUCKET`, `S3` or `NO_SOURCE`. From 52e262196397ccebae0bd5a5f775d48e496b47e2 Mon Sep 17 00:00:00 2001 From: Shaun Haber Date: Tue, 9 Jul 2019 11:41:01 -0700 Subject: [PATCH 0152/1054] Suggested fixes from PR. Also, add `encryption_disabled` attribute. --- aws/resource_aws_codebuild_project.go | 107 +++++++--------- aws/resource_aws_codebuild_project_test.go | 121 ++++++++++++++++-- .../docs/r/codebuild_project.html.markdown | 10 +- 3 files changed, 159 insertions(+), 79 deletions(-) diff --git a/aws/resource_aws_codebuild_project.go b/aws/resource_aws_codebuild_project.go index 6e8be68d779d..42abfa647199 100644 --- a/aws/resource_aws_codebuild_project.go +++ b/aws/resource_aws_codebuild_project.go @@ -6,7 +6,6 @@ import ( "log" "regexp" "strconv" - "strings" "time" "github.com/aws/aws-sdk-go/aws" @@ -236,17 +235,12 @@ func resourceAwsCodeBuildProject() *schema.Resource { Schema: map[string]*schema.Schema{ "status": { Type: schema.TypeString, - Required: true, + Optional: true, + Default: codebuild.LogsConfigStatusTypeEnabled, ValidateFunc: validation.StringInSlice([]string{ codebuild.LogsConfigStatusTypeDisabled, codebuild.LogsConfigStatusTypeEnabled, }, false), - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - if old == codebuild.LogsConfigStatusTypeEnabled && new == "" { - return true - } - return false - }, }, "group_name": { Type: schema.TypeString, @@ -258,12 +252,7 @@ func resourceAwsCodeBuildProject() *schema.Resource { }, }, }, - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - if old == "1" && new == "0" { - return true - } - return false - }, + DiffSuppressFunc: suppressMissingOptionalConfigurationBlock, }, "s3_logs": { Type: schema.TypeList, @@ -273,43 +262,30 @@ func resourceAwsCodeBuildProject() *schema.Resource { Schema: map[string]*schema.Schema{ "status": { Type: schema.TypeString, - Required: true, + Optional: true, + Default: codebuild.LogsConfigStatusTypeDisabled, ValidateFunc: validation.StringInSlice([]string{ codebuild.LogsConfigStatusTypeDisabled, codebuild.LogsConfigStatusTypeEnabled, }, false), - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - if old == codebuild.LogsConfigStatusTypeDisabled && new == "" { - return true - } - return false - }, }, "location": { Type: schema.TypeString, Optional: true, ValidateFunc: validateAwsCodeBuildProjectS3LogsLocation, - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - return strings.TrimPrefix(new, "arn:aws:s3:::") == old - }, + }, + "encryption_disabled": { + Type: schema.TypeBool, + Optional: true, + Default: false, }, }, }, - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - if old == "1" && new == "0" { - return true - } - return false - }, + DiffSuppressFunc: suppressMissingOptionalConfigurationBlock, }, }, }, - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - if old == "1" && new == "0" { - return true - } - return false - }, + DiffSuppressFunc: suppressMissingOptionalConfigurationBlock, }, "name": { Type: schema.TypeString, @@ -822,7 +798,7 @@ func expandProjectEnvironment(d *schema.ResourceData) *codebuild.ProjectEnvironm func expandProjectLogsConfig(d *schema.ResourceData) *codebuild.LogsConfig { logsConfig := &codebuild.LogsConfig{} - if v, ok := d.GetOk("logs_config"); ok { + if v, ok := d.GetOk("logs_config"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { configList := v.([]interface{}) data := configList[0].(map[string]interface{}) @@ -851,6 +827,10 @@ func expandProjectLogsConfig(d *schema.ResourceData) *codebuild.LogsConfig { } func expandCodeBuildCloudWatchLogsConfig(configList []interface{}) *codebuild.CloudWatchLogsConfig { + if len(configList) == 0 || configList[0] == nil { + return nil + } + data := configList[0].(map[string]interface{}) status := data["status"].(string) @@ -877,6 +857,10 @@ func expandCodeBuildCloudWatchLogsConfig(configList []interface{}) *codebuild.Cl } func expandCodeBuildS3LogsConfig(configList []interface{}) *codebuild.S3LogsConfig { + if len(configList) == 0 || configList[0] == nil { + return nil + } + data := configList[0].(map[string]interface{}) status := data["status"].(string) @@ -886,12 +870,14 @@ func expandCodeBuildS3LogsConfig(configList []interface{}) *codebuild.S3LogsConf } if v, ok := data["location"]; ok { - location := strings.TrimPrefix(v.(string), "arn:aws:s3:::") + location := v.(string) if len(location) > 0 { s3LogsConfig.Location = aws.String(location) } } + s3LogsConfig.EncryptionDisabled = aws.Bool(data["encryption_disabled"].(bool)) + return s3LogsConfig } @@ -994,35 +980,35 @@ func resourceAwsCodeBuildProjectRead(d *schema.ResourceData, meta interface{}) e project := resp.Projects[0] if err := d.Set("artifacts", flattenAwsCodeBuildProjectArtifacts(project.Artifacts)); err != nil { - return err + return fmt.Errorf("error setting artifacts: %s", err) } if err := d.Set("environment", schema.NewSet(resourceAwsCodeBuildProjectEnvironmentHash, flattenAwsCodeBuildProjectEnvironment(project.Environment))); err != nil { - return err + return fmt.Errorf("error setting environment: %s", err) } if err := d.Set("cache", flattenAwsCodebuildProjectCache(project.Cache)); err != nil { - return err + return fmt.Errorf("error setting cache: %s", err) } if err := d.Set("logs_config", flattenAwsCodeBuildLogsConfig(project.LogsConfig)); err != nil { - return err + return fmt.Errorf("error setting logs_config: %s", err) } if err := d.Set("secondary_artifacts", flattenAwsCodeBuildProjectSecondaryArtifacts(project.SecondaryArtifacts)); err != nil { - return err + return fmt.Errorf("error setting secondary_artifacts: %s", err) } if err := d.Set("secondary_sources", flattenAwsCodeBuildProjectSecondarySources(project.SecondarySources)); err != nil { - return err + return fmt.Errorf("error setting secondary_sources: %s", err) } if err := d.Set("source", flattenAwsCodeBuildProjectSource(project.Source)); err != nil { - return err + return fmt.Errorf("error setting source: %s", err) } if err := d.Set("vpc_config", flattenAwsCodeBuildVpcConfig(project.VpcConfig)); err != nil { - return err + return fmt.Errorf("error setting vpc_config: %s", err) } d.Set("arn", project.Arn) @@ -1040,7 +1026,7 @@ func resourceAwsCodeBuildProjectRead(d *schema.ResourceData, meta interface{}) e } if err := d.Set("tags", tagsToMapCodeBuild(project.Tags)); err != nil { - return err + return fmt.Errorf("error setting tags: %s", err) } return nil @@ -1177,27 +1163,28 @@ func flattenAwsCodeBuildLogsConfig(logsConfig *codebuild.LogsConfig) []interface } func flattenAwsCodeBuildCloudWatchLogs(cloudWatchLogsConfig *codebuild.CloudWatchLogsConfig) []interface{} { - if cloudWatchLogsConfig == nil { - return []interface{}{} - } + values := map[string]interface{}{} - values := map[string]interface{}{ - "status": aws.StringValue(cloudWatchLogsConfig.Status), - "group_name": aws.StringValue(cloudWatchLogsConfig.GroupName), - "stream_name": aws.StringValue(cloudWatchLogsConfig.StreamName), + if cloudWatchLogsConfig == nil { + values["status"] = codebuild.LogsConfigStatusTypeDisabled + } else { + values["status"] = aws.StringValue(cloudWatchLogsConfig.Status) + values["group_name"] = aws.StringValue(cloudWatchLogsConfig.GroupName) + values["stream_name"] = aws.StringValue(cloudWatchLogsConfig.StreamName) } return []interface{}{values} } func flattenAwsCodeBuildS3Logs(s3LogsConfig *codebuild.S3LogsConfig) []interface{} { - if s3LogsConfig == nil { - return []interface{}{} - } + values := map[string]interface{}{} - values := map[string]interface{}{ - "status": aws.StringValue(s3LogsConfig.Status), - "location": aws.StringValue(s3LogsConfig.Location), + if s3LogsConfig == nil { + values["status"] = codebuild.LogsConfigStatusTypeDisabled + } else { + values["status"] = aws.StringValue(s3LogsConfig.Status) + values["location"] = aws.StringValue(s3LogsConfig.Location) + values["encryption_disabled"] = aws.BoolValue(s3LogsConfig.EncryptionDisabled) } return []interface{}{values} diff --git a/aws/resource_aws_codebuild_project_test.go b/aws/resource_aws_codebuild_project_test.go index 1ddf349e14f4..63f382fe2c6e 100644 --- a/aws/resource_aws_codebuild_project_test.go +++ b/aws/resource_aws_codebuild_project_test.go @@ -94,6 +94,8 @@ func TestAccAWSCodeBuildProject_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "environment.2300252877.privileged_mode", "false"), resource.TestCheckResourceAttr(resourceName, "environment.2300252877.type", "LINUX_CONTAINER"), resource.TestCheckResourceAttr(resourceName, "environment.2300252877.image_pull_credentials_type", "CODEBUILD"), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.cloudwatch_logs.0.status", "ENABLED"), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.s3_logs.0.status", "DISABLED"), resource.TestMatchResourceAttr(resourceName, "service_role", regexp.MustCompile(`^arn:[^:]+:iam::[^:]+:role/tf-acc-test-[0-9]+$`)), resource.TestCheckResourceAttr(resourceName, "source.#", "1"), resource.TestCheckResourceAttr(resourceName, "source.1441597390.auth.#", "0"), @@ -381,10 +383,9 @@ func TestAccAWSCodeBuildProject_Environment_Certificate(t *testing.T) { }) } -func TestAccAWSCodeBuildProject_LogsConfig(t *testing.T) { +func TestAccAWSCodeBuildProject_LogsConfig_CloudWatchLogs(t *testing.T) { var project codebuild.Project rName := acctest.RandomWithPrefix("tf-acc-test") - bName := acctest.RandomWithPrefix("tf-acc-test-bucket") resourceName := "aws_codebuild_project.test" resource.ParallelTest(t, resource.TestCase{ @@ -393,16 +394,80 @@ func TestAccAWSCodeBuildProject_LogsConfig(t *testing.T) { CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCodeBuildProjectConfig_LogsConfig(rName, bName), + Config: testAccAWSCodeBuildProjectConfig_LogsConfig_CloudWatchLogs(rName, "ENABLED", "group-name", ""), Check: resource.ComposeTestCheckFunc( testAccCheckAWSCodeBuildProjectExists(resourceName, &project), resource.TestCheckResourceAttr(resourceName, "logs_config.0.cloudwatch_logs.0.status", "ENABLED"), - resource.TestCheckResourceAttr(resourceName, "logs_config.0.cloudwatch_logs.0.group_name", "build-log"), - resource.TestCheckResourceAttr(resourceName, "logs_config.0.cloudwatch_logs.0.stream_name", "build-log"), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.cloudwatch_logs.0.group_name", "group-name"), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.cloudwatch_logs.0.stream_name", ""), + ), + }, + { + Config: testAccAWSCodeBuildProjectConfig_LogsConfig_CloudWatchLogs(rName, "ENABLED", "group-name", "stream-name"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSCodeBuildProjectExists(resourceName, &project), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.cloudwatch_logs.0.status", "ENABLED"), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.cloudwatch_logs.0.group_name", "group-name"), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.cloudwatch_logs.0.stream_name", "stream-name"), + ), + }, + { + Config: testAccAWSCodeBuildProjectConfig_LogsConfig_CloudWatchLogs(rName, "DISABLED", "", ""), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSCodeBuildProjectExists(resourceName, &project), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.cloudwatch_logs.0.status", "DISABLED"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSCodeBuildProject_LogsConfig_S3Logs(t *testing.T) { + var project codebuild.Project + rName := acctest.RandomWithPrefix("tf-acc-test") + bName := acctest.RandomWithPrefix("tf-acc-test-bucket") + resourceName := "aws_codebuild_project.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSCodeBuildProjectConfig_LogsConfig_S3Logs(rName, bName, "ENABLED", bName+"/build-log", false), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSCodeBuildProjectExists(resourceName, &project), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.s3_logs.0.status", "ENABLED"), + resource.TestMatchResourceAttr(resourceName, "logs_config.0.s3_logs.0.location", regexp.MustCompile(`tf-acc-test-bucket-[0-9]+/build-log$`)), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.s3_logs.0.encryption_disabled", "false"), + ), + }, + { + Config: testAccAWSCodeBuildProjectConfig_LogsConfig_S3Logs(rName, bName, "ENABLED", bName+"/build-log", true), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSCodeBuildProjectExists(resourceName, &project), resource.TestCheckResourceAttr(resourceName, "logs_config.0.s3_logs.0.status", "ENABLED"), resource.TestMatchResourceAttr(resourceName, "logs_config.0.s3_logs.0.location", regexp.MustCompile(`tf-acc-test-bucket-[0-9]+/build-log$`)), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.s3_logs.0.encryption_disabled", "true"), ), }, + { + Config: testAccAWSCodeBuildProjectConfig_LogsConfig_S3Logs(rName, bName, "DISABLED", "", false), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSCodeBuildProjectExists(resourceName, &project), + resource.TestCheckResourceAttr(resourceName, "logs_config.0.s3_logs.0.status", "DISABLED"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -1536,8 +1601,8 @@ resource "aws_secretsmanager_secret_version" "test" { `, rName) } -func testAccAWSCodeBuildProjectConfig_LogsConfig(rName, bName string) string { - return testAccAWSCodeBuildProjectConfig_Base_ServiceRole(rName) + testAccAWSCodeBuildProjectConfig_Base_Bucket(bName) + fmt.Sprintf(` +func testAccAWSCodeBuildProjectConfig_LogsConfig_CloudWatchLogs(rName, status, gName, sName string) string { + return testAccAWSCodeBuildProjectConfig_Base_ServiceRole(rName) + fmt.Sprintf(` resource "aws_codebuild_project" "test" { name = "%s" service_role = "${aws_iam_role.test.arn}" @@ -1554,22 +1619,50 @@ resource "aws_codebuild_project" "test" { source { location = "https://github.com/hashicorp/packer.git" - type = "GITHUB" + type = "GITHUB" } logs_config { cloudwatch_logs { - status = "ENABLED" - group_name = "build-log" - stream_name = "build-log" + status = %q + group_name = %q + stream_name = %q } + } +} +`, rName, status, gName, sName) +} + +func testAccAWSCodeBuildProjectConfig_LogsConfig_S3Logs(rName, bName, status, location string, encryptionDisabled bool) string { + return testAccAWSCodeBuildProjectConfig_Base_ServiceRole(rName) + testAccAWSCodeBuildProjectConfig_Base_Bucket(bName) + fmt.Sprintf(` +resource "aws_codebuild_project" "test" { + name = "%s" + service_role = "${aws_iam_role.test.arn}" + + artifacts { + type = "NO_ARTIFACTS" + } + + environment { + compute_type = "BUILD_GENERAL1_SMALL" + image = "2" + type = "LINUX_CONTAINER" + } + + source { + location = "https://github.com/hashicorp/packer.git" + type = "GITHUB" + } + + logs_config { s3_logs { - status = "ENABLED" - location = "${aws_s3_bucket.test.arn}/build-log" + status = %q + location = %q + encryption_disabled = %t } } } -`, rName) +`, rName, status, location, encryptionDisabled) } func testAccAWSCodeBuildProjectConfig_Source_Auth(rName, authResource, authType string) string { diff --git a/website/docs/r/codebuild_project.html.markdown b/website/docs/r/codebuild_project.html.markdown index 0fe313f90ad5..0f5ef0a414ee 100644 --- a/website/docs/r/codebuild_project.html.markdown +++ b/website/docs/r/codebuild_project.html.markdown @@ -118,14 +118,13 @@ resource "aws_codebuild_project" "example" { logs_config { cloudwatch_logs { - status = "ENABLED" group_name = "log-group" stream_name = "log-stream" } s3_logs { status = "ENABLED" - location = "${aws_s3_bucket.example.arn}/build-log" + location = "${aws_s3_bucket.example.id}/build-log" } } @@ -253,14 +252,15 @@ The following arguments are supported: `cloudwatch_logs` supports the following: -* `status` - (Required) Current status of logs in CloudWatch Logs for a build project. Valid values: `ENABLED`, `DISABLED`. +* `status` - (Optional) Current status of logs in CloudWatch Logs for a build project. Valid values: `ENABLED`, `DISABLED`. Defaults to `ENABLED`. * `group_name` - (Optional) The group name of the logs in CloudWatch Logs. * `stream_name` - (Optional) The stream name of the logs in CloudWatch Logs. `s3_logs` supports the following: -* `status` - (Required) Current status of logs in S3 for a build project. Valid values: `ENABLED`, `DISABLED`. -* `location` - (Optional) The ARN of the S3 bucket and the path prefix for S3 logs. +* `status` - (Optional) Current status of logs in S3 for a build project. Valid values: `ENABLED`, `DISABLED`. Defaults to `DISABLED`. +* `location` - (Optional) The name of the S3 bucket and the path prefix for S3 logs. Must be set if status is `ENABLED`, otherwise it must be empty. +* `encryption_disabled` - (Optional) Set to `true` if you do not want S3 logs encrypted. Defaults to `false`. `source` supports the following: From ad94171408e9d28f77b45e6ed2023dc40fa51c38 Mon Sep 17 00:00:00 2001 From: Jakub Kania Date: Tue, 9 Jul 2019 02:19:26 +0200 Subject: [PATCH 0153/1054] Add tags support for resource_aws_lightsail_instance --- aws/resource_aws_lightsail_instance.go | 25 +++++ aws/resource_aws_lightsail_instance_test.go | 74 ++++++++++++++ aws/tagsLightsail.go | 97 +++++++++++++++++++ aws/tagsLightsail_test.go | 91 +++++++++++++++++ .../docs/r/lightsail_instance.html.markdown | 4 + 5 files changed, 291 insertions(+) create mode 100644 aws/tagsLightsail.go create mode 100644 aws/tagsLightsail_test.go diff --git a/aws/resource_aws_lightsail_instance.go b/aws/resource_aws_lightsail_instance.go index 17fdf90e6037..b35c7c55d8da 100644 --- a/aws/resource_aws_lightsail_instance.go +++ b/aws/resource_aws_lightsail_instance.go @@ -17,6 +17,7 @@ func resourceAwsLightsailInstance() *schema.Resource { return &schema.Resource{ Create: resourceAwsLightsailInstanceCreate, Read: resourceAwsLightsailInstanceRead, + Update: resourceAwsLightsailInstanceUpdate, Delete: resourceAwsLightsailInstanceDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, @@ -103,6 +104,7 @@ func resourceAwsLightsailInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "tags": tagsSchema(), }, } } @@ -126,6 +128,12 @@ func resourceAwsLightsailInstanceCreate(d *schema.ResourceData, meta interface{} req.UserData = aws.String(v.(string)) } + tags := tagsFromMapLightsail(d.Get("tags").(map[string]interface{})) + + if len(tags) != 0 { + req.Tags = tags + } + resp, err := conn.CreateInstances(&req) if err != nil { return err @@ -199,6 +207,10 @@ func resourceAwsLightsailInstanceRead(d *schema.ResourceData, meta interface{}) d.Set("private_ip_address", i.PrivateIpAddress) d.Set("public_ip_address", i.PublicIpAddress) + if err := d.Set("tags", tagsToMapLightsail(i.Tags)); err != nil { + return fmt.Errorf("Error setting tags: %s", err) + } + return nil } @@ -233,6 +245,19 @@ func resourceAwsLightsailInstanceDelete(d *schema.ResourceData, meta interface{} return nil } +func resourceAwsLightsailInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).lightsailconn + + if d.HasChange("tags") { + if err := setTagsLightsail(conn, d); err != nil { + return err + } + d.SetPartial("tags") + } + + return resourceAwsLightsailInstanceRead(d, meta) +} + // method to check the status of an Operation, which is returned from // Create/Delete methods. // Status's are an aws.OperationStatus enum: diff --git a/aws/resource_aws_lightsail_instance_test.go b/aws/resource_aws_lightsail_instance_test.go index 938f198134d2..324cdbf7cb92 100644 --- a/aws/resource_aws_lightsail_instance_test.go +++ b/aws/resource_aws_lightsail_instance_test.go @@ -32,6 +32,7 @@ func TestAccAWSLightsailInstance_basic(t *testing.T) { resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "blueprint_id"), resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "bundle_id"), resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "key_pair_name"), + resource.TestCheckResourceAttr("aws_lightsail_instance.lightsail_instance_test", "tags.%", "0"), ), }, }, @@ -62,6 +63,42 @@ func TestAccAWSLightsailInstance_euRegion(t *testing.T) { }) } +func TestAccAWSLightsailInstance_update(t *testing.T) { + var conf lightsail.Instance + lightsailName := fmt.Sprintf("tf-test-lightsail-%d", acctest.RandInt()) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSLightsail(t) }, + IDRefreshName: "aws_lightsail_instance.lightsail_instance_test", + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSLightsailInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSLightsailInstanceConfig_update(lightsailName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSLightsailInstanceExists("aws_lightsail_instance.lightsail_instance_test", &conf), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "availability_zone"), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "blueprint_id"), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "bundle_id"), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "key_pair_name"), + resource.TestCheckResourceAttr("aws_lightsail_instance.lightsail_instance_test", "tags.%", "1"), + ), + }, + { + Config: testAccAWSLightsailInstanceConfig_updated(lightsailName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSLightsailInstanceExists("aws_lightsail_instance.lightsail_instance_test", &conf), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "availability_zone"), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "blueprint_id"), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "bundle_id"), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "key_pair_name"), + resource.TestCheckResourceAttr("aws_lightsail_instance.lightsail_instance_test", "tags.%", "2"), + ), + }, + }, + }) +} + func TestAccAWSLightsailInstance_disapear(t *testing.T) { var conf lightsail.Instance lightsailName := fmt.Sprintf("tf-test-lightsail-%d", acctest.RandInt()) @@ -191,6 +228,43 @@ resource "aws_lightsail_instance" "lightsail_instance_test" { `, lightsailName) } +func testAccAWSLightsailInstanceConfig_update(lightsailName string) string { + return fmt.Sprintf(` +data "aws_availability_zones" "available" { + state = "available" +} + +resource "aws_lightsail_instance" "lightsail_instance_test" { + name = "%s" + availability_zone = "${data.aws_availability_zones.available.names[0]}" + blueprint_id = "amazon_linux" + bundle_id = "nano_1_0" + tags = { + Name = "tf-test" + } +} +`, lightsailName) +} + +func testAccAWSLightsailInstanceConfig_updated(lightsailName string) string { + return fmt.Sprintf(` +data "aws_availability_zones" "available" { + state = "available" +} + +resource "aws_lightsail_instance" "lightsail_instance_test" { + name = "%s" + availability_zone = "${data.aws_availability_zones.available.names[0]}" + blueprint_id = "amazon_linux" + bundle_id = "nano_1_0" + tags = { + Name = "tf-test", + ExtraName = "tf-test" + } +} +`, lightsailName) +} + func testAccAWSLightsailInstanceConfig_euRegion(lightsailName string) string { return fmt.Sprintf(` provider "aws" { diff --git a/aws/tagsLightsail.go b/aws/tagsLightsail.go new file mode 100644 index 000000000000..cecbcb8047a2 --- /dev/null +++ b/aws/tagsLightsail.go @@ -0,0 +1,97 @@ +package aws + +import ( + "log" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/lightsail" + "github.com/hashicorp/terraform/helper/schema" +) + +// diffTags takes our tags locally and the ones remotely and returns +// the set of tags that must be created, and the set of tags that must +// be destroyed. +func diffTagsLightsail(oldTags, newTags []*lightsail.Tag) ([]*lightsail.Tag, []*lightsail.Tag) { + // First, we're creating everything we have + create := make(map[string]interface{}) + for _, t := range newTags { + create[aws.StringValue(t.Key)] = aws.StringValue(t.Value) + } + + // Build the list of what to remove + var remove []*lightsail.Tag + for _, t := range oldTags { + old, ok := create[aws.StringValue(t.Key)] + if !ok || old != aws.StringValue(t.Value) { + // Delete it! + remove = append(remove, t) + } else if ok { + delete(create, aws.StringValue(t.Key)) + } + } + + return tagsFromMapLightsail(create), remove +} + +// setTags is a helper to set the tags for a resource. It expects the +// tags field to be named "tags" +func setTagsLightsail(conn *lightsail.Lightsail, d *schema.ResourceData) error { + if d.HasChange("tags") { + oraw, nraw := d.GetChange("tags") + o := oraw.(map[string]interface{}) + n := nraw.(map[string]interface{}) + create, remove := diffTagsLightsail(tagsFromMapLightsail(o), tagsFromMapLightsail(n)) + + // Set tags + if len(remove) > 0 { + log.Printf("[DEBUG] Removing tags: %#v", remove) + k := make([]*string, len(remove)) + for i, t := range remove { + k[i] = t.Key + } + + _, err := conn.UntagResource(&lightsail.UntagResourceInput{ + ResourceName: aws.String(d.Get("name").(string)), + TagKeys: k, + }) + if err != nil { + return err + } + } + if len(create) > 0 { + log.Printf("[DEBUG] Creating tags: %#v", create) + _, err := conn.TagResource(&lightsail.TagResourceInput{ + ResourceName: aws.String(d.Get("name").(string)), + Tags: create, + }) + if err != nil { + return err + } + } + } + + return nil +} + +// tagsFromMap returns the tags for the given map of data. +func tagsFromMapLightsail(m map[string]interface{}) []*lightsail.Tag { + result := make([]*lightsail.Tag, 0, len(m)) + for k, v := range m { + result = append(result, &lightsail.Tag{ + Key: aws.String(k), + Value: aws.String(v.(string)), + }) + } + + return result +} + +// tagsToMap turns the list of tags into a map. +func tagsToMapLightsail(ts []*lightsail.Tag) map[string]string { + result := make(map[string]string) + for _, t := range ts { + result[aws.StringValue(t.Key)] = aws.StringValue(t.Value) + } + + return result +} diff --git a/aws/tagsLightsail_test.go b/aws/tagsLightsail_test.go new file mode 100644 index 000000000000..e448efe63893 --- /dev/null +++ b/aws/tagsLightsail_test.go @@ -0,0 +1,91 @@ +package aws + +import ( + "reflect" + "testing" +) + +// go test -v -run="TestDiffLightsailTags" +func TestDiffLightsailTags(t *testing.T) { + cases := []struct { + Old, New map[string]interface{} + Create, Remove map[string]string + }{ + // Basic add/remove + { + Old: map[string]interface{}{ + "foo": "bar", + }, + New: map[string]interface{}{ + "bar": "baz", + }, + Create: map[string]string{ + "bar": "baz", + }, + Remove: map[string]string{ + "foo": "bar", + }, + }, + + // Modify + { + Old: map[string]interface{}{ + "foo": "bar", + }, + New: map[string]interface{}{ + "foo": "baz", + }, + Create: map[string]string{ + "foo": "baz", + }, + Remove: map[string]string{ + "foo": "bar", + }, + }, + + // Overlap + { + Old: map[string]interface{}{ + "foo": "bar", + "hello": "world", + }, + New: map[string]interface{}{ + "foo": "baz", + "hello": "world", + }, + Create: map[string]string{ + "foo": "baz", + }, + Remove: map[string]string{ + "foo": "bar", + }, + }, + + // Remove + { + Old: map[string]interface{}{ + "foo": "bar", + "bar": "baz", + }, + New: map[string]interface{}{ + "foo": "bar", + }, + Create: map[string]string{}, + Remove: map[string]string{ + "bar": "baz", + }, + }, + } + + for i, tc := range cases { + c, r := diffTagsLightsail(tagsFromMapLightsail(tc.Old), tagsFromMapLightsail(tc.New)) + cm := tagsToMapLightsail(c) + rm := tagsToMapLightsail(r) + if !reflect.DeepEqual(cm, tc.Create) { + t.Fatalf("%d: bad create: %#v", i, cm) + } + if !reflect.DeepEqual(rm, tc.Remove) { + t.Fatalf("%d: bad remove: %#v", i, rm) + } + } +} diff --git a/website/docs/r/lightsail_instance.html.markdown b/website/docs/r/lightsail_instance.html.markdown index 9352e4486b1b..197168384634 100644 --- a/website/docs/r/lightsail_instance.html.markdown +++ b/website/docs/r/lightsail_instance.html.markdown @@ -24,6 +24,9 @@ resource "aws_lightsail_instance" "gitlab_test" { blueprint_id = "string" bundle_id = "string" key_pair_name = "some_key_name" + tags = { + foo = "bar" + } } ``` @@ -40,6 +43,7 @@ instance (see list below) * `key_pair_name` - (Optional) The name of your key pair. Created in the Lightsail console (cannot use `aws_key_pair` at this time) * `user_data` - (Optional) launch script to configure server with additional user data +* `tags` - (Optional) A mapping of tags to assign to the resource. ## Availability Zones Lightsail currently supports the following Availability Zones (e.g. `us-east-1a`): From 882e117fee732dfa3042c2243c28bac5b18e0dfe Mon Sep 17 00:00:00 2001 From: nywilken Date: Thu, 16 May 2019 23:15:47 -0400 Subject: [PATCH 0154/1054] resource/aws_lightsail_instance: Add validation for instance name ``` --- PASS: TestAccAWSLightsailInstance_Name (99.68s) ``` --- aws/resource_aws_lightsail_instance.go | 7 +++ aws/resource_aws_lightsail_instance_test.go | 48 ++++++++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_lightsail_instance.go b/aws/resource_aws_lightsail_instance.go index 17fdf90e6037..d5633d6d8648 100644 --- a/aws/resource_aws_lightsail_instance.go +++ b/aws/resource_aws_lightsail_instance.go @@ -3,6 +3,7 @@ package aws import ( "fmt" "log" + "regexp" "strconv" "time" @@ -11,6 +12,7 @@ import ( "github.com/aws/aws-sdk-go/service/lightsail" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/helper/validation" ) func resourceAwsLightsailInstance() *schema.Resource { @@ -27,6 +29,11 @@ func resourceAwsLightsailInstance() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, + ValidateFunc: validation.All( + validation.StringLenBetween(3, 255), + validation.StringMatch(regexp.MustCompile(`^[a-zA-Z]`), "must begin with an alphabetic character, and contain only alphanumeric characters, underscores, hyphens, and dots"), + validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9_\-.]+[^._\-]$`), "must begin with an alphabetic character, and contain only alphanumeric characters, underscores, hyphens, and dots"), + ), }, "availability_zone": { Type: schema.TypeString, diff --git a/aws/resource_aws_lightsail_instance_test.go b/aws/resource_aws_lightsail_instance_test.go index 938f198134d2..523f458de68b 100644 --- a/aws/resource_aws_lightsail_instance_test.go +++ b/aws/resource_aws_lightsail_instance_test.go @@ -3,6 +3,7 @@ package aws import ( "errors" "fmt" + "regexp" "testing" "time" @@ -62,6 +63,51 @@ func TestAccAWSLightsailInstance_euRegion(t *testing.T) { }) } +func TestAccAWSLightsailInstance_Name(t *testing.T) { + var conf lightsail.Instance + lightsailName := fmt.Sprintf("tf-test-lightsail-%d", acctest.RandInt()) + lightsailNameWithSpace := fmt.Sprint(lightsailName, "string with more spaces") + lightsailNameWithTrailingDot := fmt.Sprintf("%s.", lightsailName) + lightsailNameWithUnderscore := fmt.Sprintf("%s_123456", lightsailName) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + IDRefreshName: "aws_lightsail_instance.lightsail_instance_test", + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSLightsailInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSLightsailInstanceConfig_basic(lightsailNameWithSpace), + ExpectError: regexp.MustCompile(`must begin with an alphabetic character.*`), + }, + { + Config: testAccAWSLightsailInstanceConfig_basic(lightsailNameWithTrailingDot), + ExpectError: regexp.MustCompile(`must begin with an alphabetic character.*`), + }, + { + Config: testAccAWSLightsailInstanceConfig_basic(lightsailName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSLightsailInstanceExists("aws_lightsail_instance.lightsail_instance_test", &conf), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "availability_zone"), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "blueprint_id"), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "bundle_id"), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "key_pair_name"), + ), + }, + { + Config: testAccAWSLightsailInstanceConfig_basic(lightsailNameWithUnderscore), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSLightsailInstanceExists("aws_lightsail_instance.lightsail_instance_test", &conf), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "availability_zone"), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "blueprint_id"), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "bundle_id"), + resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "key_pair_name"), + ), + }, + }, + }) +} + func TestAccAWSLightsailInstance_disapear(t *testing.T) { var conf lightsail.Instance lightsailName := fmt.Sprintf("tf-test-lightsail-%d", acctest.RandInt()) @@ -74,7 +120,7 @@ func TestAccAWSLightsailInstance_disapear(t *testing.T) { }) if err != nil { - return fmt.Errorf("Error deleting Lightsail Instance in disapear test") + return fmt.Errorf("error deleting Lightsail Instance in disappear test") } // sleep 7 seconds to give it time, so we don't have to poll From c53bbd2853875f483e7de3f49f0d9f153e3713b5 Mon Sep 17 00:00:00 2001 From: nywilken Date: Tue, 9 Jul 2019 16:26:02 -0400 Subject: [PATCH 0155/1054] Update validation error messaging --- aws/resource_aws_lightsail_instance.go | 4 ++-- aws/resource_aws_lightsail_instance_test.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/aws/resource_aws_lightsail_instance.go b/aws/resource_aws_lightsail_instance.go index d5633d6d8648..15fb0031112b 100644 --- a/aws/resource_aws_lightsail_instance.go +++ b/aws/resource_aws_lightsail_instance.go @@ -31,8 +31,8 @@ func resourceAwsLightsailInstance() *schema.Resource { ForceNew: true, ValidateFunc: validation.All( validation.StringLenBetween(3, 255), - validation.StringMatch(regexp.MustCompile(`^[a-zA-Z]`), "must begin with an alphabetic character, and contain only alphanumeric characters, underscores, hyphens, and dots"), - validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9_\-.]+[^._\-]$`), "must begin with an alphabetic character, and contain only alphanumeric characters, underscores, hyphens, and dots"), + validation.StringMatch(regexp.MustCompile(`^[a-zA-Z]`), "must begin with an alphabetic character"), + validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9_\-.]+[^._\-]$`), "must contain only alphanumeric characters, underscores, hyphens, and dots"), ), }, "availability_zone": { diff --git a/aws/resource_aws_lightsail_instance_test.go b/aws/resource_aws_lightsail_instance_test.go index 523f458de68b..2dee06bb4924 100644 --- a/aws/resource_aws_lightsail_instance_test.go +++ b/aws/resource_aws_lightsail_instance_test.go @@ -66,8 +66,8 @@ func TestAccAWSLightsailInstance_euRegion(t *testing.T) { func TestAccAWSLightsailInstance_Name(t *testing.T) { var conf lightsail.Instance lightsailName := fmt.Sprintf("tf-test-lightsail-%d", acctest.RandInt()) - lightsailNameWithSpace := fmt.Sprint(lightsailName, "string with more spaces") - lightsailNameWithTrailingDot := fmt.Sprintf("%s.", lightsailName) + lightsailNameWithSpaces := fmt.Sprint(lightsailName, "string with spaces") + lightsailNameWithStartingDigit := fmt.Sprintf("01-%s", lightsailName) lightsailNameWithUnderscore := fmt.Sprintf("%s_123456", lightsailName) resource.ParallelTest(t, resource.TestCase{ @@ -77,12 +77,12 @@ func TestAccAWSLightsailInstance_Name(t *testing.T) { CheckDestroy: testAccCheckAWSLightsailInstanceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSLightsailInstanceConfig_basic(lightsailNameWithSpace), - ExpectError: regexp.MustCompile(`must begin with an alphabetic character.*`), + Config: testAccAWSLightsailInstanceConfig_basic(lightsailNameWithSpaces), + ExpectError: regexp.MustCompile(`must contain only alphanumeric characters, underscores, hyphens, and dots`), }, { - Config: testAccAWSLightsailInstanceConfig_basic(lightsailNameWithTrailingDot), - ExpectError: regexp.MustCompile(`must begin with an alphabetic character.*`), + Config: testAccAWSLightsailInstanceConfig_basic(lightsailNameWithStartingDigit), + ExpectError: regexp.MustCompile(`must begin with an alphabetic character`), }, { Config: testAccAWSLightsailInstanceConfig_basic(lightsailName), From 68f0da0dbec7264284c39e3802b4374608351962 Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Tue, 27 Nov 2018 11:13:22 -0600 Subject: [PATCH 0156/1054] Support issuance of ACM private certificate --- aws/resource_aws_acm_certificate.go | 22 +++++++-- aws/resource_aws_acm_certificate_test.go | 49 ++++++++++++++++++++ website/docs/r/acm_certificate.html.markdown | 6 ++- 3 files changed, 73 insertions(+), 4 deletions(-) diff --git a/aws/resource_aws_acm_certificate.go b/aws/resource_aws_acm_certificate.go index 09002b2258f1..fc718a5922e7 100644 --- a/aws/resource_aws_acm_certificate.go +++ b/aws/resource_aws_acm_certificate.go @@ -41,6 +41,11 @@ func resourceAwsAcmCertificate() *schema.Resource { StateFunc: normalizeCert, Sensitive: true, }, + "certificate_authority_arn": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, "domain_name": { Type: schema.TypeString, Optional: true, @@ -73,7 +78,7 @@ func resourceAwsAcmCertificate() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - ConflictsWith: []string{"private_key", "certificate_body", "certificate_chain"}, + ConflictsWith: []string{"private_key", "certificate_body", "certificate_chain", "certificate_authority_arn"}, }, "arn": { Type: schema.TypeString, @@ -115,6 +120,10 @@ func resourceAwsAcmCertificate() *schema.Resource { func resourceAwsAcmCertificateCreate(d *schema.ResourceData, meta interface{}) error { if _, ok := d.GetOk("domain_name"); ok { + if _, ok := d.GetOk("certificate_authority_arn"); ok { + return resourceAwsAcmCertificateCreateRequested(d, meta) + } + if _, ok := d.GetOk("validation_method"); !ok { return errors.New("validation_method must be set when creating a certificate") } @@ -154,8 +163,14 @@ func resourceAwsAcmCertificateCreateImported(d *schema.ResourceData, meta interf func resourceAwsAcmCertificateCreateRequested(d *schema.ResourceData, meta interface{}) error { acmconn := meta.(*AWSClient).acmconn params := &acm.RequestCertificateInput{ - DomainName: aws.String(strings.TrimSuffix(d.Get("domain_name").(string), ".")), - ValidationMethod: aws.String(d.Get("validation_method").(string)), + DomainName: aws.String(strings.TrimSuffix(d.Get("domain_name").(string), ".")), + } + + caARN, ok := d.GetOk("certificate_authority_arn") + if ok { + params.CertificateAuthorityArn = aws.String(caARN.(string)) + } else { + params.ValidationMethod = aws.String(d.Get("validation_method").(string)) } if sans, ok := d.GetOk("subject_alternative_names"); ok { @@ -209,6 +224,7 @@ func resourceAwsAcmCertificateRead(d *schema.ResourceData, meta interface{}) err d.Set("domain_name", resp.Certificate.DomainName) d.Set("arn", resp.Certificate.CertificateArn) + d.Set("certificate_authority_arn", resp.Certificate.CertificateAuthorityArn) if err := d.Set("subject_alternative_names", cleanUpSubjectAlternativeNames(resp.Certificate)); err != nil { return resource.NonRetryableError(err) diff --git a/aws/resource_aws_acm_certificate_test.go b/aws/resource_aws_acm_certificate_test.go index 6428090c4ca3..b50c80b138d1 100644 --- a/aws/resource_aws_acm_certificate_test.go +++ b/aws/resource_aws_acm_certificate_test.go @@ -32,6 +32,15 @@ func testAccAwsAcmCertificateDomainFromEnv(t *testing.T) string { return os.Getenv("ACM_CERTIFICATE_ROOT_DOMAIN") } +func testAccAwsAcmCAARNFromEnv(t *testing.T) string { + if os.Getenv("ACM_CA_ARN") == "" { + t.Skip( + "Environment variable ACM_CA_ARN is not set. " + + "This must to be a valid PCA") + } + return os.Getenv("ACM_CA_ARN") +} + func TestAccAWSAcmCertificate_emailValidation(t *testing.T) { rootDomain := testAccAwsAcmCertificateDomainFromEnv(t) @@ -133,6 +142,36 @@ func TestAccAWSAcmCertificate_root(t *testing.T) { }) } +func TestAccAWSAcmCertificate_privateCert(t *testing.T) { + rootDomain := testAccAwsAcmCertificateDomainFromEnv(t) + caARN := testAccAwsAcmCAARNFromEnv(t) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAcmCertificateDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAcmCertificateConfig_privateCert(rootDomain, caARN), + Check: resource.ComposeTestCheckFunc( + resource.TestMatchResourceAttr("aws_acm_certificate.cert", "arn", certificateArnRegex), + resource.TestCheckResourceAttr("aws_acm_certificate.cert", "domain_name", rootDomain), + resource.TestCheckResourceAttr("aws_acm_certificate.cert", "domain_validation_options.#", "0"), + resource.TestCheckResourceAttr("aws_acm_certificate.cert", "subject_alternative_names.#", "0"), + resource.TestCheckResourceAttr("aws_acm_certificate.cert", "validation_emails.#", "0"), + resource.TestCheckResourceAttr("aws_acm_certificate.cert", "validation_method", "NONE"), + resource.TestCheckResourceAttr("aws_acm_certificate.cert", "certificate_authority_arn", caARN), + ), + }, + { + ResourceName: "aws_acm_certificate.cert", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccAWSAcmCertificate_root_TrailingPeriod(t *testing.T) { rootDomain := testAccAwsAcmCertificateDomainFromEnv(t) domain := fmt.Sprintf("%s.", rootDomain) @@ -529,6 +568,16 @@ resource "aws_acm_certificate" "cert" { } +func testAccAcmCertificateConfig_privateCert(domainName, caARN string) string { + return fmt.Sprintf(` +resource "aws_acm_certificate" "cert" { + domain_name = "%s" + certificate_authority_arn = "%s" +} +`, domainName, caARN) + +} + func testAccAcmCertificateConfig_subjectAlternativeNames(domainName, subjectAlternativeNames, validationMethod string) string { return fmt.Sprintf(` resource "aws_acm_certificate" "cert" { diff --git a/website/docs/r/acm_certificate.html.markdown b/website/docs/r/acm_certificate.html.markdown index e90a176edb64..9bb7643a5d2e 100644 --- a/website/docs/r/acm_certificate.html.markdown +++ b/website/docs/r/acm_certificate.html.markdown @@ -88,6 +88,10 @@ The following arguments are supported: * `private_key` - (Required) The certificate's PEM-formatted private key * `certificate_body` - (Required) The certificate's PEM-formatted public key * `certificate_chain` - (Optional) The certificate's PEM-formatted chain +* Creating a private CA issued certificate + * `domain_name` - (Required) A domain name for which the certificate should be issued + * `certificate_authority_arn` - (Required) ARN of an ACMPCA + * `subject_alternative_names` - (Optional) A list of domains that should be SANs in the issued certificate * `tags` - (Optional) A mapping of tags to assign to the resource. ## Attributes Reference @@ -115,4 +119,4 @@ Certificates can be imported using their ARN, e.g. ``` $ terraform import aws_acm_certificate.cert arn:aws:acm:eu-central-1:123456789012:certificate/7e7a28d2-163f-4b8f-b9cd-822f96c08d6a -``` \ No newline at end of file +``` From d96d866d29bf1b1106ca6ffe3bcbdf3cb08ebf8f Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Tue, 5 Feb 2019 23:57:36 -0600 Subject: [PATCH 0157/1054] Add IdempotencyToken --- aws/resource_aws_acm_certificate.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/aws/resource_aws_acm_certificate.go b/aws/resource_aws_acm_certificate.go index fc718a5922e7..5f4942d1ddab 100644 --- a/aws/resource_aws_acm_certificate.go +++ b/aws/resource_aws_acm_certificate.go @@ -1,6 +1,7 @@ package aws import ( + "crypto/md5" "errors" "fmt" "log" @@ -168,6 +169,16 @@ func resourceAwsAcmCertificateCreateRequested(d *schema.ResourceData, meta inter caARN, ok := d.GetOk("certificate_authority_arn") if ok { + // For some reason, when you request certificates with different PCA ARN, + // AWS considers them as same request, this is a workaround. In case Amazon + // think it's a bug and decide to fix it, this workaround should still work, + // we can simplely remove it once it's fixed + hash := md5.New() + _, err := hash.Write([]byte(caARN.(string))) + if err != nil { + return fmt.Errorf("Error generating hash: %s", err) + } + params.IdempotencyToken = aws.String(fmt.Sprintf("%x", hash.Sum(nil))) params.CertificateAuthorityArn = aws.String(caARN.(string)) } else { params.ValidationMethod = aws.String(d.Get("validation_method").(string)) From ba50b52f8239b1c66575f83ebe8e39131cf28b93 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 20:03:46 -0400 Subject: [PATCH 0158/1054] resource/aws_athena_workgroup: Update schema to match API nesting, add attribute validation, and some finishing touches Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSAthenaWorkGroup_disappears (9.08s) --- PASS: TestAccAWSAthenaWorkGroup_basic (15.76s) --- PASS: TestAccAWSAthenaWorkGroup_Configuration_ResultConfiguration_EncryptionConfiguration_SseS3 (25.96s) --- PASS: TestAccAWSAthenaWorkGroup_Configuration_EnforceWorkgroupConfiguration (27.10s) --- PASS: TestAccAWSAthenaWorkGroup_Tags (31.92s) --- PASS: TestAccAWSAthenaWorkGroup_State (36.06s) --- PASS: TestAccAWSAthenaWorkGroup_Description (36.53s) --- PASS: TestAccAWSAthenaWorkGroup_Configuration_BytesScannedCutoffPerQuery (37.99s) --- PASS: TestAccAWSAthenaWorkGroup_Configuration_PublishCloudWatchMetricsEnabled (41.14s) --- PASS: TestAccAWSAthenaWorkGroup_Configuration_ResultConfiguration_OutputLocation (54.00s) --- PASS: TestAccAWSAthenaWorkGroup_Configuration_ResultConfiguration_EncryptionConfiguration_Kms (57.21s) PASS ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSAthenaWorkGroup_disappears (13.12s) --- PASS: TestAccAWSAthenaWorkGroup_basic (19.15s) --- PASS: TestAccAWSAthenaWorkGroup_Configuration_ResultConfiguration_EncryptionConfiguration_SseS3 (21.32s) --- PASS: TestAccAWSAthenaWorkGroup_Configuration_PublishCloudWatchMetricsEnabled (28.45s) --- PASS: TestAccAWSAthenaWorkGroup_Configuration_EnforceWorkgroupConfiguration (33.33s) --- PASS: TestAccAWSAthenaWorkGroup_Description (33.73s) --- PASS: TestAccAWSAthenaWorkGroup_Configuration_BytesScannedCutoffPerQuery (36.62s) --- PASS: TestAccAWSAthenaWorkGroup_Tags (39.83s) --- PASS: TestAccAWSAthenaWorkGroup_State (45.99s) --- PASS: TestAccAWSAthenaWorkGroup_Configuration_ResultConfiguration_EncryptionConfiguration_Kms (63.29s) --- PASS: TestAccAWSAthenaWorkGroup_Configuration_ResultConfiguration_OutputLocation (64.17s) PASS ``` --- aws/resource_aws_athena_workgroup.go | 428 ++++++++++-------- aws/resource_aws_athena_workgroup_test.go | 206 +++++---- website/docs/r/athena_workgroup.html.markdown | 6 +- 3 files changed, 372 insertions(+), 268 deletions(-) diff --git a/aws/resource_aws_athena_workgroup.go b/aws/resource_aws_athena_workgroup.go index 4925727fc9d0..4bd1b45ef15b 100644 --- a/aws/resource_aws_athena_workgroup.go +++ b/aws/resource_aws_athena_workgroup.go @@ -3,13 +3,13 @@ package aws import ( "fmt" "log" + "regexp" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/service/athena" - "github.com/hashicorp/terraform/helper/validation" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/helper/validation" ) func resourceAwsAthenaWorkgroup() *schema.Resource { @@ -23,45 +23,87 @@ func resourceAwsAthenaWorkgroup() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": { + "arn": { Type: schema.TypeString, - Required: true, - ForceNew: true, + Computed: true, }, - "description": { - Type: schema.TypeString, - Optional: true, + "configuration": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + DiffSuppressFunc: suppressMissingOptionalConfigurationBlock, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "bytes_scanned_cutoff_per_query": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.Any( + validation.IntAtLeast(10485760), + validation.IntInSlice([]int{0}), + ), + }, + "enforce_workgroup_configuration": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "publish_cloudwatch_metrics_enabled": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "result_configuration": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "encryption_configuration": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "encryption_option": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + athena.EncryptionOptionCseKms, + athena.EncryptionOptionSseKms, + athena.EncryptionOptionSseS3, + }, false), + }, + "kms_key_arn": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateArn, + }, + }, + }, + }, + "output_location": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + }, + }, }, - "bytes_scanned_cutoff_per_query": { - Type: schema.TypeInt, + "description": { + Type: schema.TypeString, Optional: true, - ValidateFunc: validation.IntAtLeast(10485760), - }, - "enforce_workgroup_configuration": { - Type: schema.TypeBool, - Optional: true, - Default: true, + ValidateFunc: validation.StringLenBetween(0, 1024), }, - "publish_cloudwatch_metrics_enabled": { - Type: schema.TypeBool, - Optional: true, - }, - "output_location": { - Type: schema.TypeString, - Optional: true, - }, - "encryption_option": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - athena.EncryptionOptionCseKms, - athena.EncryptionOptionSseKms, - athena.EncryptionOptionSseS3, - }, false), - }, - "kms_key": { + "name": { Type: schema.TypeString, - Optional: true, + Required: true, + ForceNew: true, + ValidateFunc: validation.All( + validation.StringLenBetween(1, 128), + validation.StringMatch(regexp.MustCompile(`^[a-zA-z0-9._-]+$`), "must contain only alphanumeric characters, periods, underscores, and hyphens"), + ), }, "state": { Type: schema.TypeString, @@ -72,10 +114,6 @@ func resourceAwsAthenaWorkgroup() *schema.Resource { athena.WorkGroupStateEnabled, }, false), }, - "arn": { - Type: schema.TypeString, - Computed: true, - }, "tags": tagsSchema(), }, } @@ -87,69 +125,14 @@ func resourceAwsAthenaWorkgroupCreate(d *schema.ResourceData, meta interface{}) name := d.Get("name").(string) input := &athena.CreateWorkGroupInput{ - Name: aws.String(name), + Configuration: expandAthenaWorkGroupConfiguration(d.Get("configuration").([]interface{})), + Name: aws.String(name), } - basicConfig := false - resultConfig := false - encryptConfig := false - if v, ok := d.GetOk("description"); ok { input.Description = aws.String(v.(string)) } - inputConfiguration := &athena.WorkGroupConfiguration{} - - if v, ok := d.GetOk("bytes_scanned_cutoff_per_query"); ok { - basicConfig = true - inputConfiguration.BytesScannedCutoffPerQuery = aws.Int64(int64(v.(int))) - } - - if v, ok := d.GetOk("enforce_workgroup_configuration"); ok { - basicConfig = true - inputConfiguration.EnforceWorkGroupConfiguration = aws.Bool(v.(bool)) - } - - if v, ok := d.GetOk("publish_cloudwatch_metrics_enabled"); ok { - basicConfig = true - inputConfiguration.PublishCloudWatchMetricsEnabled = aws.Bool(v.(bool)) - } - - resultConfiguration := &athena.ResultConfiguration{} - - if v, ok := d.GetOk("output_location"); ok { - resultConfig = true - resultConfiguration.OutputLocation = aws.String(v.(string)) - } - - encryptionConfiguration := &athena.EncryptionConfiguration{} - - if v, ok := d.GetOk("encryption_option"); ok { - resultConfig = true - encryptConfig = true - encryptionConfiguration.EncryptionOption = aws.String(v.(string)) - - if v.(string) == athena.EncryptionOptionCseKms || v.(string) == athena.EncryptionOptionSseKms { - if vkms, ok := d.GetOk("kms_key"); ok { - encryptionConfiguration.KmsKey = aws.String(vkms.(string)) - } else { - return fmt.Errorf("KMS Key required but not provided for encryption_option: %s", v.(string)) - } - } - } - - if basicConfig { - input.Configuration = inputConfiguration - } - - if resultConfig { - input.Configuration.ResultConfiguration = resultConfiguration - - if encryptConfig { - input.Configuration.ResultConfiguration.EncryptionConfiguration = encryptionConfiguration - } - } - // Prevent the below error: // InvalidRequestException: Tags provided upon WorkGroup creation must not be empty if v := d.Get("tags").(map[string]interface{}); len(v) > 0 { @@ -207,24 +190,14 @@ func resourceAwsAthenaWorkgroupRead(d *schema.ResourceData, meta interface{}) er d.Set("arn", arn.String()) d.Set("description", resp.WorkGroup.Description) - d.Set("name", resp.WorkGroup.Name) - d.Set("state", resp.WorkGroup.State) - - if resp.WorkGroup.Configuration != nil { - d.Set("bytes_scanned_cutoff_per_query", resp.WorkGroup.Configuration.BytesScannedCutoffPerQuery) - d.Set("enforce_workgroup_configuration", resp.WorkGroup.Configuration.EnforceWorkGroupConfiguration) - d.Set("publish_cloudwatch_metrics_enabled", resp.WorkGroup.Configuration.PublishCloudWatchMetricsEnabled) - - if resp.WorkGroup.Configuration.ResultConfiguration != nil { - d.Set("output_location", resp.WorkGroup.Configuration.ResultConfiguration.OutputLocation) - if resp.WorkGroup.Configuration.ResultConfiguration.EncryptionConfiguration != nil { - d.Set("encryption_option", resp.WorkGroup.Configuration.ResultConfiguration.EncryptionConfiguration.EncryptionOption) - d.Set("kms_key", resp.WorkGroup.Configuration.ResultConfiguration.EncryptionConfiguration.KmsKey) - } - } + if err := d.Set("configuration", flattenAthenaWorkGroupConfiguration(resp.WorkGroup.Configuration)); err != nil { + return fmt.Errorf("error setting configuration: %s", err) } + d.Set("name", resp.WorkGroup.Name) + d.Set("state", resp.WorkGroup.State) + err = saveTagsAthena(conn, d, d.Get("arn").(string)) if isAWSErr(err, athena.ErrCodeInvalidRequestException, "is not found") { @@ -260,119 +233,204 @@ func resourceAwsAthenaWorkgroupUpdate(d *schema.ResourceData, meta interface{}) conn := meta.(*AWSClient).athenaconn workGroupUpdate := false - resultConfigUpdate := false - configUpdate := false - encryptionUpdate := false - removeEncryption := false input := &athena.UpdateWorkGroupInput{ WorkGroup: aws.String(d.Get("name").(string)), } + if d.HasChange("configuration") { + workGroupUpdate = true + input.ConfigurationUpdates = expandAthenaWorkGroupConfigurationUpdates(d.Get("configuration").([]interface{})) + } + if d.HasChange("description") { workGroupUpdate = true input.Description = aws.String(d.Get("description").(string)) } - inputConfigurationUpdates := &athena.WorkGroupConfigurationUpdates{} - - if d.HasChange("bytes_scanned_cutoff_per_query") { + if d.HasChange("state") { workGroupUpdate = true - configUpdate = true + input.State = aws.String(d.Get("state").(string)) + } - if v, ok := d.GetOk("bytes_scanned_cutoff_per_query"); ok { - inputConfigurationUpdates.BytesScannedCutoffPerQuery = aws.Int64(int64(v.(int))) - } else { - inputConfigurationUpdates.RemoveBytesScannedCutoffPerQuery = aws.Bool(true) + if workGroupUpdate { + _, err := conn.UpdateWorkGroup(input) + + if err != nil { + return fmt.Errorf("error updating Athena WorkGroup (%s): %s", d.Id(), err) } } - if d.HasChange("enforce_workgroup_configuration") { - workGroupUpdate = true - configUpdate = true + if d.HasChange("tags") { + err := setTagsAthena(conn, d, d.Get("arn").(string)) - v := d.Get("enforce_workgroup_configuration") - inputConfigurationUpdates.EnforceWorkGroupConfiguration = aws.Bool(v.(bool)) + if err != nil { + return fmt.Errorf("error updating tags: %s", err) + } } - if d.HasChange("publish_cloudwatch_metrics_enabled") { - workGroupUpdate = true - configUpdate = true + return resourceAwsAthenaWorkgroupRead(d, meta) +} + +func expandAthenaWorkGroupConfiguration(l []interface{}) *athena.WorkGroupConfiguration { + if len(l) == 0 || l[0] == nil { + return nil + } + + m := l[0].(map[string]interface{}) + + configuration := &athena.WorkGroupConfiguration{} + + if v, ok := m["bytes_scanned_cutoff_per_query"]; ok && v.(int) > 0 { + configuration.BytesScannedCutoffPerQuery = aws.Int64(int64(v.(int))) + } + + if v, ok := m["enforce_workgroup_configuration"]; ok { + configuration.EnforceWorkGroupConfiguration = aws.Bool(v.(bool)) + } + + if v, ok := m["publish_cloudwatch_metrics_enabled"]; ok { + configuration.PublishCloudWatchMetricsEnabled = aws.Bool(v.(bool)) + } + + if v, ok := m["result_configuration"]; ok { + configuration.ResultConfiguration = expandAthenaWorkGroupResultConfiguration(v.([]interface{})) + } + + return configuration +} + +func expandAthenaWorkGroupConfigurationUpdates(l []interface{}) *athena.WorkGroupConfigurationUpdates { + if len(l) == 0 || l[0] == nil { + return nil + } + + m := l[0].(map[string]interface{}) + + configurationUpdates := &athena.WorkGroupConfigurationUpdates{} + + if v, ok := m["bytes_scanned_cutoff_per_query"]; ok && v.(int) > 0 { + configurationUpdates.BytesScannedCutoffPerQuery = aws.Int64(int64(v.(int))) + } else { + configurationUpdates.RemoveBytesScannedCutoffPerQuery = aws.Bool(true) + } + + if v, ok := m["enforce_workgroup_configuration"]; ok { + configurationUpdates.EnforceWorkGroupConfiguration = aws.Bool(v.(bool)) + } + + if v, ok := m["publish_cloudwatch_metrics_enabled"]; ok { + configurationUpdates.PublishCloudWatchMetricsEnabled = aws.Bool(v.(bool)) + } + + if v, ok := m["result_configuration"]; ok { + configurationUpdates.ResultConfigurationUpdates = expandAthenaWorkGroupResultConfigurationUpdates(v.([]interface{})) + } + + return configurationUpdates +} + +func expandAthenaWorkGroupResultConfiguration(l []interface{}) *athena.ResultConfiguration { + if len(l) == 0 || l[0] == nil { + return nil + } + + m := l[0].(map[string]interface{}) + + resultConfiguration := &athena.ResultConfiguration{} + + if v, ok := m["encryption_configuration"]; ok { + resultConfiguration.EncryptionConfiguration = expandAthenaWorkGroupEncryptionConfiguration(v.([]interface{})) + } + + if v, ok := m["output_location"]; ok && v.(string) != "" { + resultConfiguration.OutputLocation = aws.String(v.(string)) + } + + return resultConfiguration +} - v := d.Get("publish_cloudwatch_metrics_enabled") - inputConfigurationUpdates.PublishCloudWatchMetricsEnabled = aws.Bool(v.(bool)) +func expandAthenaWorkGroupResultConfigurationUpdates(l []interface{}) *athena.ResultConfigurationUpdates { + if len(l) == 0 || l[0] == nil { + return nil } + m := l[0].(map[string]interface{}) + resultConfigurationUpdates := &athena.ResultConfigurationUpdates{} - if d.HasChange("output_location") { - workGroupUpdate = true - configUpdate = true - resultConfigUpdate = true + if v, ok := m["encryption_configuration"]; ok { + resultConfigurationUpdates.EncryptionConfiguration = expandAthenaWorkGroupEncryptionConfiguration(v.([]interface{})) + } else { + resultConfigurationUpdates.RemoveEncryptionConfiguration = aws.Bool(true) + } - if v, ok := d.GetOk("output_location"); ok { - resultConfigurationUpdates.OutputLocation = aws.String(v.(string)) - } else { - resultConfigurationUpdates.RemoveOutputLocation = aws.Bool(true) - } + if v, ok := m["output_location"]; ok && v.(string) != "" { + resultConfigurationUpdates.OutputLocation = aws.String(v.(string)) + } else { + resultConfigurationUpdates.RemoveOutputLocation = aws.Bool(true) } + return resultConfigurationUpdates +} + +func expandAthenaWorkGroupEncryptionConfiguration(l []interface{}) *athena.EncryptionConfiguration { + if len(l) == 0 || l[0] == nil { + return nil + } + + m := l[0].(map[string]interface{}) + encryptionConfiguration := &athena.EncryptionConfiguration{} - if d.HasChange("encryption_option") { - workGroupUpdate = true - configUpdate = true - resultConfigUpdate = true - encryptionUpdate = true - - if v, ok := d.GetOk("encryption_option"); ok { - encryptionConfiguration.EncryptionOption = aws.String(v.(string)) - - if v.(string) == athena.EncryptionOptionCseKms || v.(string) == athena.EncryptionOptionSseKms { - if vkms, ok := d.GetOk("kms_key"); ok { - encryptionConfiguration.KmsKey = aws.String(vkms.(string)) - } else { - return fmt.Errorf("KMS Key required but not provided for encryption_option: %s", v.(string)) - } - } - } else { - removeEncryption = true - resultConfigurationUpdates.RemoveEncryptionConfiguration = aws.Bool(true) - } + if v, ok := m["encryption_option"]; ok && v.(string) != "" { + encryptionConfiguration.EncryptionOption = aws.String(v.(string)) } - if d.HasChange("state") { - workGroupUpdate = true - input.State = aws.String(d.Get("state").(string)) + if v, ok := m["kms_key_arn"]; ok && v.(string) != "" { + encryptionConfiguration.KmsKey = aws.String(v.(string)) } - if workGroupUpdate { - if configUpdate { - input.ConfigurationUpdates = inputConfigurationUpdates - } + return encryptionConfiguration +} - if resultConfigUpdate { - input.ConfigurationUpdates.ResultConfigurationUpdates = resultConfigurationUpdates +func flattenAthenaWorkGroupConfiguration(configuration *athena.WorkGroupConfiguration) []interface{} { + if configuration == nil { + return []interface{}{} + } - if encryptionUpdate && !removeEncryption { - input.ConfigurationUpdates.ResultConfigurationUpdates.EncryptionConfiguration = encryptionConfiguration - } - } + m := map[string]interface{}{ + "bytes_scanned_cutoff_per_query": aws.Int64Value(configuration.BytesScannedCutoffPerQuery), + "enforce_workgroup_configuration": aws.BoolValue(configuration.EnforceWorkGroupConfiguration), + "publish_cloudwatch_metrics_enabled": aws.BoolValue(configuration.PublishCloudWatchMetricsEnabled), + "result_configuration": flattenAthenaWorkGroupResultConfiguration(configuration.ResultConfiguration), + } - _, err := conn.UpdateWorkGroup(input) + return []interface{}{m} +} - if err != nil { - return fmt.Errorf("error updating Athena WorkGroup (%s): %s", d.Id(), err) - } +func flattenAthenaWorkGroupResultConfiguration(resultConfiguration *athena.ResultConfiguration) []interface{} { + if resultConfiguration == nil { + return []interface{}{} } - if d.HasChange("tags") { - err := setTagsAthena(conn, d, d.Get("arn").(string)) + m := map[string]interface{}{ + "encryption_configuration": flattenAthenaWorkGroupEncryptionConfiguration(resultConfiguration.EncryptionConfiguration), + "output_location": aws.StringValue(resultConfiguration.OutputLocation), + } - if err != nil { - return fmt.Errorf("error updating tags: %s", err) - } + return []interface{}{m} +} + +func flattenAthenaWorkGroupEncryptionConfiguration(encryptionConfiguration *athena.EncryptionConfiguration) []interface{} { + if encryptionConfiguration == nil { + return []interface{}{} } - return resourceAwsAthenaWorkgroupRead(d, meta) + m := map[string]interface{}{ + "encryption_option": aws.StringValue(encryptionConfiguration.EncryptionOption), + "kms_key_arn": aws.StringValue(encryptionConfiguration.KmsKey), + } + + return []interface{}{m} } diff --git a/aws/resource_aws_athena_workgroup_test.go b/aws/resource_aws_athena_workgroup_test.go index b298e41b0a38..a61d43bb6c4e 100644 --- a/aws/resource_aws_athena_workgroup_test.go +++ b/aws/resource_aws_athena_workgroup_test.go @@ -26,6 +26,12 @@ func TestAccAWSAthenaWorkGroup_basic(t *testing.T) { Config: testAccAthenaWorkGroupConfig(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "athena", fmt.Sprintf("workgroup/%s", rName)), + resource.TestCheckResourceAttr(resourceName, "configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.enforce_workgroup_configuration", "true"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.publish_cloudwatch_metrics_enabled", "true"), + resource.TestCheckResourceAttr(resourceName, "description", ""), + resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "state", athena.WorkGroupStateEnabled), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), @@ -61,12 +67,10 @@ func TestAccAWSAthenaWorkGroup_disappears(t *testing.T) { }) } -func TestAccAWSAthenaWorkGroup_Description(t *testing.T) { +func TestAccAWSAthenaWorkGroup_Configuration_BytesScannedCutoffPerQuery(t *testing.T) { var workgroup1, workgroup2 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" - rDescription := acctest.RandString(20) - rDescriptionUpdate := acctest.RandString(20) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -74,10 +78,11 @@ func TestAccAWSAthenaWorkGroup_Description(t *testing.T) { CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ { - Config: testAccAthenaWorkGroupConfigDescription(rName, rDescription), + Config: testAccAthenaWorkGroupConfigConfigurationBytesScannedCutoffPerQuery(rName, 12582912), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), - resource.TestCheckResourceAttr(resourceName, "description", rDescription), + resource.TestCheckResourceAttr(resourceName, "configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.bytes_scanned_cutoff_per_query", "12582912"), ), }, { @@ -86,22 +91,21 @@ func TestAccAWSAthenaWorkGroup_Description(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccAthenaWorkGroupConfigDescription(rName, rDescriptionUpdate), + Config: testAccAthenaWorkGroupConfigConfigurationBytesScannedCutoffPerQuery(rName, 10485760), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), - resource.TestCheckResourceAttr(resourceName, "description", rDescriptionUpdate), + resource.TestCheckResourceAttr(resourceName, "configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.bytes_scanned_cutoff_per_query", "10485760"), ), }, }, }) } -func TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery(t *testing.T) { +func TestAccAWSAthenaWorkGroup_Configuration_EnforceWorkgroupConfiguration(t *testing.T) { var workgroup1, workgroup2 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" - rBytesScannedCutoffPerQuery := "10485760" - rBytesScannedCutoffPerQueryUpdate := "12582912" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -109,10 +113,11 @@ func TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery(t *testing.T) { CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ { - Config: testAccAthenaWorkGroupConfigBytesScannedCutoffPerQuery(rName, rBytesScannedCutoffPerQuery), + Config: testAccAthenaWorkGroupConfigConfigurationEnforceWorkgroupConfiguration(rName, false), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), - resource.TestCheckResourceAttr(resourceName, "bytes_scanned_cutoff_per_query", rBytesScannedCutoffPerQuery), + resource.TestCheckResourceAttr(resourceName, "configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.enforce_workgroup_configuration", "false"), ), }, { @@ -121,22 +126,21 @@ func TestAccAWSAthenaWorkGroup_BytesScannedCutoffPerQuery(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccAthenaWorkGroupConfigBytesScannedCutoffPerQuery(rName, rBytesScannedCutoffPerQueryUpdate), + Config: testAccAthenaWorkGroupConfigConfigurationEnforceWorkgroupConfiguration(rName, true), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), - resource.TestCheckResourceAttr(resourceName, "bytes_scanned_cutoff_per_query", rBytesScannedCutoffPerQueryUpdate), + resource.TestCheckResourceAttr(resourceName, "configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.enforce_workgroup_configuration", "true"), ), }, }, }) } -func TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration(t *testing.T) { +func TestAccAWSAthenaWorkGroup_Configuration_PublishCloudWatchMetricsEnabled(t *testing.T) { var workgroup1, workgroup2 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" - rEnforce := "true" - rEnforceUpdate := "false" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -144,10 +148,11 @@ func TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration(t *testing.T) { CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ { - Config: testAccAthenaWorkGroupConfigEnforceWorkgroupConfiguration(rName, rEnforce), + Config: testAccAthenaWorkGroupConfigConfigurationPublishCloudWatchMetricsEnabled(rName, false), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), - resource.TestCheckResourceAttr(resourceName, "enforce_workgroup_configuration", rEnforce), + resource.TestCheckResourceAttr(resourceName, "configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.publish_cloudwatch_metrics_enabled", "false"), ), }, { @@ -156,22 +161,21 @@ func TestAccAWSAthenaWorkGroup_EnforceWorkgroupConfiguration(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccAthenaWorkGroupConfigEnforceWorkgroupConfiguration(rName, rEnforceUpdate), + Config: testAccAthenaWorkGroupConfigConfigurationPublishCloudWatchMetricsEnabled(rName, true), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), - resource.TestCheckResourceAttr(resourceName, "enforce_workgroup_configuration", rEnforceUpdate), + resource.TestCheckResourceAttr(resourceName, "configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.publish_cloudwatch_metrics_enabled", "true"), ), }, }, }) } -func TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled(t *testing.T) { - var workgroup1, workgroup2 athena.WorkGroup +func TestAccAWSAthenaWorkGroup_Configuration_ResultConfiguration_EncryptionConfiguration_SseS3(t *testing.T) { + var workgroup1 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" - rEnabled := "true" - rEnabledUpdate := "false" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -179,10 +183,13 @@ func TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled(t *testing.T) { CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ { - Config: testAccAthenaWorkGroupConfigPublishCloudWatchMetricsEnabled(rName, rEnabled), + Config: testAccAthenaWorkGroupConfigConfigurationResultConfigurationEncryptionConfigurationEncryptionOptionSseS3(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), - resource.TestCheckResourceAttr(resourceName, "publish_cloudwatch_metrics_enabled", rEnabled), + resource.TestCheckResourceAttr(resourceName, "configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.result_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.result_configuration.0.encryption_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.result_configuration.0.encryption_configuration.0.encryption_option", athena.EncryptionOptionSseS3), ), }, { @@ -190,23 +197,16 @@ func TestAccAWSAthenaWorkGroup_PublishCloudWatchMetricsEnabled(t *testing.T) { ImportState: true, ImportStateVerify: true, }, - { - Config: testAccAthenaWorkGroupConfigPublishCloudWatchMetricsEnabled(rName, rEnabledUpdate), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), - resource.TestCheckResourceAttr(resourceName, "publish_cloudwatch_metrics_enabled", rEnabledUpdate), - ), - }, }, }) } -func TestAccAWSAthenaWorkGroup_OutputLocation(t *testing.T) { +func TestAccAWSAthenaWorkGroup_Configuration_ResultConfiguration_EncryptionConfiguration_Kms(t *testing.T) { var workgroup1, workgroup2 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" - rOutputLocation1 := fmt.Sprintf("%s-1", rName) - rOutputLocation2 := fmt.Sprintf("%s-2", rName) + rEncryption := athena.EncryptionOptionSseKms + rEncryption2 := athena.EncryptionOptionCseKms resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -214,10 +214,13 @@ func TestAccAWSAthenaWorkGroup_OutputLocation(t *testing.T) { CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ { - Config: testAccAthenaWorkGroupConfigOutputLocation(rName, rOutputLocation1), + Config: testAccAthenaWorkGroupConfigConfigurationResultConfigurationEncryptionConfigurationEncryptionOptionWithKms(rName, rEncryption), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), - resource.TestCheckResourceAttr(resourceName, "output_location", "s3://"+rOutputLocation1+"/test/output"), + resource.TestCheckResourceAttr(resourceName, "configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.result_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.result_configuration.0.encryption_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.result_configuration.0.encryption_configuration.0.encryption_option", rEncryption), ), }, { @@ -226,21 +229,25 @@ func TestAccAWSAthenaWorkGroup_OutputLocation(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccAthenaWorkGroupConfigOutputLocation(rName, rOutputLocation2), + Config: testAccAthenaWorkGroupConfigConfigurationResultConfigurationEncryptionConfigurationEncryptionOptionWithKms(rName, rEncryption2), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), - resource.TestCheckResourceAttr(resourceName, "output_location", "s3://"+rOutputLocation2+"/test/output"), + resource.TestCheckResourceAttr(resourceName, "configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.result_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.result_configuration.0.encryption_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.result_configuration.0.encryption_configuration.0.encryption_option", rEncryption2), ), }, }, }) } -func TestAccAWSAthenaWorkGroup_SseS3Encryption(t *testing.T) { - var workgroup1 athena.WorkGroup +func TestAccAWSAthenaWorkGroup_Configuration_ResultConfiguration_OutputLocation(t *testing.T) { + var workgroup1, workgroup2 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" - rEncryption := athena.EncryptionOptionSseS3 + rOutputLocation1 := fmt.Sprintf("%s-1", rName) + rOutputLocation2 := fmt.Sprintf("%s-2", rName) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -248,10 +255,12 @@ func TestAccAWSAthenaWorkGroup_SseS3Encryption(t *testing.T) { CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ { - Config: testAccAthenaWorkGroupConfigEncryptionS3(rName, rEncryption), + Config: testAccAthenaWorkGroupConfigConfigurationResultConfigurationOutputLocation(rName, rOutputLocation1), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), - resource.TestCheckResourceAttr(resourceName, "encryption_option", rEncryption), + resource.TestCheckResourceAttr(resourceName, "configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.result_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.result_configuration.0.output_location", "s3://"+rOutputLocation1+"/test/output"), ), }, { @@ -259,16 +268,25 @@ func TestAccAWSAthenaWorkGroup_SseS3Encryption(t *testing.T) { ImportState: true, ImportStateVerify: true, }, + { + Config: testAccAthenaWorkGroupConfigConfigurationResultConfigurationOutputLocation(rName, rOutputLocation2), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), + resource.TestCheckResourceAttr(resourceName, "configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.result_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "configuration.0.result_configuration.0.output_location", "s3://"+rOutputLocation2+"/test/output"), + ), + }, }, }) } -func TestAccAWSAthenaWorkGroup_KmsEncryption(t *testing.T) { +func TestAccAWSAthenaWorkGroup_Description(t *testing.T) { var workgroup1, workgroup2 athena.WorkGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_athena_workgroup.test" - rEncryption := athena.EncryptionOptionSseKms - rEncryption2 := athena.EncryptionOptionCseKms + rDescription := acctest.RandString(20) + rDescriptionUpdate := acctest.RandString(20) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -276,10 +294,10 @@ func TestAccAWSAthenaWorkGroup_KmsEncryption(t *testing.T) { CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ { - Config: testAccAthenaWorkGroupConfigEncryptionKms(rName, rEncryption), + Config: testAccAthenaWorkGroupConfigDescription(rName, rDescription), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup1), - resource.TestCheckResourceAttr(resourceName, "encryption_option", rEncryption), + resource.TestCheckResourceAttr(resourceName, "description", rDescription), ), }, { @@ -288,10 +306,10 @@ func TestAccAWSAthenaWorkGroup_KmsEncryption(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccAthenaWorkGroupConfigEncryptionKms(rName, rEncryption2), + Config: testAccAthenaWorkGroupConfigDescription(rName, rDescriptionUpdate), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAthenaWorkGroupExists(resourceName, &workgroup2), - resource.TestCheckResourceAttr(resourceName, "encryption_option", rEncryption2), + resource.TestCheckResourceAttr(resourceName, "description", rDescriptionUpdate), ), }, }, @@ -457,43 +475,52 @@ resource "aws_athena_workgroup" "test" { `, rName) } -func testAccAthenaWorkGroupConfigDescription(rName string, rDescription string) string { +func testAccAthenaWorkGroupConfigDescription(rName string, description string) string { return fmt.Sprintf(` resource "aws_athena_workgroup" "test" { description = %[2]q name = %[1]q } -`, rName, rDescription) +`, rName, description) } -func testAccAthenaWorkGroupConfigBytesScannedCutoffPerQuery(rName string, rBytesScannedCutoffPerQuery string) string { +func testAccAthenaWorkGroupConfigConfigurationBytesScannedCutoffPerQuery(rName string, bytesScannedCutoffPerQuery int) string { return fmt.Sprintf(` resource "aws_athena_workgroup" "test" { - bytes_scanned_cutoff_per_query = %[2]s - name = %[1]q + name = %[1]q + + configuration { + bytes_scanned_cutoff_per_query = %[2]d + } } -`, rName, rBytesScannedCutoffPerQuery) +`, rName, bytesScannedCutoffPerQuery) } -func testAccAthenaWorkGroupConfigEnforceWorkgroupConfiguration(rName string, rEnforce string) string { +func testAccAthenaWorkGroupConfigConfigurationEnforceWorkgroupConfiguration(rName string, enforceWorkgroupConfiguration bool) string { return fmt.Sprintf(` resource "aws_athena_workgroup" "test" { - enforce_workgroup_configuration = %[2]s - name = %[1]q + name = %[1]q + + configuration { + enforce_workgroup_configuration = %[2]t + } } -`, rName, rEnforce) +`, rName, enforceWorkgroupConfiguration) } -func testAccAthenaWorkGroupConfigPublishCloudWatchMetricsEnabled(rName string, rEnable string) string { +func testAccAthenaWorkGroupConfigConfigurationPublishCloudWatchMetricsEnabled(rName string, publishCloudwatchMetricsEnabled bool) string { return fmt.Sprintf(` resource "aws_athena_workgroup" "test" { - name = %[1]q - publish_cloudwatch_metrics_enabled = %[2]s + name = %[1]q + + configuration { + publish_cloudwatch_metrics_enabled = %[2]t + } } -`, rName, rEnable) +`, rName, publishCloudwatchMetricsEnabled) } -func testAccAthenaWorkGroupConfigOutputLocation(rName string, rOutputLocation string) string { +func testAccAthenaWorkGroupConfigConfigurationResultConfigurationOutputLocation(rName string, bucketName string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test"{ bucket = %[2]q @@ -501,22 +528,34 @@ resource "aws_s3_bucket" "test"{ } resource "aws_athena_workgroup" "test" { - name = %[1]q - output_location = "s3://${aws_s3_bucket.test.bucket}/test/output" + name = %[1]q + + configuration { + result_configuration { + output_location = "s3://${aws_s3_bucket.test.bucket}/test/output" + } + } } -`, rName, rOutputLocation) +`, rName, bucketName) } -func testAccAthenaWorkGroupConfigEncryptionS3(rName string, rEncryption string) string { +func testAccAthenaWorkGroupConfigConfigurationResultConfigurationEncryptionConfigurationEncryptionOptionSseS3(rName string) string { return fmt.Sprintf(` resource "aws_athena_workgroup" "test" { - encryption_option = %[2]q - name = %[1]q + name = %[1]q + + configuration { + result_configuration { + encryption_configuration { + encryption_option = "SSE_S3" + } + } + } } -`, rName, rEncryption) +`, rName) } -func testAccAthenaWorkGroupConfigEncryptionKms(rName string, rEncryption string) string { +func testAccAthenaWorkGroupConfigConfigurationResultConfigurationEncryptionConfigurationEncryptionOptionWithKms(rName, encryptionOption string) string { return fmt.Sprintf(` resource "aws_kms_key" "test" { deletion_window_in_days = 7 @@ -524,11 +563,18 @@ resource "aws_kms_key" "test" { } resource "aws_athena_workgroup" "test" { - encryption_option = %[2]q - kms_key = "${aws_kms_key.test.arn}" - name = %[1]q + name = %[1]q + + configuration { + result_configuration { + encryption_configuration { + encryption_option = %[2]q + kms_key_arn = "${aws_kms_key.test.arn}" + } + } + } } -`, rName, rEncryption) +`, rName, encryptionOption) } func testAccAthenaWorkGroupConfigState(rName, state string) string { diff --git a/website/docs/r/athena_workgroup.html.markdown b/website/docs/r/athena_workgroup.html.markdown index bf4943feeecc..68f2595bcd90 100644 --- a/website/docs/r/athena_workgroup.html.markdown +++ b/website/docs/r/athena_workgroup.html.markdown @@ -24,7 +24,7 @@ resource "aws_athena_workgroup" "example" { output_location = "s3://{aws_s3_bucket.example.bucket}/output/" encryption_configuration { - encryption_option = "SSE-KMS" + encryption_option = "SSE_KMS" kms_key_arn = "${aws_kms_key.example.arn}" } } @@ -47,8 +47,8 @@ The following arguments are supported: The `configuration` configuration block supports the following arguments: * `bytes_scanned_cutoff_per_query` - (Optional) Integer for the upper data usage limit (cutoff) for the amount of bytes a single query in a workgroup is allowed to scan. Must be at least `10485760`. -* `enforce_workgroup_configuration` - (Optional) Boolean whether the settings for the workgroup override client-side settings. For more information, see [Workgroup Settings Override Client-Side Settings](https://docs.aws.amazon.com/athena/latest/ug/workgroups-settings-override.html). -* `publish_cloudwatch_metrics_enabled` - (Optional) Boolean whether Amazon CloudWatch metrics are enabled for the workgroup. +* `enforce_workgroup_configuration` - (Optional) Boolean whether the settings for the workgroup override client-side settings. For more information, see [Workgroup Settings Override Client-Side Settings](https://docs.aws.amazon.com/athena/latest/ug/workgroups-settings-override.html). Defaults to `true`. +* `publish_cloudwatch_metrics_enabled` - (Optional) Boolean whether Amazon CloudWatch metrics are enabled for the workgroup. Defaults to `true`. * `result_configuration` - (Optional) Configuration block with result settings. Documented below. #### result_configuration Argument Reference From 8de60596ab08ba372a14c56b50a0e44dc6d1d07c Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 20:16:29 -0400 Subject: [PATCH 0159/1054] Update CHANGELOG for #9274 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bae54d3e5a25..d3ebc80b5870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ ENHANCEMENTS: BUG FIXES: +* resource/aws_db_event_subscription: Prevent `Unable to find RDS Event Subscription` error during deletion and refresh [GH-9274] * resource/aws_transfer_user: Final retry after timeout waiting for deletion of transfer user [GH-9241] * service/organizations: Automatically retry API calls on `ConcurrentModificationException` error [GH-9195] From db7036ed34ab4675866ccd2c29d671a8b79dd3a7 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 20:22:28 -0400 Subject: [PATCH 0160/1054] Update CHANGELOG for #9278 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3ebc80b5870..84171e2f7b55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ ENHANCEMENTS: BUG FIXES: * resource/aws_db_event_subscription: Prevent `Unable to find RDS Event Subscription` error during deletion and refresh [GH-9274] +* resource/aws_iam_policy_attachment: Bypass `NoSuchEntity` error when detaching groups, roles, and users (support group, role (when `force_detach_policies` is enabled), and user renames (when `force_destroy` is enabled)) [GH-9278] * resource/aws_transfer_user: Final retry after timeout waiting for deletion of transfer user [GH-9241] * service/organizations: Automatically retry API calls on `ConcurrentModificationException` error [GH-9195] From 550570d89f6815a85ae10785842c8c6a4d063e84 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 21:30:28 -0400 Subject: [PATCH 0161/1054] resource/aws_acmpca_certificate_authority: Support validation for ROOT type and ensure type updates force recreation Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/9081 Output from acceptance testing: ``` --- PASS: TestAccAwsAcmpcaCertificateAuthority_Type_Root (17.66s) ``` --- ...source_aws_acmpca_certificate_authority.go | 2 + ...e_aws_acmpca_certificate_authority_test.go | 46 +++++++++++++++++++ ...acmpca_certificate_authority.html.markdown | 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_acmpca_certificate_authority.go b/aws/resource_aws_acmpca_certificate_authority.go index 46bb1cedbb73..79564385b79a 100644 --- a/aws/resource_aws_acmpca_certificate_authority.go +++ b/aws/resource_aws_acmpca_certificate_authority.go @@ -255,8 +255,10 @@ func resourceAwsAcmpcaCertificateAuthority() *schema.Resource { "type": { Type: schema.TypeString, Optional: true, + ForceNew: true, Default: acmpca.CertificateAuthorityTypeSubordinate, ValidateFunc: validation.StringInSlice([]string{ + acmpca.CertificateAuthorityTypeRoot, acmpca.CertificateAuthorityTypeSubordinate, }, false), }, diff --git a/aws/resource_aws_acmpca_certificate_authority_test.go b/aws/resource_aws_acmpca_certificate_authority_test.go index 43724c4d7338..33fb906902ad 100644 --- a/aws/resource_aws_acmpca_certificate_authority_test.go +++ b/aws/resource_aws_acmpca_certificate_authority_test.go @@ -410,6 +410,34 @@ func TestAccAwsAcmpcaCertificateAuthority_Tags(t *testing.T) { }) } +func TestAccAwsAcmpcaCertificateAuthority_Type_Root(t *testing.T) { + var certificateAuthority acmpca.CertificateAuthority + resourceName := "aws_acmpca_certificate_authority.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsAcmpcaCertificateAuthorityDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAwsAcmpcaCertificateAuthorityConfigType(acmpca.CertificateAuthorityTypeRoot), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsAcmpcaCertificateAuthorityExists(resourceName, &certificateAuthority), + resource.TestCheckResourceAttr(resourceName, "type", acmpca.CertificateAuthorityTypeRoot), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "permanent_deletion_time_in_days", + }, + }, + }, + }) +} + func testAccCheckAwsAcmpcaCertificateAuthorityDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).acmpcaconn @@ -694,3 +722,21 @@ resource "aws_acmpca_certificate_authority" "test" { } } ` + +func testAccAwsAcmpcaCertificateAuthorityConfigType(certificateAuthorityType string) string { + return fmt.Sprintf(` +resource "aws_acmpca_certificate_authority" "test" { + permanent_deletion_time_in_days = 7 + type = %[1]q + + certificate_authority_configuration { + key_algorithm = "RSA_4096" + signing_algorithm = "SHA512WITHRSA" + + subject { + common_name = "terraformtesting.com" + } + } +} +`, certificateAuthorityType) +} diff --git a/website/docs/r/acmpca_certificate_authority.html.markdown b/website/docs/r/acmpca_certificate_authority.html.markdown index 656b2fe14a04..c948f54a4c1b 100644 --- a/website/docs/r/acmpca_certificate_authority.html.markdown +++ b/website/docs/r/acmpca_certificate_authority.html.markdown @@ -95,7 +95,7 @@ The following arguments are supported: * `enabled` - (Optional) Whether the certificate authority is enabled or disabled. Defaults to `true`. * `revocation_configuration` - (Optional) Nested argument containing revocation configuration. Defined below. * `tags` - (Optional) Specifies a key-value map of user-defined tags that are attached to the certificate authority. -* `type` - (Optional) The type of the certificate authority. Currently, this must be `SUBORDINATE`. +* `type` - (Optional) The type of the certificate authority. Defaults to `SUBORDINATE`. Valid values: `ROOT` and `SUBORDINATE`. * `permanent_deletion_time_in_days` - (Optional) The number of days to make a CA restorable after it has been deleted, must be between 7 to 30 days, with default to 30 days. ### certificate_authority_configuration From aa808da9e6a47cad19af99645178bfcf5602e0d4 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 21:32:05 -0400 Subject: [PATCH 0162/1054] Revert "resource/aws_acmpca_certificate_authority: Support validation for ROOT type and ensure type updates force recreation" This reverts commit 550570d89f6815a85ae10785842c8c6a4d063e84. --- ...source_aws_acmpca_certificate_authority.go | 2 - ...e_aws_acmpca_certificate_authority_test.go | 46 ------------------- ...acmpca_certificate_authority.html.markdown | 2 +- 3 files changed, 1 insertion(+), 49 deletions(-) diff --git a/aws/resource_aws_acmpca_certificate_authority.go b/aws/resource_aws_acmpca_certificate_authority.go index 79564385b79a..46bb1cedbb73 100644 --- a/aws/resource_aws_acmpca_certificate_authority.go +++ b/aws/resource_aws_acmpca_certificate_authority.go @@ -255,10 +255,8 @@ func resourceAwsAcmpcaCertificateAuthority() *schema.Resource { "type": { Type: schema.TypeString, Optional: true, - ForceNew: true, Default: acmpca.CertificateAuthorityTypeSubordinate, ValidateFunc: validation.StringInSlice([]string{ - acmpca.CertificateAuthorityTypeRoot, acmpca.CertificateAuthorityTypeSubordinate, }, false), }, diff --git a/aws/resource_aws_acmpca_certificate_authority_test.go b/aws/resource_aws_acmpca_certificate_authority_test.go index 33fb906902ad..43724c4d7338 100644 --- a/aws/resource_aws_acmpca_certificate_authority_test.go +++ b/aws/resource_aws_acmpca_certificate_authority_test.go @@ -410,34 +410,6 @@ func TestAccAwsAcmpcaCertificateAuthority_Tags(t *testing.T) { }) } -func TestAccAwsAcmpcaCertificateAuthority_Type_Root(t *testing.T) { - var certificateAuthority acmpca.CertificateAuthority - resourceName := "aws_acmpca_certificate_authority.test" - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAwsAcmpcaCertificateAuthorityDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAwsAcmpcaCertificateAuthorityConfigType(acmpca.CertificateAuthorityTypeRoot), - Check: resource.ComposeTestCheckFunc( - testAccCheckAwsAcmpcaCertificateAuthorityExists(resourceName, &certificateAuthority), - resource.TestCheckResourceAttr(resourceName, "type", acmpca.CertificateAuthorityTypeRoot), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{ - "permanent_deletion_time_in_days", - }, - }, - }, - }) -} - func testAccCheckAwsAcmpcaCertificateAuthorityDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).acmpcaconn @@ -722,21 +694,3 @@ resource "aws_acmpca_certificate_authority" "test" { } } ` - -func testAccAwsAcmpcaCertificateAuthorityConfigType(certificateAuthorityType string) string { - return fmt.Sprintf(` -resource "aws_acmpca_certificate_authority" "test" { - permanent_deletion_time_in_days = 7 - type = %[1]q - - certificate_authority_configuration { - key_algorithm = "RSA_4096" - signing_algorithm = "SHA512WITHRSA" - - subject { - common_name = "terraformtesting.com" - } - } -} -`, certificateAuthorityType) -} diff --git a/website/docs/r/acmpca_certificate_authority.html.markdown b/website/docs/r/acmpca_certificate_authority.html.markdown index c948f54a4c1b..656b2fe14a04 100644 --- a/website/docs/r/acmpca_certificate_authority.html.markdown +++ b/website/docs/r/acmpca_certificate_authority.html.markdown @@ -95,7 +95,7 @@ The following arguments are supported: * `enabled` - (Optional) Whether the certificate authority is enabled or disabled. Defaults to `true`. * `revocation_configuration` - (Optional) Nested argument containing revocation configuration. Defined below. * `tags` - (Optional) Specifies a key-value map of user-defined tags that are attached to the certificate authority. -* `type` - (Optional) The type of the certificate authority. Defaults to `SUBORDINATE`. Valid values: `ROOT` and `SUBORDINATE`. +* `type` - (Optional) The type of the certificate authority. Currently, this must be `SUBORDINATE`. * `permanent_deletion_time_in_days` - (Optional) The number of days to make a CA restorable after it has been deleted, must be between 7 to 30 days, with default to 30 days. ### certificate_authority_configuration From 3445bdad254e48eadbd473c695675fc27a7834ee Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 21:40:51 -0400 Subject: [PATCH 0163/1054] Update CHANGELOG for #7534 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84171e2f7b55..1259ee632d9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ENHANCEMENTS: * resource/aws_appmesh_virtual_router: Add `tags` argument [GH-9249] * resource/aws_appmesh_virtual_service: Add `tags` argument [GH-9252] * resource/aws_codebuild_project: Add `environment` configuration block `registry_credential` configuration block (support Secrets Manager registry credentials) [GH-9168] +* resource/aws_codebuild_project: Add `logs_config` configuration block (support CloudWatch and S3 logging configuration) [GH-7534] * resource/aws_ebs_snapshot: Support customizable create/delete timeouts and increase defaults to 10 minutes [GH-9157] * resource/aws_organizations_account: Add `tags` argument [GH-9202] * resource/aws_service_discovery_service: Add `namespace_id` argument (Support HTTP namespaces) [GH-7341] From af5ca656a082cf87ec37498206d78a4c50ab06d7 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 21:59:57 -0400 Subject: [PATCH 0164/1054] Update CHANGELOG for #8667 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1259ee632d9e..f8ac0821e16d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ENHANCEMENTS: * resource/aws_codebuild_project: Add `environment` configuration block `registry_credential` configuration block (support Secrets Manager registry credentials) [GH-9168] * resource/aws_codebuild_project: Add `logs_config` configuration block (support CloudWatch and S3 logging configuration) [GH-7534] * resource/aws_ebs_snapshot: Support customizable create/delete timeouts and increase defaults to 10 minutes [GH-9157] +* resource/aws_lightsail_instance: Add validation for `name` argument [GH-8667] * resource/aws_organizations_account: Add `tags` argument [GH-9202] * resource/aws_service_discovery_service: Add `namespace_id` argument (Support HTTP namespaces) [GH-7341] * resource/aws_waf_rule_group: Support resource import [GH-9254] From 1a8e9e3383fb36fb6768bd64759bf3b712b0ee7e Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 9 Jul 2019 22:08:23 -0400 Subject: [PATCH 0165/1054] Update CHANGELOG for #9273 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8ac0821e16d..528c062621b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ ENHANCEMENTS: * resource/aws_codebuild_project: Add `logs_config` configuration block (support CloudWatch and S3 logging configuration) [GH-7534] * resource/aws_ebs_snapshot: Support customizable create/delete timeouts and increase defaults to 10 minutes [GH-9157] * resource/aws_lightsail_instance: Add validation for `name` argument [GH-8667] +* resource/aws_lightsail_instance: Add `tags` argument [GH-9273] * resource/aws_organizations_account: Add `tags` argument [GH-9202] * resource/aws_service_discovery_service: Add `namespace_id` argument (Support HTTP namespaces) [GH-7341] * resource/aws_waf_rule_group: Support resource import [GH-9254] From aa9f30332dc3ac23329b226e14b93a15f13d0001 Mon Sep 17 00:00:00 2001 From: cyonjohn Date: Wed, 10 Jul 2019 12:13:37 +0200 Subject: [PATCH 0166/1054] Review comment fixes Updated the error returns to be descriptive Added the documentation links Removed the update function Set Id to empty if read fails Whitespace changes in test code --- ..._aws_directory_service_log_subscription.go | 9 +-- ...directory_service_log_subscription_test.go | 39 ++++++------- website/aws.erb | 4 ++ ...ory_service_log_subscription.html.markdown | 58 +++++++++++++++++++ 4 files changed, 86 insertions(+), 24 deletions(-) create mode 100644 website/docs/r/directory_service_log_subscription.html.markdown diff --git a/aws/resource_aws_directory_service_log_subscription.go b/aws/resource_aws_directory_service_log_subscription.go index 13be917e49c1..9f2e21444ce9 100644 --- a/aws/resource_aws_directory_service_log_subscription.go +++ b/aws/resource_aws_directory_service_log_subscription.go @@ -1,6 +1,7 @@ package aws import ( + "fmt" "log" "github.com/aws/aws-sdk-go/aws" @@ -12,7 +13,6 @@ func resourceAwsDirectoryServiceLogSubscription() *schema.Resource { return &schema.Resource{ Create: resourceAwsDirectoryServiceLogSubscriptionCreate, Read: resourceAwsDirectoryServiceLogSubscriptionRead, - Update: nil, Delete: resourceAwsDirectoryServiceLogSubscriptionDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, @@ -46,7 +46,7 @@ func resourceAwsDirectoryServiceLogSubscriptionCreate(d *schema.ResourceData, me _, err := dsconn.CreateLogSubscription(&input) if err != nil { - return err + return fmt.Errorf("error creating Directory Service Log Subscription: %s", err) } d.SetId(directoryId.(string)) @@ -65,11 +65,12 @@ func resourceAwsDirectoryServiceLogSubscriptionRead(d *schema.ResourceData, meta out, err := dsconn.ListLogSubscriptions(&input) if err != nil { - return err + return fmt.Errorf("error listing Directory Service Log Subscription: %s", err) } if len(out.LogSubscriptions) == 0 { log.Printf("[WARN] No log subscriptions for directory %s found", directoryId) + d.SetId("") return nil } @@ -91,7 +92,7 @@ func resourceAwsDirectoryServiceLogSubscriptionDelete(d *schema.ResourceData, me _, err := dsconn.DeleteLogSubscription(&input) if err != nil { - return err + return fmt.Errorf("error deleting Directory Service Log Subscription: %s", err) } return nil diff --git a/aws/resource_aws_directory_service_log_subscription_test.go b/aws/resource_aws_directory_service_log_subscription_test.go index 0f62bb9cf266..a7c3892f0b38 100644 --- a/aws/resource_aws_directory_service_log_subscription_test.go +++ b/aws/resource_aws_directory_service_log_subscription_test.go @@ -152,37 +152,36 @@ resource "aws_subnet" "bar" { } resource "aws_cloudwatch_log_group" "logs" { - name = "%s" - retention_in_days = 1 + name = "%s" + retention_in_days = 1 } data "aws_iam_policy_document" "ad-log-policy" { - statement { - actions = [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ] + statement { + actions = [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ] - principals { - identifiers = ["ds.amazonaws.com"] - type = "Service" - } + principals { + identifiers = ["ds.amazonaws.com"] + type = "Service" + } - resources = ["${aws_cloudwatch_log_group.logs.arn}"] + resources = ["${aws_cloudwatch_log_group.logs.arn}"] - effect = "Allow" - } + effect = "Allow" } +} - resource "aws_cloudwatch_log_resource_policy" "ad-log-policy" { - policy_document = "${data.aws_iam_policy_document.ad-log-policy.json}" - policy_name = "ad-log-policy" - } +resource "aws_cloudwatch_log_resource_policy" "ad-log-policy" { + policy_document = "${data.aws_iam_policy_document.ad-log-policy.json}" + policy_name = "ad-log-policy" +} resource "aws_directory_service_log_subscription" "subscription" { directory_id = "${aws_directory_service_directory.bar.id}" - log_group_name = "${aws_cloudwatch_log_group.logs.name} - + log_group_name = "${aws_cloudwatch_log_group.logs.name}" } `, logGroupName) } diff --git a/website/aws.erb b/website/aws.erb index 9b07e17adc82..c0c2a73c1850 100644 --- a/website/aws.erb +++ b/website/aws.erb @@ -1022,6 +1022,10 @@ aws_directory_service_conditional_forwarder +
  • + aws_directory_service_log_subscription +
  • + diff --git a/website/docs/r/directory_service_log_subscription.html.markdown b/website/docs/r/directory_service_log_subscription.html.markdown new file mode 100644 index 000000000000..9b313a8f2afe --- /dev/null +++ b/website/docs/r/directory_service_log_subscription.html.markdown @@ -0,0 +1,58 @@ +--- +layout: "aws" +page_title: "AWS: aws_directory_service_log_subscription" +sidebar_current: "docs-aws-resource-directory-service-log-subscription" +description: |- + Provides a Log subscription for AWS Directory Service that pushes logs to cloudwatch. +--- + +# Resource: aws_directory_service_log_subscription + +Provides a Log subscription for AWS Directory Service that pushes logs to cloudwatch. + +## Example Usage + +```hcl +resource "aws_directory_service_log_subscription" "msad-cwl" { + directory_id = "d-1234567890" + log_group_name = "/aws/directoryservice/msad" +} + +data "aws_iam_policy_document" "ad-log-policy" { + statement { + actions = [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ] + + principals { + identifiers = ["ds.amazonaws.com"] + type = "Service" + } + + resources = ["/aws/directoryservice/msad"] + + effect = "Allow" + } +} + +resource "aws_cloudwatch_log_resource_policy" "ad-log-policy" { + policy_document = "${data.aws_iam_policy_document.ad-log-policy.json}" + policy_name = "ad-log-policy" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `directory_id` - (Required) The id of directory. +* `log_group_name` - (Required) Name of the cloudwatch log group to which the logs should be published. The log group should be already created and the directory service principal should be provided with required permission to create stream and publish logs. Changing this value would delete the current subscription and create a new one. A directory can only have one log subscription at a time. + +## Import + +Conditional forwarders can be imported using the directory id and remote_domain_name, e.g. + +``` +$ terraform import aws_directory_service_log_subscription.msad d-1234567890 +``` From 1c0d232cb35a1cc8d98bfa52d315efa8a8446464 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 10 Jul 2019 12:06:55 -0400 Subject: [PATCH 0167/1054] Update CHANGELOG for #9261 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 528c062621b4..7c242e72a380 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ FEATURES: * **New Data Source:** `aws_msk_configuration` [GH-9088] * **New Resource:** `aws_datapipeline_pipeline` [GH-9267] +* **New Resource:** `aws_directory_service_log_subscription` [GH-9261] ENHANCEMENTS: From ecf026fd1b1ad00d20e93e6ae9821e828816077c Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 10 Jul 2019 12:14:32 -0400 Subject: [PATCH 0168/1054] resource/aws_directory_service_log_subscription: Minor copy-paste fixes and expand example to include aws_cloudwatch_log_group resource --- ...s_directory_service_log_subscription_test.go | 8 ++++---- ...ctory_service_log_subscription.html.markdown | 17 +++++++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/aws/resource_aws_directory_service_log_subscription_test.go b/aws/resource_aws_directory_service_log_subscription_test.go index a7c3892f0b38..effc365ae7a8 100644 --- a/aws/resource_aws_directory_service_log_subscription_test.go +++ b/aws/resource_aws_directory_service_log_subscription_test.go @@ -119,7 +119,7 @@ resource "aws_directory_service_directory" "bar" { } tags = { - Name = "terraform-testacc-directory-service-conditional-forwarder" + Name = "terraform-testacc-directory-service-log-subscription" } } @@ -127,7 +127,7 @@ resource "aws_vpc" "main" { cidr_block = "10.0.0.0/16" tags = { - Name = "terraform-testacc-directory-service-conditional-forwarder" + Name = "terraform-testacc-directory-service-log-subscription" } } @@ -137,7 +137,7 @@ resource "aws_subnet" "foo" { cidr_block = "10.0.1.0/24" tags = { - Name = "terraform-testacc-directory-service-conditional-forwarder" + Name = "terraform-testacc-directory-service-log-subscription" } } @@ -147,7 +147,7 @@ resource "aws_subnet" "bar" { cidr_block = "10.0.2.0/24" tags = { - Name = "terraform-testacc-directory-service-conditional-forwarder" + Name = "terraform-testacc-directory-service-log-subscription" } } diff --git a/website/docs/r/directory_service_log_subscription.html.markdown b/website/docs/r/directory_service_log_subscription.html.markdown index 9b313a8f2afe..18622d9fac22 100644 --- a/website/docs/r/directory_service_log_subscription.html.markdown +++ b/website/docs/r/directory_service_log_subscription.html.markdown @@ -13,9 +13,9 @@ Provides a Log subscription for AWS Directory Service that pushes logs to cloudw ## Example Usage ```hcl -resource "aws_directory_service_log_subscription" "msad-cwl" { - directory_id = "d-1234567890" - log_group_name = "/aws/directoryservice/msad" +resource "aws_cloudwatch_log_group" "example" { + name = "/aws/directoryservice/${aws_directory_service_directory.example.id}" + retention_in_days = 14 } data "aws_iam_policy_document" "ad-log-policy" { @@ -30,7 +30,7 @@ data "aws_iam_policy_document" "ad-log-policy" { type = "Service" } - resources = ["/aws/directoryservice/msad"] + resources = ["${aws_cloudwatch_log_group.example.arn}"] effect = "Allow" } @@ -38,7 +38,12 @@ data "aws_iam_policy_document" "ad-log-policy" { resource "aws_cloudwatch_log_resource_policy" "ad-log-policy" { policy_document = "${data.aws_iam_policy_document.ad-log-policy.json}" - policy_name = "ad-log-policy" + policy_name = "ad-log-policy" +} + +resource "aws_directory_service_log_subscription" "example" { + directory_id = "${aws_directory_service_directory.example.id}" + log_group_name = "${aws_cloudwatch_log_group.example.name}" } ``` @@ -51,7 +56,7 @@ The following arguments are supported: ## Import -Conditional forwarders can be imported using the directory id and remote_domain_name, e.g. +Directory Service Log Subscriptions can be imported using the directory id, e.g. ``` $ terraform import aws_directory_service_log_subscription.msad d-1234567890 From f72d48f8af6e4b3d2723cdf8ce6d0f1dab38dced Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 10 Jul 2019 13:12:50 -0400 Subject: [PATCH 0169/1054] Update module aws/aws-sdk-go to v1.20.17 (#9287) --- go.mod | 2 +- go.sum | 4 +- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 28 + .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../aws/aws-sdk-go/service/cloudwatch/api.go | 894 ++++++++++- .../aws-sdk-go/service/cloudwatch/errors.go | 6 + .../aws-sdk-go/service/configservice/api.go | 1367 ++++++++++++++++- .../service/configservice/errors.go | 12 + .../aws/aws-sdk-go/service/efs/api.go | 28 +- .../aws/aws-sdk-go/service/gamelift/api.go | 335 ++-- .../aws/aws-sdk-go/service/kafka/api.go | 2 +- .../aws-sdk-go/service/kinesisvideo/api.go | 59 + .../aws/aws-sdk-go/service/waf/api.go | 796 ++++++++++ .../aws/aws-sdk-go/service/waf/errors.go | 12 + .../aws/aws-sdk-go/service/wafregional/api.go | 405 +++++ .../aws-sdk-go/service/wafregional/errors.go | 12 + vendor/modules.txt | 2 +- 17 files changed, 3770 insertions(+), 196 deletions(-) diff --git a/go.mod b/go.mod index a599ec168530..bdcbe679b0c9 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/terraform-providers/terraform-provider-aws require ( - github.com/aws/aws-sdk-go v1.20.16 + github.com/aws/aws-sdk-go v1.20.17 github.com/beevik/etree v1.1.0 github.com/bflad/tfproviderlint v0.4.0 github.com/client9/misspell v0.3.4 diff --git a/go.sum b/go.sum index ebf260242d56..010927236518 100644 --- a/go.sum +++ b/go.sum @@ -52,8 +52,8 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.16.36/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.20.16 h1:Dq68fBH39XnSjjb2hX/iW6mui8JtXcVAuhRYGSRiisY= -github.com/aws/aws-sdk-go v1.20.16/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.20.17 h1:ZQ0cM9FpuufVDHlNViD8vD68IkEQL/VUOMwJPBqkaaM= +github.com/aws/aws-sdk-go v1.20.17/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs= github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A= diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index 214f8d8af254..d93f7b33c38d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -1644,10 +1644,15 @@ var awsPartition = partition{ }, Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, + "us-east-2": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -1744,11 +1749,16 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, + "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -3716,6 +3726,15 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "greengrass": service{ + IsRegionalized: boxedTrue, + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, "iam": service{ PartitionEndpoint: "aws-cn-global", IsRegionalized: boxedFalse, @@ -4292,6 +4311,15 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "greengrass": service{ + IsRegionalized: boxedTrue, + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "guardduty": service{ IsRegionalized: boxedTrue, Defaults: endpoint{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index 06211935975f..f6e9f55e8dec 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.20.16" +const SDKVersion = "1.20.17" diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/api.go b/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/api.go index 743159bfb54d..d56e81a7d867 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/api.go @@ -93,6 +93,95 @@ func (c *CloudWatch) DeleteAlarmsWithContext(ctx aws.Context, input *DeleteAlarm return out, req.Send() } +const opDeleteAnomalyDetector = "DeleteAnomalyDetector" + +// DeleteAnomalyDetectorRequest generates a "aws/request.Request" representing the +// client's request for the DeleteAnomalyDetector operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteAnomalyDetector for more information on using the DeleteAnomalyDetector +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DeleteAnomalyDetectorRequest method. +// req, resp := client.DeleteAnomalyDetectorRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteAnomalyDetector +func (c *CloudWatch) DeleteAnomalyDetectorRequest(input *DeleteAnomalyDetectorInput) (req *request.Request, output *DeleteAnomalyDetectorOutput) { + op := &request.Operation{ + Name: opDeleteAnomalyDetector, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteAnomalyDetectorInput{} + } + + output = &DeleteAnomalyDetectorOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteAnomalyDetector API operation for Amazon CloudWatch. +// +// Deletes the specified anomaly detection model from your account. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation DeleteAnomalyDetector for usage and error information. +// +// Returned Error Codes: +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// The named resource does not exist. +// +// * ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// * ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// * ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteAnomalyDetector +func (c *CloudWatch) DeleteAnomalyDetector(input *DeleteAnomalyDetectorInput) (*DeleteAnomalyDetectorOutput, error) { + req, out := c.DeleteAnomalyDetectorRequest(input) + return out, req.Send() +} + +// DeleteAnomalyDetectorWithContext is the same as DeleteAnomalyDetector with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAnomalyDetector for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DeleteAnomalyDetectorWithContext(ctx aws.Context, input *DeleteAnomalyDetectorInput, opts ...request.Option) (*DeleteAnomalyDetectorOutput, error) { + req, out := c.DeleteAnomalyDetectorRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opDeleteDashboards = "DeleteDashboards" // DeleteDashboardsRequest generates a "aws/request.Request" representing the @@ -531,6 +620,93 @@ func (c *CloudWatch) DescribeAlarmsForMetricWithContext(ctx aws.Context, input * return out, req.Send() } +const opDescribeAnomalyDetectors = "DescribeAnomalyDetectors" + +// DescribeAnomalyDetectorsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeAnomalyDetectors operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeAnomalyDetectors for more information on using the DescribeAnomalyDetectors +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DescribeAnomalyDetectorsRequest method. +// req, resp := client.DescribeAnomalyDetectorsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAnomalyDetectors +func (c *CloudWatch) DescribeAnomalyDetectorsRequest(input *DescribeAnomalyDetectorsInput) (req *request.Request, output *DescribeAnomalyDetectorsOutput) { + op := &request.Operation{ + Name: opDescribeAnomalyDetectors, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeAnomalyDetectorsInput{} + } + + output = &DescribeAnomalyDetectorsOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeAnomalyDetectors API operation for Amazon CloudWatch. +// +// Lists the anomaly detection models that you have created in your account. +// You can list all models in your account or filter the results to only the +// models that are related to a certain namespace, metric name, or metric dimension. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation DescribeAnomalyDetectors for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidNextToken "InvalidNextToken" +// The next token specified is invalid. +// +// * ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// * ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAnomalyDetectors +func (c *CloudWatch) DescribeAnomalyDetectors(input *DescribeAnomalyDetectorsInput) (*DescribeAnomalyDetectorsOutput, error) { + req, out := c.DescribeAnomalyDetectorsRequest(input) + return out, req.Send() +} + +// DescribeAnomalyDetectorsWithContext is the same as DescribeAnomalyDetectors with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAnomalyDetectors for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DescribeAnomalyDetectorsWithContext(ctx aws.Context, input *DescribeAnomalyDetectorsInput, opts ...request.Option) (*DescribeAnomalyDetectorsOutput, error) { + req, out := c.DescribeAnomalyDetectorsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opDisableAlarmActions = "DisableAlarmActions" // DisableAlarmActionsRequest generates a "aws/request.Request" representing the @@ -1544,6 +1720,98 @@ func (c *CloudWatch) ListTagsForResourceWithContext(ctx aws.Context, input *List return out, req.Send() } +const opPutAnomalyDetector = "PutAnomalyDetector" + +// PutAnomalyDetectorRequest generates a "aws/request.Request" representing the +// client's request for the PutAnomalyDetector operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutAnomalyDetector for more information on using the PutAnomalyDetector +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the PutAnomalyDetectorRequest method. +// req, resp := client.PutAnomalyDetectorRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutAnomalyDetector +func (c *CloudWatch) PutAnomalyDetectorRequest(input *PutAnomalyDetectorInput) (req *request.Request, output *PutAnomalyDetectorOutput) { + op := &request.Operation{ + Name: opPutAnomalyDetector, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutAnomalyDetectorInput{} + } + + output = &PutAnomalyDetectorOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// PutAnomalyDetector API operation for Amazon CloudWatch. +// +// Creates an anomaly detection model for a CloudWatch metric. You can use the +// model to display a band of expected normal values when the metric is graphed. +// +// For more information, see CloudWatch Anomaly Detection (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Anomaly_Detection.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation PutAnomalyDetector for usage and error information. +// +// Returned Error Codes: +// * ErrCodeLimitExceededException "LimitExceededException" +// The operation exceeded one or more limits. +// +// * ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// * ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// * ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutAnomalyDetector +func (c *CloudWatch) PutAnomalyDetector(input *PutAnomalyDetectorInput) (*PutAnomalyDetectorOutput, error) { + req, out := c.PutAnomalyDetectorRequest(input) + return out, req.Send() +} + +// PutAnomalyDetectorWithContext is the same as PutAnomalyDetector with the addition of +// the ability to pass a context and additional request options. +// +// See PutAnomalyDetector for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) PutAnomalyDetectorWithContext(ctx aws.Context, input *PutAnomalyDetectorInput, opts ...request.Option) (*PutAnomalyDetectorOutput, error) { + req, out := c.PutAnomalyDetectorRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opPutDashboard = "PutDashboard" // PutDashboardRequest generates a "aws/request.Request" representing the @@ -1592,8 +1860,7 @@ func (c *CloudWatch) PutDashboardRequest(input *PutDashboardInput) (req *request // dashboard. If you update a dashboard, the entire contents are replaced with // what you specify here. // -// There is no limit to the number of dashboards in your account. All dashboards -// in your account are global, not region-specific. +// All dashboards in your account are global, not region-specific. // // A simple way to create a dashboard using PutDashboard is to copy an existing // dashboard. To copy an existing dashboard using the console, you can load @@ -1689,8 +1956,10 @@ func (c *CloudWatch) PutMetricAlarmRequest(input *PutMetricAlarmInput) (req *req // PutMetricAlarm API operation for Amazon CloudWatch. // -// Creates or updates an alarm and associates it with the specified metric or -// metric math expression. +// Creates or updates an alarm and associates it with the specified metric, +// metric math expression, or anomaly detection model. +// +// Alarms based on anomaly detection models cannot have Auto Scaling actions. // // When this operation creates an alarm, the alarm state is immediately set // to INSUFFICIENT_DATA. The alarm is then evaluated and its state is set appropriately. @@ -2234,6 +2503,133 @@ func (s *AlarmHistoryItem) SetTimestamp(v time.Time) *AlarmHistoryItem { return s } +// An anomaly detection model associated with a particular CloudWatch metric +// athresnd statistic. You can use the model to display a band of expected normal +// values when the metric is graphed. +type AnomalyDetector struct { + _ struct{} `type:"structure"` + + // The configuration specifies details about how the anomaly detection model + // is to be trained, including time ranges to exclude from use for training + // the model, and the time zone to use for the metric. + Configuration *AnomalyDetectorConfiguration `type:"structure"` + + // The metric dimensions associated with the anomaly detection model. + Dimensions []*Dimension `type:"list"` + + // The name of the metric associated with the anomaly detection model. + MetricName *string `min:"1" type:"string"` + + // The namespace of the metric associated with the anomaly detection model. + Namespace *string `min:"1" type:"string"` + + // The statistic associated with the anomaly detection model. + Stat *string `type:"string"` +} + +// String returns the string representation +func (s AnomalyDetector) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AnomalyDetector) GoString() string { + return s.String() +} + +// SetConfiguration sets the Configuration field's value. +func (s *AnomalyDetector) SetConfiguration(v *AnomalyDetectorConfiguration) *AnomalyDetector { + s.Configuration = v + return s +} + +// SetDimensions sets the Dimensions field's value. +func (s *AnomalyDetector) SetDimensions(v []*Dimension) *AnomalyDetector { + s.Dimensions = v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *AnomalyDetector) SetMetricName(v string) *AnomalyDetector { + s.MetricName = &v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *AnomalyDetector) SetNamespace(v string) *AnomalyDetector { + s.Namespace = &v + return s +} + +// SetStat sets the Stat field's value. +func (s *AnomalyDetector) SetStat(v string) *AnomalyDetector { + s.Stat = &v + return s +} + +// The configuration specifies details about how the anomaly detection model +// is to be trained, including time ranges to exclude from use for training +// the model and the time zone to use for the metric. +type AnomalyDetectorConfiguration struct { + _ struct{} `type:"structure"` + + // An array of time ranges to exclude from use when the anomaly detection model + // is trained. Use this to make sure that events that could cause unusual values + // for the metric, such as deployments, aren't used when CloudWatch creates + // the model. + ExcludedTimeRanges []*Range `type:"list"` + + // The time zone to use for the metric. This is useful to enable the model to + // automatically account for daylight savings time changes if the metric is + // sensitive to such time changes. + // + // To specify a time zone, use the name of the time zone as specified in the + // standard tz database. For more information, see tz database (https://en.wikipedia.org/wiki/Tz_database). + MetricTimezone *string `type:"string"` +} + +// String returns the string representation +func (s AnomalyDetectorConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AnomalyDetectorConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AnomalyDetectorConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AnomalyDetectorConfiguration"} + if s.ExcludedTimeRanges != nil { + for i, v := range s.ExcludedTimeRanges { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "ExcludedTimeRanges", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetExcludedTimeRanges sets the ExcludedTimeRanges field's value. +func (s *AnomalyDetectorConfiguration) SetExcludedTimeRanges(v []*Range) *AnomalyDetectorConfiguration { + s.ExcludedTimeRanges = v + return s +} + +// SetMetricTimezone sets the MetricTimezone field's value. +func (s *AnomalyDetectorConfiguration) SetMetricTimezone(v string) *AnomalyDetectorConfiguration { + s.MetricTimezone = &v + return s +} + // Represents a specific dashboard. type DashboardEntry struct { _ struct{} `type:"structure"` @@ -2440,23 +2836,128 @@ func (s *DeleteAlarmsInput) Validate() error { return nil } -// SetAlarmNames sets the AlarmNames field's value. -func (s *DeleteAlarmsInput) SetAlarmNames(v []*string) *DeleteAlarmsInput { - s.AlarmNames = v +// SetAlarmNames sets the AlarmNames field's value. +func (s *DeleteAlarmsInput) SetAlarmNames(v []*string) *DeleteAlarmsInput { + s.AlarmNames = v + return s +} + +type DeleteAlarmsOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeleteAlarmsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteAlarmsOutput) GoString() string { + return s.String() +} + +type DeleteAnomalyDetectorInput struct { + _ struct{} `type:"structure"` + + // The metric dimensions associated with the anomaly detection model to delete. + Dimensions []*Dimension `type:"list"` + + // The metric name associated with the anomaly detection model to delete. + // + // MetricName is a required field + MetricName *string `min:"1" type:"string" required:"true"` + + // The namespace associated with the anomaly detection model to delete. + // + // Namespace is a required field + Namespace *string `min:"1" type:"string" required:"true"` + + // The statistic associated with the anomaly detection model to delete. + // + // Stat is a required field + Stat *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteAnomalyDetectorInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteAnomalyDetectorInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteAnomalyDetectorInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteAnomalyDetectorInput"} + if s.MetricName == nil { + invalidParams.Add(request.NewErrParamRequired("MetricName")) + } + if s.MetricName != nil && len(*s.MetricName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricName", 1)) + } + if s.Namespace == nil { + invalidParams.Add(request.NewErrParamRequired("Namespace")) + } + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + if s.Stat == nil { + invalidParams.Add(request.NewErrParamRequired("Stat")) + } + if s.Dimensions != nil { + for i, v := range s.Dimensions { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDimensions sets the Dimensions field's value. +func (s *DeleteAnomalyDetectorInput) SetDimensions(v []*Dimension) *DeleteAnomalyDetectorInput { + s.Dimensions = v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *DeleteAnomalyDetectorInput) SetMetricName(v string) *DeleteAnomalyDetectorInput { + s.MetricName = &v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *DeleteAnomalyDetectorInput) SetNamespace(v string) *DeleteAnomalyDetectorInput { + s.Namespace = &v + return s +} + +// SetStat sets the Stat field's value. +func (s *DeleteAnomalyDetectorInput) SetStat(v string) *DeleteAnomalyDetectorInput { + s.Stat = &v return s } -type DeleteAlarmsOutput struct { +type DeleteAnomalyDetectorOutput struct { _ struct{} `type:"structure"` } // String returns the string representation -func (s DeleteAlarmsOutput) String() string { +func (s DeleteAnomalyDetectorOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DeleteAlarmsOutput) GoString() string { +func (s DeleteAnomalyDetectorOutput) GoString() string { return s.String() } @@ -2892,6 +3393,138 @@ func (s *DescribeAlarmsOutput) SetNextToken(v string) *DescribeAlarmsOutput { return s } +type DescribeAnomalyDetectorsInput struct { + _ struct{} `type:"structure"` + + // Limits the results to only the anomaly detection models that are associated + // with the specified metric dimensions. If there are multiple metrics that + // have these dimensions and have anomaly detection models associated, they're + // all returned. + Dimensions []*Dimension `type:"list"` + + // The maximum number of results to return in one operation. The maximum value + // you can specify is 10. + // + // To retrieve the remaining results, make another call with the returned NextToken + // value. + MaxResults *int64 `min:"1" type:"integer"` + + // Limits the results to only the anomaly detection models that are associated + // with the specified metric name. If there are multiple metrics with this name + // in different namespaces that have anomaly detection models, they're all returned. + MetricName *string `min:"1" type:"string"` + + // Limits the results to only the anomaly detection models that are associated + // with the specified namespace. + Namespace *string `min:"1" type:"string"` + + // Use the token returned by the previous operation to request the next page + // of results. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s DescribeAnomalyDetectorsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeAnomalyDetectorsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeAnomalyDetectorsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeAnomalyDetectorsInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + if s.MetricName != nil && len(*s.MetricName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricName", 1)) + } + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + if s.Dimensions != nil { + for i, v := range s.Dimensions { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDimensions sets the Dimensions field's value. +func (s *DescribeAnomalyDetectorsInput) SetDimensions(v []*Dimension) *DescribeAnomalyDetectorsInput { + s.Dimensions = v + return s +} + +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeAnomalyDetectorsInput) SetMaxResults(v int64) *DescribeAnomalyDetectorsInput { + s.MaxResults = &v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *DescribeAnomalyDetectorsInput) SetMetricName(v string) *DescribeAnomalyDetectorsInput { + s.MetricName = &v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *DescribeAnomalyDetectorsInput) SetNamespace(v string) *DescribeAnomalyDetectorsInput { + s.Namespace = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeAnomalyDetectorsInput) SetNextToken(v string) *DescribeAnomalyDetectorsInput { + s.NextToken = &v + return s +} + +type DescribeAnomalyDetectorsOutput struct { + _ struct{} `type:"structure"` + + // The list of anomaly detection models returned by the operation. + AnomalyDetectors []*AnomalyDetector `type:"list"` + + // A token that you can use in a subsequent operation to retrieve the next set + // of results. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s DescribeAnomalyDetectorsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeAnomalyDetectorsOutput) GoString() string { + return s.String() +} + +// SetAnomalyDetectors sets the AnomalyDetectors field's value. +func (s *DescribeAnomalyDetectorsOutput) SetAnomalyDetectors(v []*AnomalyDetector) *DescribeAnomalyDetectorsOutput { + s.AnomalyDetectors = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeAnomalyDetectorsOutput) SetNextToken(v string) *DescribeAnomalyDetectorsOutput { + s.NextToken = &v + return s +} + // Expands the identity of a metric. type Dimension struct { _ struct{} `type:"structure"` @@ -4112,9 +4745,15 @@ type MetricAlarm struct { // Name (ARN). InsufficientDataActions []*string `type:"list"` - // The name of the metric associated with the alarm. + // The name of the metric associated with the alarm, if this is an alarm based + // on a single metric. MetricName *string `min:"1" type:"string"` + // An array of MetricDataQuery structures, used in an alarm based on a metric + // math expression. Each structure either retrieves a metric or performs a math + // expression. One item in the Metrics array is the math expression that the + // alarm watches. This expression by designated by having ReturnValue set to + // true. Metrics []*MetricDataQuery `type:"list"` // The namespace of the metric associated with the alarm. @@ -4146,6 +4785,10 @@ type MetricAlarm struct { // The value to compare with the specified statistic. Threshold *float64 `type:"double"` + // In an alarm based on an anomaly detection model, this is the ID of the ANOMALY_DETECTION_BAND + // function used as the threshold for the alarm. + ThresholdMetricId *string `min:"1" type:"string"` + // Sets how this alarm is to handle missing data points. If this parameter is // omitted, the default behavior of missing is used. TreatMissingData *string `min:"1" type:"string"` @@ -4308,6 +4951,12 @@ func (s *MetricAlarm) SetThreshold(v float64) *MetricAlarm { return s } +// SetThresholdMetricId sets the ThresholdMetricId field's value. +func (s *MetricAlarm) SetThresholdMetricId(v string) *MetricAlarm { + s.ThresholdMetricId = &v + return s +} + // SetTreatMissingData sets the TreatMissingData field's value. func (s *MetricAlarm) SetTreatMissingData(v string) *MetricAlarm { s.TreatMissingData = &v @@ -4578,7 +5227,9 @@ type MetricDatum struct { // since Jan 1, 1970 00:00:00 UTC. Timestamp *time.Time `type:"timestamp"` - // The unit of the metric. + // When you are using a Put operation, this defines what unit you want to use + // when storing the metric. In a Get operation, this displays the unit that + // is used for the metric. Unit *string `type:"string" enum:"StandardUnit"` // The value for the metric. @@ -4723,7 +5374,9 @@ type MetricStat struct { // Stat is a required field Stat *string `type:"string" required:"true"` - // The unit to use for the returned data points. + // When you are using a Put operation, this defines what unit you want to use + // when storing the metric. In a Get operation, this displays the unit that + // is used for the metric. Unit *string `type:"string" enum:"StandardUnit"` } @@ -4788,6 +5441,131 @@ func (s *MetricStat) SetUnit(v string) *MetricStat { return s } +type PutAnomalyDetectorInput struct { + _ struct{} `type:"structure"` + + // The configuration specifies details about how the anomaly detection model + // is to be trained, including time ranges to exclude when training and updating + // the model. You can specify as many as 10 time ranges. + // + // The configuration can also include the time zone to use for the metric. + // + // You can in + Configuration *AnomalyDetectorConfiguration `type:"structure"` + + // The metric dimensions to create the anomaly detection model for. + Dimensions []*Dimension `type:"list"` + + // The name of the metric to create the anomaly detection model for. + // + // MetricName is a required field + MetricName *string `min:"1" type:"string" required:"true"` + + // The namespace of the metric to create the anomaly detection model for. + // + // Namespace is a required field + Namespace *string `min:"1" type:"string" required:"true"` + + // The statistic to use for the metric and the anomaly detection model. + // + // Stat is a required field + Stat *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s PutAnomalyDetectorInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutAnomalyDetectorInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutAnomalyDetectorInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutAnomalyDetectorInput"} + if s.MetricName == nil { + invalidParams.Add(request.NewErrParamRequired("MetricName")) + } + if s.MetricName != nil && len(*s.MetricName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricName", 1)) + } + if s.Namespace == nil { + invalidParams.Add(request.NewErrParamRequired("Namespace")) + } + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + if s.Stat == nil { + invalidParams.Add(request.NewErrParamRequired("Stat")) + } + if s.Configuration != nil { + if err := s.Configuration.Validate(); err != nil { + invalidParams.AddNested("Configuration", err.(request.ErrInvalidParams)) + } + } + if s.Dimensions != nil { + for i, v := range s.Dimensions { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetConfiguration sets the Configuration field's value. +func (s *PutAnomalyDetectorInput) SetConfiguration(v *AnomalyDetectorConfiguration) *PutAnomalyDetectorInput { + s.Configuration = v + return s +} + +// SetDimensions sets the Dimensions field's value. +func (s *PutAnomalyDetectorInput) SetDimensions(v []*Dimension) *PutAnomalyDetectorInput { + s.Dimensions = v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *PutAnomalyDetectorInput) SetMetricName(v string) *PutAnomalyDetectorInput { + s.MetricName = &v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *PutAnomalyDetectorInput) SetNamespace(v string) *PutAnomalyDetectorInput { + s.Namespace = &v + return s +} + +// SetStat sets the Stat field's value. +func (s *PutAnomalyDetectorInput) SetStat(v string) *PutAnomalyDetectorInput { + s.Stat = &v + return s +} + +type PutAnomalyDetectorOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s PutAnomalyDetectorOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutAnomalyDetectorOutput) GoString() string { + return s.String() +} + type PutDashboardInput struct { _ struct{} `type:"structure"` @@ -4908,6 +5686,10 @@ type PutMetricAlarmInput struct { // The arithmetic operation to use when comparing the specified statistic and // threshold. The specified statistic value is used as the first operand. // + // The values LessThanLowerOrGreaterThanUpperThreshold, LessThanLowerThreshold, + // and GreaterThanUpperThreshold are used only for alarms based on anomaly detection + // models. + // // ComparisonOperator is a required field ComparisonOperator *string `type:"string" required:"true" enum:"ComparisonOperator"` @@ -5029,9 +5811,16 @@ type PutMetricAlarmInput struct { Tags []*Tag `type:"list"` // The value against which the specified statistic is compared. + Threshold *float64 `type:"double"` + + // If this is an alarm based on an anomaly detection model, make this value + // match the ID of the ANOMALY_DETECTION_BAND function. // - // Threshold is a required field - Threshold *float64 `type:"double" required:"true"` + // For an example of how to use this parameter, see the Anomaly Detection Model + // Alarm example on this page. + // + // If your alarm uses this parameter, it cannot have Auto Scaling actions. + ThresholdMetricId *string `min:"1" type:"string"` // Sets how this alarm is to handle missing data points. If TreatMissingData // is omitted, the default behavior of missing is used. For more information, @@ -5095,8 +5884,8 @@ func (s *PutMetricAlarmInput) Validate() error { if s.Period != nil && *s.Period < 1 { invalidParams.Add(request.NewErrParamMinValue("Period", 1)) } - if s.Threshold == nil { - invalidParams.Add(request.NewErrParamRequired("Threshold")) + if s.ThresholdMetricId != nil && len(*s.ThresholdMetricId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ThresholdMetricId", 1)) } if s.TreatMissingData != nil && len(*s.TreatMissingData) < 1 { invalidParams.Add(request.NewErrParamMinLen("TreatMissingData", 1)) @@ -5252,6 +6041,12 @@ func (s *PutMetricAlarmInput) SetThreshold(v float64) *PutMetricAlarmInput { return s } +// SetThresholdMetricId sets the ThresholdMetricId field's value. +func (s *PutMetricAlarmInput) SetThresholdMetricId(v string) *PutMetricAlarmInput { + s.ThresholdMetricId = &v + return s +} + // SetTreatMissingData sets the TreatMissingData field's value. func (s *PutMetricAlarmInput) SetTreatMissingData(v string) *PutMetricAlarmInput { s.TreatMissingData = &v @@ -5361,6 +6156,62 @@ func (s PutMetricDataOutput) GoString() string { return s.String() } +// Specifies one range of days or times to exclude from use for training an +// anomaly detection model. +type Range struct { + _ struct{} `type:"structure"` + + // The end time of the range to exclude. The format is yyyy-MM-dd'T'HH:mm:ss. + // For example, 2019-07-01T23:59:59. + // + // EndTime is a required field + EndTime *time.Time `type:"timestamp" required:"true"` + + // The start time of the range to exclude. The format is yyyy-MM-dd'T'HH:mm:ss. + // For example, 2019-07-01T23:59:59. + // + // StartTime is a required field + StartTime *time.Time `type:"timestamp" required:"true"` +} + +// String returns the string representation +func (s Range) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Range) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Range) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Range"} + if s.EndTime == nil { + invalidParams.Add(request.NewErrParamRequired("EndTime")) + } + if s.StartTime == nil { + invalidParams.Add(request.NewErrParamRequired("StartTime")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEndTime sets the EndTime field's value. +func (s *Range) SetEndTime(v time.Time) *Range { + s.EndTime = &v + return s +} + +// SetStartTime sets the StartTime field's value. +func (s *Range) SetStartTime(v time.Time) *Range { + s.StartTime = &v + return s +} + type SetAlarmStateInput struct { _ struct{} `type:"structure"` @@ -5756,6 +6607,15 @@ const ( // ComparisonOperatorLessThanOrEqualToThreshold is a ComparisonOperator enum value ComparisonOperatorLessThanOrEqualToThreshold = "LessThanOrEqualToThreshold" + + // ComparisonOperatorLessThanLowerOrGreaterThanUpperThreshold is a ComparisonOperator enum value + ComparisonOperatorLessThanLowerOrGreaterThanUpperThreshold = "LessThanLowerOrGreaterThanUpperThreshold" + + // ComparisonOperatorLessThanLowerThreshold is a ComparisonOperator enum value + ComparisonOperatorLessThanLowerThreshold = "LessThanLowerThreshold" + + // ComparisonOperatorGreaterThanUpperThreshold is a ComparisonOperator enum value + ComparisonOperatorGreaterThanUpperThreshold = "GreaterThanUpperThreshold" ) const ( diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/errors.go b/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/errors.go index 7e650a682eac..77d0ded20053 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/cloudwatch/errors.go @@ -52,6 +52,12 @@ const ( // The value of an input parameter is bad or out-of-range. ErrCodeInvalidParameterValueException = "InvalidParameterValue" + // ErrCodeLimitExceededException for service response error code + // "LimitExceededException". + // + // The operation exceeded one or more limits. + ErrCodeLimitExceededException = "LimitExceededException" + // ErrCodeLimitExceededFault for service response error code // "LimitExceeded". // diff --git a/vendor/github.com/aws/aws-sdk-go/service/configservice/api.go b/vendor/github.com/aws/aws-sdk-go/service/configservice/api.go index edde4810131d..3c4a48e0aa72 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/configservice/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/configservice/api.go @@ -712,6 +712,87 @@ func (c *ConfigService) DeleteEvaluationResultsWithContext(ctx aws.Context, inpu return out, req.Send() } +const opDeleteOrganizationConfigRule = "DeleteOrganizationConfigRule" + +// DeleteOrganizationConfigRuleRequest generates a "aws/request.Request" representing the +// client's request for the DeleteOrganizationConfigRule operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteOrganizationConfigRule for more information on using the DeleteOrganizationConfigRule +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DeleteOrganizationConfigRuleRequest method. +// req, resp := client.DeleteOrganizationConfigRuleRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DeleteOrganizationConfigRule +func (c *ConfigService) DeleteOrganizationConfigRuleRequest(input *DeleteOrganizationConfigRuleInput) (req *request.Request, output *DeleteOrganizationConfigRuleOutput) { + op := &request.Operation{ + Name: opDeleteOrganizationConfigRule, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteOrganizationConfigRuleInput{} + } + + output = &DeleteOrganizationConfigRuleOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteOrganizationConfigRule API operation for AWS Config. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS Config's +// API operation DeleteOrganizationConfigRule for usage and error information. +// +// Returned Error Codes: +// * ErrCodeNoSuchOrganizationConfigRuleException "NoSuchOrganizationConfigRuleException" +// +// * ErrCodeResourceInUseException "ResourceInUseException" +// The rule is currently being deleted or the rule is deleting your evaluation +// results. Try your request again later. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DeleteOrganizationConfigRule +func (c *ConfigService) DeleteOrganizationConfigRule(input *DeleteOrganizationConfigRuleInput) (*DeleteOrganizationConfigRuleOutput, error) { + req, out := c.DeleteOrganizationConfigRuleRequest(input) + return out, req.Send() +} + +// DeleteOrganizationConfigRuleWithContext is the same as DeleteOrganizationConfigRule with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteOrganizationConfigRule for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *ConfigService) DeleteOrganizationConfigRuleWithContext(ctx aws.Context, input *DeleteOrganizationConfigRuleInput, opts ...request.Option) (*DeleteOrganizationConfigRuleOutput, error) { + req, out := c.DeleteOrganizationConfigRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opDeletePendingAggregationRequest = "DeletePendingAggregationRequest" // DeletePendingAggregationRequestRequest generates a "aws/request.Request" representing the @@ -852,6 +933,8 @@ func (c *ConfigService) DeleteRemediationConfigurationRequest(input *DeleteRemed // * ErrCodeNoSuchRemediationConfigurationException "NoSuchRemediationConfigurationException" // You specified an AWS Config rule without a remediation configuration. // +// * ErrCodeRemediationInProgressException "RemediationInProgressException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DeleteRemediationConfiguration func (c *ConfigService) DeleteRemediationConfiguration(input *DeleteRemediationConfigurationInput) (*DeleteRemediationConfigurationOutput, error) { req, out := c.DeleteRemediationConfigurationRequest(input) @@ -2147,6 +2230,172 @@ func (c *ConfigService) DescribeDeliveryChannelsWithContext(ctx aws.Context, inp return out, req.Send() } +const opDescribeOrganizationConfigRuleStatuses = "DescribeOrganizationConfigRuleStatuses" + +// DescribeOrganizationConfigRuleStatusesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeOrganizationConfigRuleStatuses operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeOrganizationConfigRuleStatuses for more information on using the DescribeOrganizationConfigRuleStatuses +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DescribeOrganizationConfigRuleStatusesRequest method. +// req, resp := client.DescribeOrganizationConfigRuleStatusesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeOrganizationConfigRuleStatuses +func (c *ConfigService) DescribeOrganizationConfigRuleStatusesRequest(input *DescribeOrganizationConfigRuleStatusesInput) (req *request.Request, output *DescribeOrganizationConfigRuleStatusesOutput) { + op := &request.Operation{ + Name: opDescribeOrganizationConfigRuleStatuses, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeOrganizationConfigRuleStatusesInput{} + } + + output = &DescribeOrganizationConfigRuleStatusesOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeOrganizationConfigRuleStatuses API operation for AWS Config. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS Config's +// API operation DescribeOrganizationConfigRuleStatuses for usage and error information. +// +// Returned Error Codes: +// * ErrCodeNoSuchOrganizationConfigRuleException "NoSuchOrganizationConfigRuleException" +// +// * ErrCodeInvalidLimitException "InvalidLimitException" +// The specified limit is outside the allowable range. +// +// * ErrCodeInvalidNextTokenException "InvalidNextTokenException" +// The specified next token is invalid. Specify the nextToken string that was +// returned in the previous response to get the next page of results. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeOrganizationConfigRuleStatuses +func (c *ConfigService) DescribeOrganizationConfigRuleStatuses(input *DescribeOrganizationConfigRuleStatusesInput) (*DescribeOrganizationConfigRuleStatusesOutput, error) { + req, out := c.DescribeOrganizationConfigRuleStatusesRequest(input) + return out, req.Send() +} + +// DescribeOrganizationConfigRuleStatusesWithContext is the same as DescribeOrganizationConfigRuleStatuses with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeOrganizationConfigRuleStatuses for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *ConfigService) DescribeOrganizationConfigRuleStatusesWithContext(ctx aws.Context, input *DescribeOrganizationConfigRuleStatusesInput, opts ...request.Option) (*DescribeOrganizationConfigRuleStatusesOutput, error) { + req, out := c.DescribeOrganizationConfigRuleStatusesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeOrganizationConfigRules = "DescribeOrganizationConfigRules" + +// DescribeOrganizationConfigRulesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeOrganizationConfigRules operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeOrganizationConfigRules for more information on using the DescribeOrganizationConfigRules +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DescribeOrganizationConfigRulesRequest method. +// req, resp := client.DescribeOrganizationConfigRulesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeOrganizationConfigRules +func (c *ConfigService) DescribeOrganizationConfigRulesRequest(input *DescribeOrganizationConfigRulesInput) (req *request.Request, output *DescribeOrganizationConfigRulesOutput) { + op := &request.Operation{ + Name: opDescribeOrganizationConfigRules, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeOrganizationConfigRulesInput{} + } + + output = &DescribeOrganizationConfigRulesOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeOrganizationConfigRules API operation for AWS Config. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS Config's +// API operation DescribeOrganizationConfigRules for usage and error information. +// +// Returned Error Codes: +// * ErrCodeNoSuchOrganizationConfigRuleException "NoSuchOrganizationConfigRuleException" +// +// * ErrCodeInvalidNextTokenException "InvalidNextTokenException" +// The specified next token is invalid. Specify the nextToken string that was +// returned in the previous response to get the next page of results. +// +// * ErrCodeInvalidLimitException "InvalidLimitException" +// The specified limit is outside the allowable range. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeOrganizationConfigRules +func (c *ConfigService) DescribeOrganizationConfigRules(input *DescribeOrganizationConfigRulesInput) (*DescribeOrganizationConfigRulesOutput, error) { + req, out := c.DescribeOrganizationConfigRulesRequest(input) + return out, req.Send() +} + +// DescribeOrganizationConfigRulesWithContext is the same as DescribeOrganizationConfigRules with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeOrganizationConfigRules for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *ConfigService) DescribeOrganizationConfigRulesWithContext(ctx aws.Context, input *DescribeOrganizationConfigRulesInput, opts ...request.Option) (*DescribeOrganizationConfigRulesOutput, error) { + req, out := c.DescribeOrganizationConfigRulesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opDescribePendingAggregationRequests = "DescribePendingAggregationRequests" // DescribePendingAggregationRequestsRequest generates a "aws/request.Request" representing the @@ -3360,6 +3609,89 @@ func (c *ConfigService) GetDiscoveredResourceCountsWithContext(ctx aws.Context, return out, req.Send() } +const opGetOrganizationConfigRuleDetailedStatus = "GetOrganizationConfigRuleDetailedStatus" + +// GetOrganizationConfigRuleDetailedStatusRequest generates a "aws/request.Request" representing the +// client's request for the GetOrganizationConfigRuleDetailedStatus operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetOrganizationConfigRuleDetailedStatus for more information on using the GetOrganizationConfigRuleDetailedStatus +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetOrganizationConfigRuleDetailedStatusRequest method. +// req, resp := client.GetOrganizationConfigRuleDetailedStatusRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/GetOrganizationConfigRuleDetailedStatus +func (c *ConfigService) GetOrganizationConfigRuleDetailedStatusRequest(input *GetOrganizationConfigRuleDetailedStatusInput) (req *request.Request, output *GetOrganizationConfigRuleDetailedStatusOutput) { + op := &request.Operation{ + Name: opGetOrganizationConfigRuleDetailedStatus, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetOrganizationConfigRuleDetailedStatusInput{} + } + + output = &GetOrganizationConfigRuleDetailedStatusOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetOrganizationConfigRuleDetailedStatus API operation for AWS Config. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS Config's +// API operation GetOrganizationConfigRuleDetailedStatus for usage and error information. +// +// Returned Error Codes: +// * ErrCodeNoSuchOrganizationConfigRuleException "NoSuchOrganizationConfigRuleException" +// +// * ErrCodeInvalidLimitException "InvalidLimitException" +// The specified limit is outside the allowable range. +// +// * ErrCodeInvalidNextTokenException "InvalidNextTokenException" +// The specified next token is invalid. Specify the nextToken string that was +// returned in the previous response to get the next page of results. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/GetOrganizationConfigRuleDetailedStatus +func (c *ConfigService) GetOrganizationConfigRuleDetailedStatus(input *GetOrganizationConfigRuleDetailedStatusInput) (*GetOrganizationConfigRuleDetailedStatusOutput, error) { + req, out := c.GetOrganizationConfigRuleDetailedStatusRequest(input) + return out, req.Send() +} + +// GetOrganizationConfigRuleDetailedStatusWithContext is the same as GetOrganizationConfigRuleDetailedStatus with the addition of +// the ability to pass a context and additional request options. +// +// See GetOrganizationConfigRuleDetailedStatus for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *ConfigService) GetOrganizationConfigRuleDetailedStatusWithContext(ctx aws.Context, input *GetOrganizationConfigRuleDetailedStatusInput, opts ...request.Option) (*GetOrganizationConfigRuleDetailedStatusOutput, error) { + req, out := c.GetOrganizationConfigRuleDetailedStatusRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opGetResourceConfigHistory = "GetResourceConfigHistory" // GetResourceConfigHistoryRequest generates a "aws/request.Request" representing the @@ -4446,35 +4778,141 @@ func (c *ConfigService) PutEvaluationsWithContext(ctx aws.Context, input *PutEva return out, req.Send() } -const opPutRemediationConfigurations = "PutRemediationConfigurations" +const opPutOrganizationConfigRule = "PutOrganizationConfigRule" -// PutRemediationConfigurationsRequest generates a "aws/request.Request" representing the -// client's request for the PutRemediationConfigurations operation. The "output" return +// PutOrganizationConfigRuleRequest generates a "aws/request.Request" representing the +// client's request for the PutOrganizationConfigRule operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See PutRemediationConfigurations for more information on using the PutRemediationConfigurations +// See PutOrganizationConfigRule for more information on using the PutOrganizationConfigRule // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the PutRemediationConfigurationsRequest method. -// req, resp := client.PutRemediationConfigurationsRequest(params) +// // Example sending a request using the PutOrganizationConfigRuleRequest method. +// req, resp := client.PutOrganizationConfigRuleRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/PutRemediationConfigurations -func (c *ConfigService) PutRemediationConfigurationsRequest(input *PutRemediationConfigurationsInput) (req *request.Request, output *PutRemediationConfigurationsOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/PutOrganizationConfigRule +func (c *ConfigService) PutOrganizationConfigRuleRequest(input *PutOrganizationConfigRuleInput) (req *request.Request, output *PutOrganizationConfigRuleOutput) { op := &request.Operation{ - Name: opPutRemediationConfigurations, + Name: opPutOrganizationConfigRule, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutOrganizationConfigRuleInput{} + } + + output = &PutOrganizationConfigRuleOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutOrganizationConfigRule API operation for AWS Config. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS Config's +// API operation PutOrganizationConfigRule for usage and error information. +// +// Returned Error Codes: +// * ErrCodeMaxNumberOfOrganizationConfigRulesExceededException "MaxNumberOfOrganizationConfigRulesExceededException" +// +// * ErrCodeResourceInUseException "ResourceInUseException" +// The rule is currently being deleted or the rule is deleting your evaluation +// results. Try your request again later. +// +// * ErrCodeInvalidParameterValueException "InvalidParameterValueException" +// One or more of the specified parameters are invalid. Verify that your parameters +// are valid and try again. +// +// * ErrCodeValidationException "ValidationException" +// The requested action is not valid. +// +// * ErrCodeOrganizationAccessDeniedException "OrganizationAccessDeniedException" +// No permission to call the EnableAWSServiceAccess API. +// +// * ErrCodeNoAvailableOrganizationException "NoAvailableOrganizationException" +// Organization does is no longer available. +// +// * ErrCodeOrganizationAllFeaturesNotEnabledException "OrganizationAllFeaturesNotEnabledException" +// The configuration aggregator cannot be created because organization does +// not have all features enabled. +// +// * ErrCodeInsufficientPermissionsException "InsufficientPermissionsException" +// Indicates one of the following errors: +// +// * The rule cannot be created because the IAM role assigned to AWS Config +// lacks permissions to perform the config:Put* action. +// +// * The AWS Lambda function cannot be invoked. Check the function ARN, and +// check the function's permissions. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/PutOrganizationConfigRule +func (c *ConfigService) PutOrganizationConfigRule(input *PutOrganizationConfigRuleInput) (*PutOrganizationConfigRuleOutput, error) { + req, out := c.PutOrganizationConfigRuleRequest(input) + return out, req.Send() +} + +// PutOrganizationConfigRuleWithContext is the same as PutOrganizationConfigRule with the addition of +// the ability to pass a context and additional request options. +// +// See PutOrganizationConfigRule for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *ConfigService) PutOrganizationConfigRuleWithContext(ctx aws.Context, input *PutOrganizationConfigRuleInput, opts ...request.Option) (*PutOrganizationConfigRuleOutput, error) { + req, out := c.PutOrganizationConfigRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutRemediationConfigurations = "PutRemediationConfigurations" + +// PutRemediationConfigurationsRequest generates a "aws/request.Request" representing the +// client's request for the PutRemediationConfigurations operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutRemediationConfigurations for more information on using the PutRemediationConfigurations +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the PutRemediationConfigurationsRequest method. +// req, resp := client.PutRemediationConfigurationsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/PutRemediationConfigurations +func (c *ConfigService) PutRemediationConfigurationsRequest(input *PutRemediationConfigurationsInput) (req *request.Request, output *PutRemediationConfigurationsOutput) { + op := &request.Operation{ + Name: opPutRemediationConfigurations, HTTPMethod: "POST", HTTPPath: "/", } @@ -7709,6 +8147,59 @@ func (s DeleteEvaluationResultsOutput) GoString() string { return s.String() } +type DeleteOrganizationConfigRuleInput struct { + _ struct{} `type:"structure"` + + // OrganizationConfigRuleName is a required field + OrganizationConfigRuleName *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteOrganizationConfigRuleInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteOrganizationConfigRuleInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteOrganizationConfigRuleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteOrganizationConfigRuleInput"} + if s.OrganizationConfigRuleName == nil { + invalidParams.Add(request.NewErrParamRequired("OrganizationConfigRuleName")) + } + if s.OrganizationConfigRuleName != nil && len(*s.OrganizationConfigRuleName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("OrganizationConfigRuleName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetOrganizationConfigRuleName sets the OrganizationConfigRuleName field's value. +func (s *DeleteOrganizationConfigRuleInput) SetOrganizationConfigRuleName(v string) *DeleteOrganizationConfigRuleInput { + s.OrganizationConfigRuleName = &v + return s +} + +type DeleteOrganizationConfigRuleOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeleteOrganizationConfigRuleOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteOrganizationConfigRuleOutput) GoString() string { + return s.String() +} + type DeletePendingAggregationRequestInput struct { _ struct{} `type:"structure"` @@ -9015,6 +9506,142 @@ func (s *DescribeDeliveryChannelsOutput) SetDeliveryChannels(v []*DeliveryChanne return s } +type DescribeOrganizationConfigRuleStatusesInput struct { + _ struct{} `type:"structure"` + + Limit *int64 `type:"integer"` + + NextToken *string `type:"string"` + + OrganizationConfigRuleNames []*string `type:"list"` +} + +// String returns the string representation +func (s DescribeOrganizationConfigRuleStatusesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeOrganizationConfigRuleStatusesInput) GoString() string { + return s.String() +} + +// SetLimit sets the Limit field's value. +func (s *DescribeOrganizationConfigRuleStatusesInput) SetLimit(v int64) *DescribeOrganizationConfigRuleStatusesInput { + s.Limit = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeOrganizationConfigRuleStatusesInput) SetNextToken(v string) *DescribeOrganizationConfigRuleStatusesInput { + s.NextToken = &v + return s +} + +// SetOrganizationConfigRuleNames sets the OrganizationConfigRuleNames field's value. +func (s *DescribeOrganizationConfigRuleStatusesInput) SetOrganizationConfigRuleNames(v []*string) *DescribeOrganizationConfigRuleStatusesInput { + s.OrganizationConfigRuleNames = v + return s +} + +type DescribeOrganizationConfigRuleStatusesOutput struct { + _ struct{} `type:"structure"` + + NextToken *string `type:"string"` + + OrganizationConfigRuleStatuses []*OrganizationConfigRuleStatus `type:"list"` +} + +// String returns the string representation +func (s DescribeOrganizationConfigRuleStatusesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeOrganizationConfigRuleStatusesOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeOrganizationConfigRuleStatusesOutput) SetNextToken(v string) *DescribeOrganizationConfigRuleStatusesOutput { + s.NextToken = &v + return s +} + +// SetOrganizationConfigRuleStatuses sets the OrganizationConfigRuleStatuses field's value. +func (s *DescribeOrganizationConfigRuleStatusesOutput) SetOrganizationConfigRuleStatuses(v []*OrganizationConfigRuleStatus) *DescribeOrganizationConfigRuleStatusesOutput { + s.OrganizationConfigRuleStatuses = v + return s +} + +type DescribeOrganizationConfigRulesInput struct { + _ struct{} `type:"structure"` + + Limit *int64 `type:"integer"` + + NextToken *string `type:"string"` + + OrganizationConfigRuleNames []*string `type:"list"` +} + +// String returns the string representation +func (s DescribeOrganizationConfigRulesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeOrganizationConfigRulesInput) GoString() string { + return s.String() +} + +// SetLimit sets the Limit field's value. +func (s *DescribeOrganizationConfigRulesInput) SetLimit(v int64) *DescribeOrganizationConfigRulesInput { + s.Limit = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeOrganizationConfigRulesInput) SetNextToken(v string) *DescribeOrganizationConfigRulesInput { + s.NextToken = &v + return s +} + +// SetOrganizationConfigRuleNames sets the OrganizationConfigRuleNames field's value. +func (s *DescribeOrganizationConfigRulesInput) SetOrganizationConfigRuleNames(v []*string) *DescribeOrganizationConfigRulesInput { + s.OrganizationConfigRuleNames = v + return s +} + +type DescribeOrganizationConfigRulesOutput struct { + _ struct{} `type:"structure"` + + NextToken *string `type:"string"` + + OrganizationConfigRules []*OrganizationConfigRule `type:"list"` +} + +// String returns the string representation +func (s DescribeOrganizationConfigRulesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeOrganizationConfigRulesOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeOrganizationConfigRulesOutput) SetNextToken(v string) *DescribeOrganizationConfigRulesOutput { + s.NextToken = &v + return s +} + +// SetOrganizationConfigRules sets the OrganizationConfigRules field's value. +func (s *DescribeOrganizationConfigRulesOutput) SetOrganizationConfigRules(v []*OrganizationConfigRule) *DescribeOrganizationConfigRulesOutput { + s.OrganizationConfigRules = v + return s +} + type DescribePendingAggregationRequestsInput struct { _ struct{} `type:"structure"` @@ -10588,33 +11215,126 @@ func (s *GetDiscoveredResourceCountsOutput) SetTotalDiscoveredResources(v int64) return s } -// The input for the GetResourceConfigHistory action. -type GetResourceConfigHistoryInput struct { +type GetOrganizationConfigRuleDetailedStatusInput struct { _ struct{} `type:"structure"` - // The chronological order for configuration items listed. By default, the results - // are listed in reverse chronological order. - ChronologicalOrder *string `locationName:"chronologicalOrder" type:"string" enum:"ChronologicalOrder"` - - // The time stamp that indicates an earlier time. If not specified, the action - // returns paginated results that contain configuration items that start when - // the first configuration item was recorded. - EarlierTime *time.Time `locationName:"earlierTime" type:"timestamp"` + Filters *StatusDetailFilters `type:"structure"` - // The time stamp that indicates a later time. If not specified, current time - // is taken. - LaterTime *time.Time `locationName:"laterTime" type:"timestamp"` + Limit *int64 `type:"integer"` - // The maximum number of configuration items returned on each page. The default - // is 10. You cannot specify a number greater than 100. If you specify 0, AWS - // Config uses the default. - Limit *int64 `locationName:"limit" type:"integer"` + NextToken *string `type:"string"` - // The nextToken string returned on a previous page that you use to get the - // next page of results in a paginated response. - NextToken *string `locationName:"nextToken" type:"string"` + // OrganizationConfigRuleName is a required field + OrganizationConfigRuleName *string `min:"1" type:"string" required:"true"` +} - // The ID of the resource (for example., sg-xxxxxx). +// String returns the string representation +func (s GetOrganizationConfigRuleDetailedStatusInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetOrganizationConfigRuleDetailedStatusInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetOrganizationConfigRuleDetailedStatusInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetOrganizationConfigRuleDetailedStatusInput"} + if s.OrganizationConfigRuleName == nil { + invalidParams.Add(request.NewErrParamRequired("OrganizationConfigRuleName")) + } + if s.OrganizationConfigRuleName != nil && len(*s.OrganizationConfigRuleName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("OrganizationConfigRuleName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetFilters sets the Filters field's value. +func (s *GetOrganizationConfigRuleDetailedStatusInput) SetFilters(v *StatusDetailFilters) *GetOrganizationConfigRuleDetailedStatusInput { + s.Filters = v + return s +} + +// SetLimit sets the Limit field's value. +func (s *GetOrganizationConfigRuleDetailedStatusInput) SetLimit(v int64) *GetOrganizationConfigRuleDetailedStatusInput { + s.Limit = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *GetOrganizationConfigRuleDetailedStatusInput) SetNextToken(v string) *GetOrganizationConfigRuleDetailedStatusInput { + s.NextToken = &v + return s +} + +// SetOrganizationConfigRuleName sets the OrganizationConfigRuleName field's value. +func (s *GetOrganizationConfigRuleDetailedStatusInput) SetOrganizationConfigRuleName(v string) *GetOrganizationConfigRuleDetailedStatusInput { + s.OrganizationConfigRuleName = &v + return s +} + +type GetOrganizationConfigRuleDetailedStatusOutput struct { + _ struct{} `type:"structure"` + + NextToken *string `type:"string"` + + OrganizationConfigRuleDetailedStatus []*MemberAccountStatus `type:"list"` +} + +// String returns the string representation +func (s GetOrganizationConfigRuleDetailedStatusOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetOrganizationConfigRuleDetailedStatusOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *GetOrganizationConfigRuleDetailedStatusOutput) SetNextToken(v string) *GetOrganizationConfigRuleDetailedStatusOutput { + s.NextToken = &v + return s +} + +// SetOrganizationConfigRuleDetailedStatus sets the OrganizationConfigRuleDetailedStatus field's value. +func (s *GetOrganizationConfigRuleDetailedStatusOutput) SetOrganizationConfigRuleDetailedStatus(v []*MemberAccountStatus) *GetOrganizationConfigRuleDetailedStatusOutput { + s.OrganizationConfigRuleDetailedStatus = v + return s +} + +// The input for the GetResourceConfigHistory action. +type GetResourceConfigHistoryInput struct { + _ struct{} `type:"structure"` + + // The chronological order for configuration items listed. By default, the results + // are listed in reverse chronological order. + ChronologicalOrder *string `locationName:"chronologicalOrder" type:"string" enum:"ChronologicalOrder"` + + // The time stamp that indicates an earlier time. If not specified, the action + // returns paginated results that contain configuration items that start when + // the first configuration item was recorded. + EarlierTime *time.Time `locationName:"earlierTime" type:"timestamp"` + + // The time stamp that indicates a later time. If not specified, current time + // is taken. + LaterTime *time.Time `locationName:"laterTime" type:"timestamp"` + + // The maximum number of configuration items returned on each page. The default + // is 10. You cannot specify a number greater than 100. If you specify 0, AWS + // Config uses the default. + Limit *int64 `locationName:"limit" type:"integer"` + + // The nextToken string returned on a previous page that you use to get the + // next page of results in a paginated response. + NextToken *string `locationName:"nextToken" type:"string"` + + // The ID of the resource (for example., sg-xxxxxx). // // ResourceId is a required field ResourceId *string `locationName:"resourceId" min:"1" type:"string" required:"true"` @@ -11113,6 +11833,71 @@ func (s *ListTagsForResourceOutput) SetTags(v []*Tag) *ListTagsForResourceOutput return s } +type MemberAccountStatus struct { + _ struct{} `type:"structure"` + + // AccountId is a required field + AccountId *string `type:"string" required:"true"` + + // ConfigRuleName is a required field + ConfigRuleName *string `min:"1" type:"string" required:"true"` + + ErrorCode *string `type:"string"` + + ErrorMessage *string `type:"string"` + + LastUpdateTime *time.Time `type:"timestamp"` + + // MemberAccountRuleStatus is a required field + MemberAccountRuleStatus *string `type:"string" required:"true" enum:"MemberAccountRuleStatus"` +} + +// String returns the string representation +func (s MemberAccountStatus) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MemberAccountStatus) GoString() string { + return s.String() +} + +// SetAccountId sets the AccountId field's value. +func (s *MemberAccountStatus) SetAccountId(v string) *MemberAccountStatus { + s.AccountId = &v + return s +} + +// SetConfigRuleName sets the ConfigRuleName field's value. +func (s *MemberAccountStatus) SetConfigRuleName(v string) *MemberAccountStatus { + s.ConfigRuleName = &v + return s +} + +// SetErrorCode sets the ErrorCode field's value. +func (s *MemberAccountStatus) SetErrorCode(v string) *MemberAccountStatus { + s.ErrorCode = &v + return s +} + +// SetErrorMessage sets the ErrorMessage field's value. +func (s *MemberAccountStatus) SetErrorMessage(v string) *MemberAccountStatus { + s.ErrorMessage = &v + return s +} + +// SetLastUpdateTime sets the LastUpdateTime field's value. +func (s *MemberAccountStatus) SetLastUpdateTime(v time.Time) *MemberAccountStatus { + s.LastUpdateTime = &v + return s +} + +// SetMemberAccountRuleStatus sets the MemberAccountRuleStatus field's value. +func (s *MemberAccountStatus) SetMemberAccountRuleStatus(v string) *MemberAccountStatus { + s.MemberAccountRuleStatus = &v + return s +} + // This object contains regions to set up the aggregator and an IAM role to // retrieve organization details. type OrganizationAggregationSource struct { @@ -11175,6 +11960,352 @@ func (s *OrganizationAggregationSource) SetRoleArn(v string) *OrganizationAggreg return s } +type OrganizationConfigRule struct { + _ struct{} `type:"structure"` + + ExcludedAccounts []*string `type:"list"` + + LastUpdateTime *time.Time `type:"timestamp"` + + // OrganizationConfigRuleArn is a required field + OrganizationConfigRuleArn *string `min:"1" type:"string" required:"true"` + + // OrganizationConfigRuleName is a required field + OrganizationConfigRuleName *string `min:"1" type:"string" required:"true"` + + OrganizationCustomRuleMetadata *OrganizationCustomRuleMetadata `type:"structure"` + + OrganizationManagedRuleMetadata *OrganizationManagedRuleMetadata `type:"structure"` +} + +// String returns the string representation +func (s OrganizationConfigRule) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s OrganizationConfigRule) GoString() string { + return s.String() +} + +// SetExcludedAccounts sets the ExcludedAccounts field's value. +func (s *OrganizationConfigRule) SetExcludedAccounts(v []*string) *OrganizationConfigRule { + s.ExcludedAccounts = v + return s +} + +// SetLastUpdateTime sets the LastUpdateTime field's value. +func (s *OrganizationConfigRule) SetLastUpdateTime(v time.Time) *OrganizationConfigRule { + s.LastUpdateTime = &v + return s +} + +// SetOrganizationConfigRuleArn sets the OrganizationConfigRuleArn field's value. +func (s *OrganizationConfigRule) SetOrganizationConfigRuleArn(v string) *OrganizationConfigRule { + s.OrganizationConfigRuleArn = &v + return s +} + +// SetOrganizationConfigRuleName sets the OrganizationConfigRuleName field's value. +func (s *OrganizationConfigRule) SetOrganizationConfigRuleName(v string) *OrganizationConfigRule { + s.OrganizationConfigRuleName = &v + return s +} + +// SetOrganizationCustomRuleMetadata sets the OrganizationCustomRuleMetadata field's value. +func (s *OrganizationConfigRule) SetOrganizationCustomRuleMetadata(v *OrganizationCustomRuleMetadata) *OrganizationConfigRule { + s.OrganizationCustomRuleMetadata = v + return s +} + +// SetOrganizationManagedRuleMetadata sets the OrganizationManagedRuleMetadata field's value. +func (s *OrganizationConfigRule) SetOrganizationManagedRuleMetadata(v *OrganizationManagedRuleMetadata) *OrganizationConfigRule { + s.OrganizationManagedRuleMetadata = v + return s +} + +type OrganizationConfigRuleStatus struct { + _ struct{} `type:"structure"` + + ErrorCode *string `type:"string"` + + ErrorMessage *string `type:"string"` + + LastUpdateTime *time.Time `type:"timestamp"` + + // OrganizationConfigRuleName is a required field + OrganizationConfigRuleName *string `min:"1" type:"string" required:"true"` + + // OrganizationRuleStatus is a required field + OrganizationRuleStatus *string `type:"string" required:"true" enum:"OrganizationRuleStatus"` +} + +// String returns the string representation +func (s OrganizationConfigRuleStatus) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s OrganizationConfigRuleStatus) GoString() string { + return s.String() +} + +// SetErrorCode sets the ErrorCode field's value. +func (s *OrganizationConfigRuleStatus) SetErrorCode(v string) *OrganizationConfigRuleStatus { + s.ErrorCode = &v + return s +} + +// SetErrorMessage sets the ErrorMessage field's value. +func (s *OrganizationConfigRuleStatus) SetErrorMessage(v string) *OrganizationConfigRuleStatus { + s.ErrorMessage = &v + return s +} + +// SetLastUpdateTime sets the LastUpdateTime field's value. +func (s *OrganizationConfigRuleStatus) SetLastUpdateTime(v time.Time) *OrganizationConfigRuleStatus { + s.LastUpdateTime = &v + return s +} + +// SetOrganizationConfigRuleName sets the OrganizationConfigRuleName field's value. +func (s *OrganizationConfigRuleStatus) SetOrganizationConfigRuleName(v string) *OrganizationConfigRuleStatus { + s.OrganizationConfigRuleName = &v + return s +} + +// SetOrganizationRuleStatus sets the OrganizationRuleStatus field's value. +func (s *OrganizationConfigRuleStatus) SetOrganizationRuleStatus(v string) *OrganizationConfigRuleStatus { + s.OrganizationRuleStatus = &v + return s +} + +type OrganizationCustomRuleMetadata struct { + _ struct{} `type:"structure"` + + Description *string `type:"string"` + + InputParameters *string `min:"1" type:"string"` + + // LambdaFunctionArn is a required field + LambdaFunctionArn *string `min:"1" type:"string" required:"true"` + + MaximumExecutionFrequency *string `type:"string" enum:"MaximumExecutionFrequency"` + + // OrganizationConfigRuleTriggerTypes is a required field + OrganizationConfigRuleTriggerTypes []*string `type:"list" required:"true"` + + ResourceIdScope *string `min:"1" type:"string"` + + ResourceTypesScope []*string `type:"list"` + + TagKeyScope *string `min:"1" type:"string"` + + TagValueScope *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s OrganizationCustomRuleMetadata) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s OrganizationCustomRuleMetadata) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *OrganizationCustomRuleMetadata) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "OrganizationCustomRuleMetadata"} + if s.InputParameters != nil && len(*s.InputParameters) < 1 { + invalidParams.Add(request.NewErrParamMinLen("InputParameters", 1)) + } + if s.LambdaFunctionArn == nil { + invalidParams.Add(request.NewErrParamRequired("LambdaFunctionArn")) + } + if s.LambdaFunctionArn != nil && len(*s.LambdaFunctionArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LambdaFunctionArn", 1)) + } + if s.OrganizationConfigRuleTriggerTypes == nil { + invalidParams.Add(request.NewErrParamRequired("OrganizationConfigRuleTriggerTypes")) + } + if s.ResourceIdScope != nil && len(*s.ResourceIdScope) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceIdScope", 1)) + } + if s.TagKeyScope != nil && len(*s.TagKeyScope) < 1 { + invalidParams.Add(request.NewErrParamMinLen("TagKeyScope", 1)) + } + if s.TagValueScope != nil && len(*s.TagValueScope) < 1 { + invalidParams.Add(request.NewErrParamMinLen("TagValueScope", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDescription sets the Description field's value. +func (s *OrganizationCustomRuleMetadata) SetDescription(v string) *OrganizationCustomRuleMetadata { + s.Description = &v + return s +} + +// SetInputParameters sets the InputParameters field's value. +func (s *OrganizationCustomRuleMetadata) SetInputParameters(v string) *OrganizationCustomRuleMetadata { + s.InputParameters = &v + return s +} + +// SetLambdaFunctionArn sets the LambdaFunctionArn field's value. +func (s *OrganizationCustomRuleMetadata) SetLambdaFunctionArn(v string) *OrganizationCustomRuleMetadata { + s.LambdaFunctionArn = &v + return s +} + +// SetMaximumExecutionFrequency sets the MaximumExecutionFrequency field's value. +func (s *OrganizationCustomRuleMetadata) SetMaximumExecutionFrequency(v string) *OrganizationCustomRuleMetadata { + s.MaximumExecutionFrequency = &v + return s +} + +// SetOrganizationConfigRuleTriggerTypes sets the OrganizationConfigRuleTriggerTypes field's value. +func (s *OrganizationCustomRuleMetadata) SetOrganizationConfigRuleTriggerTypes(v []*string) *OrganizationCustomRuleMetadata { + s.OrganizationConfigRuleTriggerTypes = v + return s +} + +// SetResourceIdScope sets the ResourceIdScope field's value. +func (s *OrganizationCustomRuleMetadata) SetResourceIdScope(v string) *OrganizationCustomRuleMetadata { + s.ResourceIdScope = &v + return s +} + +// SetResourceTypesScope sets the ResourceTypesScope field's value. +func (s *OrganizationCustomRuleMetadata) SetResourceTypesScope(v []*string) *OrganizationCustomRuleMetadata { + s.ResourceTypesScope = v + return s +} + +// SetTagKeyScope sets the TagKeyScope field's value. +func (s *OrganizationCustomRuleMetadata) SetTagKeyScope(v string) *OrganizationCustomRuleMetadata { + s.TagKeyScope = &v + return s +} + +// SetTagValueScope sets the TagValueScope field's value. +func (s *OrganizationCustomRuleMetadata) SetTagValueScope(v string) *OrganizationCustomRuleMetadata { + s.TagValueScope = &v + return s +} + +type OrganizationManagedRuleMetadata struct { + _ struct{} `type:"structure"` + + Description *string `type:"string"` + + InputParameters *string `min:"1" type:"string"` + + MaximumExecutionFrequency *string `type:"string" enum:"MaximumExecutionFrequency"` + + ResourceIdScope *string `min:"1" type:"string"` + + ResourceTypesScope []*string `type:"list"` + + // RuleIdentifier is a required field + RuleIdentifier *string `min:"1" type:"string" required:"true"` + + TagKeyScope *string `min:"1" type:"string"` + + TagValueScope *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s OrganizationManagedRuleMetadata) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s OrganizationManagedRuleMetadata) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *OrganizationManagedRuleMetadata) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "OrganizationManagedRuleMetadata"} + if s.InputParameters != nil && len(*s.InputParameters) < 1 { + invalidParams.Add(request.NewErrParamMinLen("InputParameters", 1)) + } + if s.ResourceIdScope != nil && len(*s.ResourceIdScope) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceIdScope", 1)) + } + if s.RuleIdentifier == nil { + invalidParams.Add(request.NewErrParamRequired("RuleIdentifier")) + } + if s.RuleIdentifier != nil && len(*s.RuleIdentifier) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RuleIdentifier", 1)) + } + if s.TagKeyScope != nil && len(*s.TagKeyScope) < 1 { + invalidParams.Add(request.NewErrParamMinLen("TagKeyScope", 1)) + } + if s.TagValueScope != nil && len(*s.TagValueScope) < 1 { + invalidParams.Add(request.NewErrParamMinLen("TagValueScope", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDescription sets the Description field's value. +func (s *OrganizationManagedRuleMetadata) SetDescription(v string) *OrganizationManagedRuleMetadata { + s.Description = &v + return s +} + +// SetInputParameters sets the InputParameters field's value. +func (s *OrganizationManagedRuleMetadata) SetInputParameters(v string) *OrganizationManagedRuleMetadata { + s.InputParameters = &v + return s +} + +// SetMaximumExecutionFrequency sets the MaximumExecutionFrequency field's value. +func (s *OrganizationManagedRuleMetadata) SetMaximumExecutionFrequency(v string) *OrganizationManagedRuleMetadata { + s.MaximumExecutionFrequency = &v + return s +} + +// SetResourceIdScope sets the ResourceIdScope field's value. +func (s *OrganizationManagedRuleMetadata) SetResourceIdScope(v string) *OrganizationManagedRuleMetadata { + s.ResourceIdScope = &v + return s +} + +// SetResourceTypesScope sets the ResourceTypesScope field's value. +func (s *OrganizationManagedRuleMetadata) SetResourceTypesScope(v []*string) *OrganizationManagedRuleMetadata { + s.ResourceTypesScope = v + return s +} + +// SetRuleIdentifier sets the RuleIdentifier field's value. +func (s *OrganizationManagedRuleMetadata) SetRuleIdentifier(v string) *OrganizationManagedRuleMetadata { + s.RuleIdentifier = &v + return s +} + +// SetTagKeyScope sets the TagKeyScope field's value. +func (s *OrganizationManagedRuleMetadata) SetTagKeyScope(v string) *OrganizationManagedRuleMetadata { + s.TagKeyScope = &v + return s +} + +// SetTagValueScope sets the TagValueScope field's value. +func (s *OrganizationManagedRuleMetadata) SetTagValueScope(v string) *OrganizationManagedRuleMetadata { + s.TagValueScope = &v + return s +} + // An object that represents the account ID and region of an aggregator account // that is requesting authorization but is not yet authorized. type PendingAggregationRequest struct { @@ -11711,6 +12842,101 @@ func (s *PutEvaluationsOutput) SetFailedEvaluations(v []*Evaluation) *PutEvaluat return s } +type PutOrganizationConfigRuleInput struct { + _ struct{} `type:"structure"` + + ExcludedAccounts []*string `type:"list"` + + // OrganizationConfigRuleName is a required field + OrganizationConfigRuleName *string `min:"1" type:"string" required:"true"` + + OrganizationCustomRuleMetadata *OrganizationCustomRuleMetadata `type:"structure"` + + OrganizationManagedRuleMetadata *OrganizationManagedRuleMetadata `type:"structure"` +} + +// String returns the string representation +func (s PutOrganizationConfigRuleInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutOrganizationConfigRuleInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutOrganizationConfigRuleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutOrganizationConfigRuleInput"} + if s.OrganizationConfigRuleName == nil { + invalidParams.Add(request.NewErrParamRequired("OrganizationConfigRuleName")) + } + if s.OrganizationConfigRuleName != nil && len(*s.OrganizationConfigRuleName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("OrganizationConfigRuleName", 1)) + } + if s.OrganizationCustomRuleMetadata != nil { + if err := s.OrganizationCustomRuleMetadata.Validate(); err != nil { + invalidParams.AddNested("OrganizationCustomRuleMetadata", err.(request.ErrInvalidParams)) + } + } + if s.OrganizationManagedRuleMetadata != nil { + if err := s.OrganizationManagedRuleMetadata.Validate(); err != nil { + invalidParams.AddNested("OrganizationManagedRuleMetadata", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetExcludedAccounts sets the ExcludedAccounts field's value. +func (s *PutOrganizationConfigRuleInput) SetExcludedAccounts(v []*string) *PutOrganizationConfigRuleInput { + s.ExcludedAccounts = v + return s +} + +// SetOrganizationConfigRuleName sets the OrganizationConfigRuleName field's value. +func (s *PutOrganizationConfigRuleInput) SetOrganizationConfigRuleName(v string) *PutOrganizationConfigRuleInput { + s.OrganizationConfigRuleName = &v + return s +} + +// SetOrganizationCustomRuleMetadata sets the OrganizationCustomRuleMetadata field's value. +func (s *PutOrganizationConfigRuleInput) SetOrganizationCustomRuleMetadata(v *OrganizationCustomRuleMetadata) *PutOrganizationConfigRuleInput { + s.OrganizationCustomRuleMetadata = v + return s +} + +// SetOrganizationManagedRuleMetadata sets the OrganizationManagedRuleMetadata field's value. +func (s *PutOrganizationConfigRuleInput) SetOrganizationManagedRuleMetadata(v *OrganizationManagedRuleMetadata) *PutOrganizationConfigRuleInput { + s.OrganizationManagedRuleMetadata = v + return s +} + +type PutOrganizationConfigRuleOutput struct { + _ struct{} `type:"structure"` + + OrganizationConfigRuleArn *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s PutOrganizationConfigRuleOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutOrganizationConfigRuleOutput) GoString() string { + return s.String() +} + +// SetOrganizationConfigRuleArn sets the OrganizationConfigRuleArn field's value. +func (s *PutOrganizationConfigRuleOutput) SetOrganizationConfigRuleArn(v string) *PutOrganizationConfigRuleOutput { + s.OrganizationConfigRuleArn = &v + return s +} + type PutRemediationConfigurationsInput struct { _ struct{} `type:"structure"` @@ -13179,6 +14405,36 @@ func (s *StaticValue) SetValues(v []*string) *StaticValue { return s } +type StatusDetailFilters struct { + _ struct{} `type:"structure"` + + AccountId *string `type:"string"` + + MemberAccountRuleStatus *string `type:"string" enum:"MemberAccountRuleStatus"` +} + +// String returns the string representation +func (s StatusDetailFilters) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StatusDetailFilters) GoString() string { + return s.String() +} + +// SetAccountId sets the AccountId field's value. +func (s *StatusDetailFilters) SetAccountId(v string) *StatusDetailFilters { + s.AccountId = &v + return s +} + +// SetMemberAccountRuleStatus sets the MemberAccountRuleStatus field's value. +func (s *StatusDetailFilters) SetMemberAccountRuleStatus(v string) *StatusDetailFilters { + s.MemberAccountRuleStatus = &v + return s +} + // The input for the StopConfigurationRecorder action. type StopConfigurationRecorderInput struct { _ struct{} `type:"structure"` @@ -13558,6 +14814,26 @@ const ( MaximumExecutionFrequencyTwentyFourHours = "TwentyFour_Hours" ) +const ( + // MemberAccountRuleStatusCreateSuccessful is a MemberAccountRuleStatus enum value + MemberAccountRuleStatusCreateSuccessful = "CREATE_SUCCESSFUL" + + // MemberAccountRuleStatusCreateInProgress is a MemberAccountRuleStatus enum value + MemberAccountRuleStatusCreateInProgress = "CREATE_IN_PROGRESS" + + // MemberAccountRuleStatusCreateFailed is a MemberAccountRuleStatus enum value + MemberAccountRuleStatusCreateFailed = "CREATE_FAILED" + + // MemberAccountRuleStatusDeleteSuccessful is a MemberAccountRuleStatus enum value + MemberAccountRuleStatusDeleteSuccessful = "DELETE_SUCCESSFUL" + + // MemberAccountRuleStatusDeleteFailed is a MemberAccountRuleStatus enum value + MemberAccountRuleStatusDeleteFailed = "DELETE_FAILED" + + // MemberAccountRuleStatusDeleteInProgress is a MemberAccountRuleStatus enum value + MemberAccountRuleStatusDeleteInProgress = "DELETE_IN_PROGRESS" +) + const ( // MessageTypeConfigurationItemChangeNotification is a MessageType enum value MessageTypeConfigurationItemChangeNotification = "ConfigurationItemChangeNotification" @@ -13572,6 +14848,37 @@ const ( MessageTypeOversizedConfigurationItemChangeNotification = "OversizedConfigurationItemChangeNotification" ) +const ( + // OrganizationConfigRuleTriggerTypeConfigurationItemChangeNotification is a OrganizationConfigRuleTriggerType enum value + OrganizationConfigRuleTriggerTypeConfigurationItemChangeNotification = "ConfigurationItemChangeNotification" + + // OrganizationConfigRuleTriggerTypeOversizedConfigurationItemChangeNotification is a OrganizationConfigRuleTriggerType enum value + OrganizationConfigRuleTriggerTypeOversizedConfigurationItemChangeNotification = "OversizedConfigurationItemChangeNotification" + + // OrganizationConfigRuleTriggerTypeScheduledNotification is a OrganizationConfigRuleTriggerType enum value + OrganizationConfigRuleTriggerTypeScheduledNotification = "ScheduledNotification" +) + +const ( + // OrganizationRuleStatusCreateSuccessful is a OrganizationRuleStatus enum value + OrganizationRuleStatusCreateSuccessful = "CREATE_SUCCESSFUL" + + // OrganizationRuleStatusCreateInProgress is a OrganizationRuleStatus enum value + OrganizationRuleStatusCreateInProgress = "CREATE_IN_PROGRESS" + + // OrganizationRuleStatusCreateFailed is a OrganizationRuleStatus enum value + OrganizationRuleStatusCreateFailed = "CREATE_FAILED" + + // OrganizationRuleStatusDeleteSuccessful is a OrganizationRuleStatus enum value + OrganizationRuleStatusDeleteSuccessful = "DELETE_SUCCESSFUL" + + // OrganizationRuleStatusDeleteFailed is a OrganizationRuleStatus enum value + OrganizationRuleStatusDeleteFailed = "DELETE_FAILED" + + // OrganizationRuleStatusDeleteInProgress is a OrganizationRuleStatus enum value + OrganizationRuleStatusDeleteInProgress = "DELETE_IN_PROGRESS" +) + const ( // OwnerCustomLambda is a Owner enum value OwnerCustomLambda = "CUSTOM_LAMBDA" diff --git a/vendor/github.com/aws/aws-sdk-go/service/configservice/errors.go b/vendor/github.com/aws/aws-sdk-go/service/configservice/errors.go index c918050d06a1..790f1ede55de 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/configservice/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/configservice/errors.go @@ -136,6 +136,10 @@ const ( // You have reached the limit of the number of delivery channels you can create. ErrCodeMaxNumberOfDeliveryChannelsExceededException = "MaxNumberOfDeliveryChannelsExceededException" + // ErrCodeMaxNumberOfOrganizationConfigRulesExceededException for service response error code + // "MaxNumberOfOrganizationConfigRulesExceededException". + ErrCodeMaxNumberOfOrganizationConfigRulesExceededException = "MaxNumberOfOrganizationConfigRulesExceededException" + // ErrCodeMaxNumberOfRetentionConfigurationsExceededException for service response error code // "MaxNumberOfRetentionConfigurationsExceededException". // @@ -199,6 +203,10 @@ const ( // You have specified a delivery channel that does not exist. ErrCodeNoSuchDeliveryChannelException = "NoSuchDeliveryChannelException" + // ErrCodeNoSuchOrganizationConfigRuleException for service response error code + // "NoSuchOrganizationConfigRuleException". + ErrCodeNoSuchOrganizationConfigRuleException = "NoSuchOrganizationConfigRuleException" + // ErrCodeNoSuchRemediationConfigurationException for service response error code // "NoSuchRemediationConfigurationException". // @@ -230,6 +238,10 @@ const ( // The configuration item size is outside the allowable range. ErrCodeOversizedConfigurationItemException = "OversizedConfigurationItemException" + // ErrCodeRemediationInProgressException for service response error code + // "RemediationInProgressException". + ErrCodeRemediationInProgressException = "RemediationInProgressException" + // ErrCodeResourceInUseException for service response error code // "ResourceInUseException". // diff --git a/vendor/github.com/aws/aws-sdk-go/service/efs/api.go b/vendor/github.com/aws/aws-sdk-go/service/efs/api.go index fbd2e89d9244..bc4815e74e89 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/efs/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/efs/api.go @@ -1447,17 +1447,14 @@ func (c *EFS) PutLifecycleConfigurationRequest(input *PutLifecycleConfigurationI // LifecyclePolicies array in the request body deletes any existing LifecycleConfiguration // and disables lifecycle management. // -// You can enable lifecycle management only for EFS file systems created after -// the release of EFS infrequent access. -// // In the request, specify the following: // -// * The ID for the file system for which you are creating a lifecycle management -// configuration. +// * The ID for the file system for which you are enabling, disabling, or +// modifying lifecycle management. // // * A LifecyclePolicies array of LifecyclePolicy objects that define when // files are moved to the IA storage class. The array can contain only one -// "TransitionToIA": "AFTER_30_DAYS" LifecyclePolicy item. +// LifecyclePolicy item. // // This operation requires permissions for the elasticfilesystem:PutLifecycleConfiguration // operation. @@ -2818,13 +2815,9 @@ func (s *FileSystemSize) SetValueInStandard(v int64) *FileSystemSize { type LifecyclePolicy struct { _ struct{} `type:"structure"` - // A value that indicates how long it takes to transition files to the IA storage - // class. Currently, the only valid value is AFTER_30_DAYS. - // - // AFTER_30_DAYS indicates files that have not been read from or written to - // for 30 days are transitioned from the Standard storage class to the IA storage - // class. Metadata operations such as listing the contents of a directory don't - // count as a file access event. + // A value that describes the period of time that a file is not accessed, after + // which it transitions to the IA storage class. Metadata operations such as + // listing the contents of a directory don't count as file access events. TransitionToIA *string `type:"string" enum:"TransitionToIARules"` } @@ -3421,6 +3414,15 @@ const ( ) const ( + // TransitionToIARulesAfter14Days is a TransitionToIARules enum value + TransitionToIARulesAfter14Days = "AFTER_14_DAYS" + // TransitionToIARulesAfter30Days is a TransitionToIARules enum value TransitionToIARulesAfter30Days = "AFTER_30_DAYS" + + // TransitionToIARulesAfter60Days is a TransitionToIARules enum value + TransitionToIARulesAfter60Days = "AFTER_60_DAYS" + + // TransitionToIARulesAfter90Days is a TransitionToIARules enum value + TransitionToIARulesAfter90Days = "AFTER_90_DAYS" ) diff --git a/vendor/github.com/aws/aws-sdk-go/service/gamelift/api.go b/vendor/github.com/aws/aws-sdk-go/service/gamelift/api.go index 122d12a267b9..71837a3a266b 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/gamelift/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/gamelift/api.go @@ -75,12 +75,20 @@ func (c *GameLift) AcceptMatchRequest(input *AcceptMatchInput) (req *request.Req // // If any player rejects the match, or if acceptances are not received before // a specified timeout, the proposed match is dropped. The matchmaking tickets -// are then handled in one of two ways: For tickets where all players accepted -// the match, the ticket status is returned to SEARCHING to find a new match. -// For tickets where one or more players failed to accept the match, the ticket -// status is set to FAILED, and processing is terminated. A new matchmaking +// are then handled in one of two ways: For tickets where one or more players +// rejected the match, the ticket status is returned to SEARCHING to find a +// new match. For tickets where one or more players failed to respond, the ticket +// status is set to CANCELLED, and processing is terminated. A new matchmaking // request for these players can be submitted as needed. // +// Learn more +// +// Add FlexMatch to a Game Client (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-client.html) +// +// FlexMatch Events Reference (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-events.html) +// +// Related operations +// // * StartMatchmaking // // * DescribeMatchmaking @@ -919,21 +927,21 @@ func (c *GameLift) CreateMatchmakingConfigurationRequest(input *CreateMatchmakin // game session for the match; and the maximum time allowed for a matchmaking // attempt. // -// Player acceptance -- In each configuration, you have the option to require -// that all players accept participation in a proposed match. To enable this -// feature, set AcceptanceRequired to true and specify a time limit for player -// acceptance. Players have the option to accept or reject a proposed match, -// and a match does not move ahead to game session placement unless all matched -// players accept. -// -// Matchmaking status notification -- There are two ways to track the progress -// of matchmaking tickets: (1) polling ticket status with DescribeMatchmaking; -// or (2) receiving notifications with Amazon Simple Notification Service (SNS). -// To use notifications, you first need to set up an SNS topic to receive the -// notifications, and provide the topic ARN in the matchmaking configuration -// (see Setting up Notifications for Matchmaking (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-notification.html)). -// Since notifications promise only "best effort" delivery, we recommend calling -// DescribeMatchmaking if no notifications are received within 30 seconds. +// There are two ways to track the progress of matchmaking tickets: (1) polling +// ticket status with DescribeMatchmaking; or (2) receiving notifications with +// Amazon Simple Notification Service (SNS). To use notifications, you first +// need to set up an SNS topic to receive the notifications, and provide the +// topic ARN in the matchmaking configuration. Since notifications promise only +// "best effort" delivery, we recommend calling DescribeMatchmaking if no notifications +// are received within 30 seconds. +// +// Learn more +// +// Design a FlexMatch Matchmaker (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-configuration.html) +// +// Setting up Notifications for Matchmaking (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-notification.html) +// +// Related operations // // * CreateMatchmakingConfiguration // @@ -1052,7 +1060,7 @@ func (c *GameLift) CreateMatchmakingRuleSetRequest(input *CreateMatchmakingRuleS // // To create a matchmaking rule set, provide unique rule set name and the rule // set body in JSON format. Rule sets must be defined in the same region as -// the matchmaking configuration they will be used with. +// the matchmaking configuration they are used with. // // Since matchmaking rule sets cannot be edited, it is a good idea to check // the rule set syntax using ValidateMatchmakingRuleSet before creating a new @@ -2045,6 +2053,11 @@ func (c *GameLift) DeleteFleetRequest(input *DeleteFleetInput) (req *request.Req // Deletes everything related to a fleet. Before deleting a fleet, you must // set the fleet's desired capacity to zero. See UpdateFleetCapacity. // +// If the fleet being deleted has a VPC peering connection, you first need to +// get a valid authorization (good for 24 hours) by calling CreateVpcPeeringAuthorization. +// You do not need to explicitly delete the VPC peering connection--this is +// done as part of the delete fleet process. +// // This action removes the fleet's resources and the fleet record. Once a fleet // is deleted, you can no longer use that fleet. // @@ -2272,6 +2285,8 @@ func (c *GameLift) DeleteMatchmakingConfigurationRequest(input *DeleteMatchmakin // the configuration name. A matchmaking configuration cannot be deleted if // it is being used in any active matchmaking tickets. // +// Related operations +// // * CreateMatchmakingConfiguration // // * DescribeMatchmakingConfigurations @@ -2722,9 +2737,8 @@ func (c *GameLift) DeleteVpcPeeringAuthorizationRequest(input *DeleteVpcPeeringA // DeleteVpcPeeringAuthorization API operation for Amazon GameLift. // -// Cancels a pending VPC peering authorization for the specified VPC. If the -// authorization has already been used to create a peering connection, call -// DeleteVpcPeeringConnection to remove the connection. +// Cancels a pending VPC peering authorization for the specified VPC. If you +// need to delete an existing VPC peering connection, call DeleteVpcPeeringConnection. // // * CreateVpcPeeringAuthorization // @@ -4452,6 +4466,14 @@ func (c *GameLift) DescribeMatchmakingRequest(input *DescribeMatchmakingInput) ( // the request is successful, a ticket object is returned for each requested // ID that currently exists. // +// Learn more +// +// Add FlexMatch to a Game Client (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-client.html) +// +// Set Up FlexMatch Event Notification (https://docs.aws.amazon.com/gamelift/latest/developerguidematch-notification.html) +// +// Related operations +// // * StartMatchmaking // // * DescribeMatchmaking @@ -4548,7 +4570,7 @@ func (c *GameLift) DescribeMatchmakingConfigurationsRequest(input *DescribeMatch // DescribeMatchmakingConfigurations API operation for Amazon GameLift. // -// Retrieves the details of FlexMatch matchmaking configurations. with this +// Retrieves the details of FlexMatch matchmaking configurations. With this // operation, you have the following options: (1) retrieve all existing configurations, // (2) provide the names of one or more configurations to retrieve, or (3) retrieve // all configurations that use a specified rule set name. When requesting multiple @@ -4557,6 +4579,12 @@ func (c *GameLift) DescribeMatchmakingConfigurationsRequest(input *DescribeMatch // When specifying a list of names, only configurations that currently exist // are returned. // +// Learn more +// +// Setting Up FlexMatch Matchmakers (https://docs.aws.amazon.com/gamelift/latest/developerguide/matchmaker-build.html) +// +// Related operations +// // * CreateMatchmakingConfiguration // // * DescribeMatchmakingConfigurations @@ -6945,8 +6973,7 @@ func (c *GameLift) StartMatchBackfillRequest(input *StartMatchBackfillInput) (re // all current players in the game session. If successful, a match backfill // ticket is created and returned with status set to QUEUED. The ticket is placed // in the matchmaker's ticket pool and processed. Track the status of the ticket -// to respond as needed. For more detail how to set up backfilling, see Backfill -// Existing Games with FlexMatch (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-backfill.html). +// to respond as needed. // // The process of finding backfill matches is essentially identical to the initial // matchmaking process. The matchmaker searches the pool and groups tickets @@ -6956,7 +6983,15 @@ func (c *GameLift) StartMatchBackfillRequest(input *StartMatchBackfillInput) (re // game session's connection information, and the GameSession object is updated // to include matchmaker data on the new players. For more detail on how match // backfill requests are processed, see How Amazon GameLift FlexMatch Works -// (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-intro.html). +// (https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-match.html). +// +// Learn more +// +// Backfill Existing Games with FlexMatch (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-backfill.html) +// +// How GameLift FlexMatch Works (https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-match.html) +// +// Related operations // // * StartMatchmaking // @@ -7066,9 +7101,7 @@ func (c *GameLift) StartMatchmakingRequest(input *StartMatchmakingInput) (req *r // A matchmaking request might start with a single player or a group of players // who want to play together. FlexMatch finds additional players as needed to // fill the match. Match type, rules, and the queue used to place a new game -// session are defined in a MatchmakingConfiguration. For complete information -// on setting up and using FlexMatch, see the topic Adding FlexMatch to Your -// Game (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-intro.html). +// session are defined in a MatchmakingConfiguration. // // To start matchmaking, provide a unique ticket ID, specify a matchmaking configuration, // and include the players to be matched. You must also include a set of player @@ -7120,6 +7153,18 @@ func (c *GameLift) StartMatchmakingRequest(input *StartMatchmakingInput) (req *r // and player session) is added to the matchmaking tickets. Matched players // can use the connection information to join the game. // +// Learn more +// +// Add FlexMatch to a Game Client (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-client.html) +// +// Set Up FlexMatch Event Notification (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-notification.html) +// +// FlexMatch Integration Roadmap (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-tasks.html) +// +// How GameLift FlexMatch Works (https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-match.html) +// +// Related operations +// // * StartMatchmaking // // * DescribeMatchmaking @@ -7453,9 +7498,23 @@ func (c *GameLift) StopMatchmakingRequest(input *StopMatchmakingInput) (req *req // StopMatchmaking API operation for Amazon GameLift. // -// Cancels a matchmaking ticket that is currently being processed. To stop the -// matchmaking operation, specify the ticket ID. If successful, work on the -// ticket is stopped, and the ticket status is changed to CANCELLED. +// Cancels a matchmaking ticket or match backfill ticket that is currently being +// processed. To stop the matchmaking operation, specify the ticket ID. If successful, +// work on the ticket is stopped, and the ticket status is changed to CANCELLED. +// +// This call is also used to turn off automatic backfill for an individual game +// session. This is for game sessions that are created with a matchmaking configuration +// that has automatic backfill enabled. The ticket ID is included in the MatchmakerData +// of an updated game session object, which is provided to the game server. +// +// If the action is successful, the service sends back an empty JSON struct +// with the HTTP 200 response (not an empty HTTP body). +// +// Learn more +// +// Add FlexMatch to a Game Client (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-client.html) +// +// Related operations // // * StartMatchmaking // @@ -8404,8 +8463,16 @@ func (c *GameLift) UpdateMatchmakingConfigurationRequest(input *UpdateMatchmakin // UpdateMatchmakingConfiguration API operation for Amazon GameLift. // -// Updates settings for a FlexMatch matchmaking configuration. To update settings, -// specify the configuration name to be updated and provide the new settings. +// Updates settings for a FlexMatch matchmaking configuration. These changes +// affect all matches and game sessions that are created after the update. To +// update settings, specify the configuration name to be updated and provide +// the new settings. +// +// Learn more +// +// Design a FlexMatch Matchmaker (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-configuration.html) +// +// Related operations // // * CreateMatchmakingConfiguration // @@ -8853,7 +8920,7 @@ type AcceptMatchInput struct { // REQUIRES_ACCEPTANCE; otherwise this request will fail. // // TicketId is a required field - TicketId *string `min:"1" type:"string" required:"true"` + TicketId *string `type:"string" required:"true"` } // String returns the string representation @@ -8878,9 +8945,6 @@ func (s *AcceptMatchInput) Validate() error { if s.TicketId == nil { invalidParams.Add(request.NewErrParamRequired("TicketId")) } - if s.TicketId != nil && len(*s.TicketId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("TicketId", 1)) - } if invalidParams.Len() > 0 { return invalidParams @@ -9015,7 +9079,7 @@ func (s *Alias) SetRoutingStrategy(v *RoutingStrategy) *Alias { // Values for use in Player attribute key:value pairs. This object lets you // specify an attribute value using any of the valid data types: string, number, -// string array or data map. Each AttributeValue object can use only one of +// string array, or data map. Each AttributeValue object can use only one of // the available properties. type AttributeValue struct { _ struct{} `type:"structure"` @@ -10068,7 +10132,7 @@ func (s *CreateGameSessionQueueOutput) SetGameSessionQueue(v *GameSessionQueue) type CreateMatchmakingConfigurationInput struct { _ struct{} `type:"structure"` - // Flag that determines whether or not a match that was created with this configuration + // Flag that determines whether a match that was created with this configuration // must be accepted by the matched players. To require acceptance, set to TRUE. // // AcceptanceRequired is a required field @@ -10085,7 +10149,15 @@ type CreateMatchmakingConfigurationInput struct { // for the match. AdditionalPlayerCount *int64 `type:"integer"` - // Information to attached to all events related to the matchmaking configuration. + // Method used to backfill game sessions created with this matchmaking configuration. + // Specify MANUAL when your game manages backfill requests manually or does + // not use the match backfill feature. Specify AUTOMATIC to have GameLift create + // a StartMatchBackfill request whenever a game session has one or more open + // slots. Learn more about manual and automatic backfill in Backfill Existing + // Games with FlexMatch (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-backfill.html). + BackfillMode *string `type:"string" enum:"BackfillMode"` + + // Information to be added to all events related to this matchmaking configuration. CustomEventData *string `type:"string"` // Meaningful description of the matchmaking configuration. @@ -10107,7 +10179,7 @@ type CreateMatchmakingConfigurationInput struct { // Amazon Resource Name (ARN (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html)) // that is assigned to a game session queue and uniquely identifies it. Format - // is arn:aws:gamelift:::fleet/fleet-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912. + // is arn:aws:gamelift:::gamesessionqueue/. // These queues are used when placing game sessions for matches that are created // with this matchmaking configuration. Queues can be located in any region. // @@ -10118,13 +10190,14 @@ type CreateMatchmakingConfigurationInput struct { // the configuration associated with a matchmaking request or ticket. // // Name is a required field - Name *string `min:"1" type:"string" required:"true"` + Name *string `type:"string" required:"true"` // SNS topic ARN that is set up to receive matchmaking notifications. NotificationTarget *string `type:"string"` // Maximum duration, in seconds, that a matchmaking ticket can remain in process - // before timing out. Requests that time out can be resubmitted as needed. + // before timing out. Requests that fail due to timing out can be resubmitted + // as needed. // // RequestTimeoutSeconds is a required field RequestTimeoutSeconds *int64 `min:"1" type:"integer" required:"true"` @@ -10134,7 +10207,7 @@ type CreateMatchmakingConfigurationInput struct { // same region. // // RuleSetName is a required field - RuleSetName *string `min:"1" type:"string" required:"true"` + RuleSetName *string `type:"string" required:"true"` } // String returns the string representation @@ -10168,9 +10241,6 @@ func (s *CreateMatchmakingConfigurationInput) Validate() error { if s.Name == nil { invalidParams.Add(request.NewErrParamRequired("Name")) } - if s.Name != nil && len(*s.Name) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Name", 1)) - } if s.RequestTimeoutSeconds == nil { invalidParams.Add(request.NewErrParamRequired("RequestTimeoutSeconds")) } @@ -10180,9 +10250,6 @@ func (s *CreateMatchmakingConfigurationInput) Validate() error { if s.RuleSetName == nil { invalidParams.Add(request.NewErrParamRequired("RuleSetName")) } - if s.RuleSetName != nil && len(*s.RuleSetName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("RuleSetName", 1)) - } if s.GameProperties != nil { for i, v := range s.GameProperties { if v == nil { @@ -10218,6 +10285,12 @@ func (s *CreateMatchmakingConfigurationInput) SetAdditionalPlayerCount(v int64) return s } +// SetBackfillMode sets the BackfillMode field's value. +func (s *CreateMatchmakingConfigurationInput) SetBackfillMode(v string) *CreateMatchmakingConfigurationInput { + s.BackfillMode = &v + return s +} + // SetCustomEventData sets the CustomEventData field's value. func (s *CreateMatchmakingConfigurationInput) SetCustomEventData(v string) *CreateMatchmakingConfigurationInput { s.CustomEventData = &v @@ -10305,10 +10378,10 @@ type CreateMatchmakingRuleSetInput struct { // is different from the optional "name" field in the rule set body.) // // Name is a required field - Name *string `min:"1" type:"string" required:"true"` + Name *string `type:"string" required:"true"` - // Collection of matchmaking rules, formatted as a JSON string. Note that comments - // are not allowed in JSON, but most elements support a description field. + // Collection of matchmaking rules, formatted as a JSON string. Comments are + // not allowed in JSON, but most elements support a description field. // // RuleSetBody is a required field RuleSetBody *string `min:"1" type:"string" required:"true"` @@ -10330,9 +10403,6 @@ func (s *CreateMatchmakingRuleSetInput) Validate() error { if s.Name == nil { invalidParams.Add(request.NewErrParamRequired("Name")) } - if s.Name != nil && len(*s.Name) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Name", 1)) - } if s.RuleSetBody == nil { invalidParams.Add(request.NewErrParamRequired("RuleSetBody")) } @@ -11097,7 +11167,7 @@ type DeleteMatchmakingConfigurationInput struct { // Unique identifier for a matchmaking configuration // // Name is a required field - Name *string `min:"1" type:"string" required:"true"` + Name *string `type:"string" required:"true"` } // String returns the string representation @@ -11116,9 +11186,6 @@ func (s *DeleteMatchmakingConfigurationInput) Validate() error { if s.Name == nil { invalidParams.Add(request.NewErrParamRequired("Name")) } - if s.Name != nil && len(*s.Name) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Name", 1)) - } if invalidParams.Len() > 0 { return invalidParams @@ -11154,7 +11221,7 @@ type DeleteMatchmakingRuleSetInput struct { // set name is different from the optional "name" field in the rule set body.) // // Name is a required field - Name *string `min:"1" type:"string" required:"true"` + Name *string `type:"string" required:"true"` } // String returns the string representation @@ -11173,9 +11240,6 @@ func (s *DeleteMatchmakingRuleSetInput) Validate() error { if s.Name == nil { invalidParams.Add(request.NewErrParamRequired("Name")) } - if s.Name != nil && len(*s.Name) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Name", 1)) - } if invalidParams.Len() > 0 { return invalidParams @@ -12716,7 +12780,7 @@ type DescribeMatchmakingConfigurationsInput struct { // Unique identifier for a matchmaking rule set. Use this parameter to retrieve // all matchmaking configurations that use this rule set. - RuleSetName *string `min:"1" type:"string"` + RuleSetName *string `type:"string"` } // String returns the string representation @@ -12738,9 +12802,6 @@ func (s *DescribeMatchmakingConfigurationsInput) Validate() error { if s.NextToken != nil && len(*s.NextToken) < 1 { invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) } - if s.RuleSetName != nil && len(*s.RuleSetName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("RuleSetName", 1)) - } if invalidParams.Len() > 0 { return invalidParams @@ -14849,7 +14910,7 @@ type GameSessionQueue struct { // Amazon Resource Name (ARN (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html)) // that is assigned to a game session queue and uniquely identifies it. Format - // is arn:aws:gamelift:::fleet/fleet-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912. + // is arn:aws:gamelift:::gamesessionqueue/. GameSessionQueueArn *string `min:"1" type:"string"` // Descriptive label that is associated with game session queue. Queue names @@ -15867,7 +15928,7 @@ func (s *MatchedPlayerSession) SetPlayerSessionId(v string) *MatchedPlayerSessio type MatchmakingConfiguration struct { _ struct{} `type:"structure"` - // Flag that determines whether or not a match that was created with this configuration + // Flag that determines whether a match that was created with this configuration // must be accepted by the matched players. To require acceptance, set to TRUE. AcceptanceRequired *bool `type:"boolean"` @@ -15882,11 +15943,18 @@ type MatchmakingConfiguration struct { // for the match. AdditionalPlayerCount *int64 `type:"integer"` + // Method used to backfill game sessions created with this matchmaking configuration. + // MANUAL indicates that the game makes backfill requests or does not use the + // match backfill feature. AUTOMATIC indicates that GameLift creates StartMatchBackfill + // requests whenever a game session has one or more open slots. Learn more about + // manual and automatic backfill in Backfill Existing Games with FlexMatch (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-backfill.html). + BackfillMode *string `type:"string" enum:"BackfillMode"` + // Time stamp indicating when this data object was created. Format is a number // expressed in Unix time as milliseconds (for example "1469498468.057"). CreationTime *time.Time `type:"timestamp"` - // Information to attached to all events related to the matchmaking configuration. + // Information to attach to all events related to the matchmaking configuration. CustomEventData *string `type:"string"` // Descriptive label that is associated with matchmaking configuration. @@ -15908,26 +15976,27 @@ type MatchmakingConfiguration struct { // Amazon Resource Name (ARN (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html)) // that is assigned to a game session queue and uniquely identifies it. Format - // is arn:aws:gamelift:::fleet/fleet-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912. + // is arn:aws:gamelift:::gamesessionqueue/. // These queues are used when placing game sessions for matches that are created // with this matchmaking configuration. Queues can be located in any region. GameSessionQueueArns []*string `type:"list"` // Unique identifier for a matchmaking configuration. This name is used to identify // the configuration associated with a matchmaking request or ticket. - Name *string `min:"1" type:"string"` + Name *string `type:"string"` // SNS topic ARN that is set up to receive matchmaking notifications. NotificationTarget *string `type:"string"` // Maximum duration, in seconds, that a matchmaking ticket can remain in process - // before timing out. Requests that time out can be resubmitted as needed. + // before timing out. Requests that fail due to timing out can be resubmitted + // as needed. RequestTimeoutSeconds *int64 `min:"1" type:"integer"` // Unique identifier for a matchmaking rule set to use with this configuration. // A matchmaking configuration can only use rule sets that are defined in the // same region. - RuleSetName *string `min:"1" type:"string"` + RuleSetName *string `type:"string"` } // String returns the string representation @@ -15958,6 +16027,12 @@ func (s *MatchmakingConfiguration) SetAdditionalPlayerCount(v int64) *Matchmakin return s } +// SetBackfillMode sets the BackfillMode field's value. +func (s *MatchmakingConfiguration) SetBackfillMode(v string) *MatchmakingConfiguration { + s.BackfillMode = &v + return s +} + // SetCreationTime sets the CreationTime field's value. func (s *MatchmakingConfiguration) SetCreationTime(v time.Time) *MatchmakingConfiguration { s.CreationTime = &v @@ -16019,9 +16094,9 @@ func (s *MatchmakingConfiguration) SetRuleSetName(v string) *MatchmakingConfigur } // Set of rule statements, used with FlexMatch, that determine how to build -// a certain kind of player match. Each rule set describes a type of group to -// be created and defines the parameters for acceptable player matches. Rule -// sets are used in MatchmakingConfiguration objects. +// your player matches. Each rule set describes a type of group to be created +// and defines the parameters for acceptable player matches. Rule sets are used +// in MatchmakingConfiguration objects. // // A rule set may define the following elements for a match. For detailed information // and examples showing how to construct a rule set, see Build a FlexMatch Rule @@ -16058,14 +16133,14 @@ type MatchmakingRuleSet struct { // expressed in Unix time as milliseconds (for example "1469498468.057"). CreationTime *time.Time `type:"timestamp"` - // Collection of matchmaking rules, formatted as a JSON string. (Note that comments14 - // are not allowed in JSON, but most elements support a description field.) + // Collection of matchmaking rules, formatted as a JSON string. Comments are + // not allowed in JSON, but most elements support a description field. // // RuleSetBody is a required field RuleSetBody *string `min:"1" type:"string" required:"true"` // Unique identifier for a matchmaking rule set - RuleSetName *string `min:"1" type:"string"` + RuleSetName *string `type:"string"` } // String returns the string representation @@ -16106,7 +16181,7 @@ type MatchmakingTicket struct { // Name of the MatchmakingConfiguration that is used with this ticket. Matchmaking // configurations determine how players are grouped into a match and how a new // game session is created for the match. - ConfigurationName *string `min:"1" type:"string"` + ConfigurationName *string `type:"string"` // Time stamp indicating when this matchmaking request stopped being processed // due to success, failure, or cancellation. Format is a number expressed in @@ -16150,10 +16225,11 @@ type MatchmakingTicket struct { // host the players. A ticket in this state contains the necessary connection // information for players. // - // * FAILED -- The matchmaking request was not completed. Tickets with players - // who fail to accept a proposed match are placed in FAILED status. + // * FAILED -- The matchmaking request was not completed. // - // * CANCELLED -- The matchmaking request was canceled with a call to StopMatchmaking. + // * CANCELLED -- The matchmaking request was canceled. This may be the result + // of a call to StopMatchmaking or a proposed match that one or more players + // failed to accept. // // * TIMED_OUT -- The matchmaking request was not successful within the duration // specified in the matchmaking configuration. @@ -16172,7 +16248,7 @@ type MatchmakingTicket struct { StatusReason *string `type:"string"` // Unique identifier for a matchmaking ticket. - TicketId *string `min:"1" type:"string"` + TicketId *string `type:"string"` } // String returns the string representation @@ -17039,20 +17115,17 @@ func (s *ResourceCreationLimitPolicy) SetPolicyPeriodInMinutes(v int64) *Resourc // Routing configuration for a fleet alias. // -// * CreateFleet +// * CreateAlias // -// * ListFleets +// * ListAliases // -// * DeleteFleet +// * DescribeAlias // -// * Describe fleets: DescribeFleetAttributes DescribeFleetCapacity DescribeFleetPortSettings -// DescribeFleetUtilization DescribeRuntimeConfiguration DescribeEC2InstanceLimits -// DescribeFleetEvents +// * UpdateAlias // -// * Update fleets: UpdateFleetAttributes UpdateFleetCapacity UpdateFleetPortSettings -// UpdateRuntimeConfiguration +// * DeleteAlias // -// * Manage fleet actions: StartFleetActions StopFleetActions +// * ResolveAlias type RoutingStrategy struct { _ struct{} `type:"structure"` @@ -18111,7 +18184,7 @@ type StartMatchBackfillInput struct { // parameter. // // ConfigurationName is a required field - ConfigurationName *string `min:"1" type:"string" required:"true"` + ConfigurationName *string `type:"string" required:"true"` // Amazon Resource Name (ARN (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html)) // that is assigned to a game session and uniquely identifies it. @@ -18138,7 +18211,7 @@ type StartMatchBackfillInput struct { // Unique identifier for a matchmaking ticket. If no ticket ID is specified // here, Amazon GameLift will generate one in the form of a UUID. Use this identifier // to track the match backfill ticket status and retrieve match results. - TicketId *string `min:"1" type:"string"` + TicketId *string `type:"string"` } // String returns the string representation @@ -18157,9 +18230,6 @@ func (s *StartMatchBackfillInput) Validate() error { if s.ConfigurationName == nil { invalidParams.Add(request.NewErrParamRequired("ConfigurationName")) } - if s.ConfigurationName != nil && len(*s.ConfigurationName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ConfigurationName", 1)) - } if s.GameSessionArn == nil { invalidParams.Add(request.NewErrParamRequired("GameSessionArn")) } @@ -18169,9 +18239,6 @@ func (s *StartMatchBackfillInput) Validate() error { if s.Players == nil { invalidParams.Add(request.NewErrParamRequired("Players")) } - if s.TicketId != nil && len(*s.TicketId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("TicketId", 1)) - } if s.Players != nil { for i, v := range s.Players { if v == nil { @@ -18247,7 +18314,7 @@ type StartMatchmakingInput struct { // configurations must exist in the same region as this request. // // ConfigurationName is a required field - ConfigurationName *string `min:"1" type:"string" required:"true"` + ConfigurationName *string `type:"string" required:"true"` // Information on each player to be matched. This information must include a // player ID, and may contain player attributes and latency data to be used @@ -18260,7 +18327,7 @@ type StartMatchmakingInput struct { // Unique identifier for a matchmaking ticket. If no ticket ID is specified // here, Amazon GameLift will generate one in the form of a UUID. Use this identifier // to track the matchmaking ticket status and retrieve match results. - TicketId *string `min:"1" type:"string"` + TicketId *string `type:"string"` } // String returns the string representation @@ -18279,15 +18346,9 @@ func (s *StartMatchmakingInput) Validate() error { if s.ConfigurationName == nil { invalidParams.Add(request.NewErrParamRequired("ConfigurationName")) } - if s.ConfigurationName != nil && len(*s.ConfigurationName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("ConfigurationName", 1)) - } if s.Players == nil { invalidParams.Add(request.NewErrParamRequired("Players")) } - if s.TicketId != nil && len(*s.TicketId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("TicketId", 1)) - } if s.Players != nil { for i, v := range s.Players { if v == nil { @@ -18492,7 +18553,7 @@ type StopMatchmakingInput struct { // Unique identifier for a matchmaking ticket. // // TicketId is a required field - TicketId *string `min:"1" type:"string" required:"true"` + TicketId *string `type:"string" required:"true"` } // String returns the string representation @@ -18511,9 +18572,6 @@ func (s *StopMatchmakingInput) Validate() error { if s.TicketId == nil { invalidParams.Add(request.NewErrParamRequired("TicketId")) } - if s.TicketId != nil && len(*s.TicketId) < 1 { - invalidParams.Add(request.NewErrParamMinLen("TicketId", 1)) - } if invalidParams.Len() > 0 { return invalidParams @@ -19341,7 +19399,7 @@ func (s *UpdateGameSessionQueueOutput) SetGameSessionQueue(v *GameSessionQueue) type UpdateMatchmakingConfigurationInput struct { _ struct{} `type:"structure"` - // Flag that determines whether or not a match that was created with this configuration + // Flag that determines whether a match that was created with this configuration // must be accepted by the matched players. To require acceptance, set to TRUE. AcceptanceRequired *bool `type:"boolean"` @@ -19356,7 +19414,15 @@ type UpdateMatchmakingConfigurationInput struct { // for the match. AdditionalPlayerCount *int64 `type:"integer"` - // Information to attached to all events related to the matchmaking configuration. + // Method used to backfill game sessions created with this matchmaking configuration. + // Specify MANUAL when your game manages backfill requests manually or does + // not use the match backfill feature. Specify AUTOMATIC to have GameLift create + // a StartMatchBackfill request whenever a game session has one or more open + // slots. Learn more about manual and automatic backfill in Backfill Existing + // Games with FlexMatch (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-backfill.html). + BackfillMode *string `type:"string" enum:"BackfillMode"` + + // Information to add to all events related to the matchmaking configuration. CustomEventData *string `type:"string"` // Descriptive label that is associated with matchmaking configuration. @@ -19378,7 +19444,7 @@ type UpdateMatchmakingConfigurationInput struct { // Amazon Resource Name (ARN (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html)) // that is assigned to a game session queue and uniquely identifies it. Format - // is arn:aws:gamelift:::fleet/fleet-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912. + // is arn:aws:gamelift:::gamesessionqueue/. // These queues are used when placing game sessions for matches that are created // with this matchmaking configuration. Queues can be located in any region. GameSessionQueueArns []*string `type:"list"` @@ -19386,7 +19452,7 @@ type UpdateMatchmakingConfigurationInput struct { // Unique identifier for a matchmaking configuration to update. // // Name is a required field - Name *string `min:"1" type:"string" required:"true"` + Name *string `type:"string" required:"true"` // SNS topic ARN that is set up to receive matchmaking notifications. See Setting // up Notifications for Matchmaking (https://docs.aws.amazon.com/gamelift/latest/developerguide/match-notification.html) @@ -19394,13 +19460,14 @@ type UpdateMatchmakingConfigurationInput struct { NotificationTarget *string `type:"string"` // Maximum duration, in seconds, that a matchmaking ticket can remain in process - // before timing out. Requests that time out can be resubmitted as needed. + // before timing out. Requests that fail due to timing out can be resubmitted + // as needed. RequestTimeoutSeconds *int64 `min:"1" type:"integer"` // Unique identifier for a matchmaking rule set to use with this configuration. // A matchmaking configuration can only use rule sets that are defined in the // same region. - RuleSetName *string `min:"1" type:"string"` + RuleSetName *string `type:"string"` } // String returns the string representation @@ -19428,15 +19495,9 @@ func (s *UpdateMatchmakingConfigurationInput) Validate() error { if s.Name == nil { invalidParams.Add(request.NewErrParamRequired("Name")) } - if s.Name != nil && len(*s.Name) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Name", 1)) - } if s.RequestTimeoutSeconds != nil && *s.RequestTimeoutSeconds < 1 { invalidParams.Add(request.NewErrParamMinValue("RequestTimeoutSeconds", 1)) } - if s.RuleSetName != nil && len(*s.RuleSetName) < 1 { - invalidParams.Add(request.NewErrParamMinLen("RuleSetName", 1)) - } if s.GameProperties != nil { for i, v := range s.GameProperties { if v == nil { @@ -19472,6 +19533,12 @@ func (s *UpdateMatchmakingConfigurationInput) SetAdditionalPlayerCount(v int64) return s } +// SetBackfillMode sets the BackfillMode field's value. +func (s *UpdateMatchmakingConfigurationInput) SetBackfillMode(v string) *UpdateMatchmakingConfigurationInput { + s.BackfillMode = &v + return s +} + // SetCustomEventData sets the CustomEventData field's value. func (s *UpdateMatchmakingConfigurationInput) SetCustomEventData(v string) *UpdateMatchmakingConfigurationInput { s.CustomEventData = &v @@ -19815,7 +19882,7 @@ func (s *ValidateMatchmakingRuleSetInput) SetRuleSetBody(v string) *ValidateMatc type ValidateMatchmakingRuleSetOutput struct { _ struct{} `type:"structure"` - // Response indicating whether or not the rule set is valid. + // Response indicating whether the rule set is valid. Valid *bool `type:"boolean"` } @@ -20056,6 +20123,14 @@ const ( AcceptanceTypeReject = "REJECT" ) +const ( + // BackfillModeAutomatic is a BackfillMode enum value + BackfillModeAutomatic = "AUTOMATIC" + + // BackfillModeManual is a BackfillMode enum value + BackfillModeManual = "MANUAL" +) + const ( // BuildStatusInitialized is a BuildStatus enum value BuildStatusInitialized = "INITIALIZED" diff --git a/vendor/github.com/aws/aws-sdk-go/service/kafka/api.go b/vendor/github.com/aws/aws-sdk-go/service/kafka/api.go index bef73a71c736..28b8752e5dd6 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/kafka/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/kafka/api.go @@ -2683,7 +2683,7 @@ type CreateClusterInput struct { // KafkaVersion is a required field KafkaVersion *string `locationName:"kafkaVersion" min:"1" type:"string" required:"true"` - // The number of Kafka broker nodes in the Amazon MSK cluster. + // The number of broker nodes in the cluster. // // NumberOfBrokerNodes is a required field NumberOfBrokerNodes *int64 `locationName:"numberOfBrokerNodes" min:"1" type:"integer" required:"true"` diff --git a/vendor/github.com/aws/aws-sdk-go/service/kinesisvideo/api.go b/vendor/github.com/aws/aws-sdk-go/service/kinesisvideo/api.go index c01f89dec046..7f7f8b44d891 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/kinesisvideo/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/kinesisvideo/api.go @@ -445,6 +445,12 @@ func (c *KinesisVideo) ListStreamsRequest(input *ListStreamsInput) (req *request Name: opListStreams, HTTPMethod: "POST", HTTPPath: "/listStreams", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, } if input == nil { @@ -499,6 +505,56 @@ func (c *KinesisVideo) ListStreamsWithContext(ctx aws.Context, input *ListStream return out, req.Send() } +// ListStreamsPages iterates over the pages of a ListStreams operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListStreams method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListStreams operation. +// pageNum := 0 +// err := client.ListStreamsPages(params, +// func(page *kinesisvideo.ListStreamsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *KinesisVideo) ListStreamsPages(input *ListStreamsInput, fn func(*ListStreamsOutput, bool) bool) error { + return c.ListStreamsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListStreamsPagesWithContext same as ListStreamsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *KinesisVideo) ListStreamsPagesWithContext(ctx aws.Context, input *ListStreamsInput, fn func(*ListStreamsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListStreamsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListStreamsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListStreamsOutput), !p.HasNextPage()) + } + return p.Err() +} + const opListTagsForStream = "ListTagsForStream" // ListTagsForStreamRequest generates a "aws/request.Request" representing the @@ -2142,6 +2198,9 @@ const ( // APINameGetHlsStreamingSessionUrl is a APIName enum value APINameGetHlsStreamingSessionUrl = "GET_HLS_STREAMING_SESSION_URL" + + // APINameGetDashStreamingSessionUrl is a APIName enum value + APINameGetDashStreamingSessionUrl = "GET_DASH_STREAMING_SESSION_URL" ) const ( diff --git a/vendor/github.com/aws/aws-sdk-go/service/waf/api.go b/vendor/github.com/aws/aws-sdk-go/service/waf/api.go index 40fb4aa5c53a..88f755a9e9c8 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/waf/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/waf/api.go @@ -613,6 +613,12 @@ func (c *WAF) CreateRateBasedRuleRequest(input *CreateRateBasedRuleInput) (req * // see Limits (https://docs.aws.amazon.com/waf/latest/developerguide/limits.html) // in the AWS WAF Developer Guide. // +// * ErrCodeTagOperationException "WAFTagOperationException" +// +// * ErrCodeTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// +// * ErrCodeBadRequestException "WAFBadRequestException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRateBasedRule func (c *WAF) CreateRateBasedRule(input *CreateRateBasedRuleInput) (*CreateRateBasedRuleOutput, error) { req, out := c.CreateRateBasedRuleRequest(input) @@ -996,6 +1002,12 @@ func (c *WAF) CreateRuleRequest(input *CreateRuleInput) (req *request.Request, o // see Limits (https://docs.aws.amazon.com/waf/latest/developerguide/limits.html) // in the AWS WAF Developer Guide. // +// * ErrCodeTagOperationException "WAFTagOperationException" +// +// * ErrCodeTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// +// * ErrCodeBadRequestException "WAFBadRequestException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRule func (c *WAF) CreateRule(input *CreateRuleInput) (*CreateRuleOutput, error) { req, out := c.CreateRuleRequest(input) @@ -1102,6 +1114,12 @@ func (c *WAF) CreateRuleGroupRequest(input *CreateRuleGroupInput) (req *request. // see Limits (https://docs.aws.amazon.com/waf/latest/developerguide/limits.html) // in the AWS WAF Developer Guide. // +// * ErrCodeTagOperationException "WAFTagOperationException" +// +// * ErrCodeTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// +// * ErrCodeBadRequestException "WAFBadRequestException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateRuleGroup func (c *WAF) CreateRuleGroup(input *CreateRuleGroupInput) (*CreateRuleGroupOutput, error) { req, out := c.CreateRuleGroupRequest(input) @@ -1550,6 +1568,12 @@ func (c *WAF) CreateWebACLRequest(input *CreateWebACLInput) (req *request.Reques // see Limits (https://docs.aws.amazon.com/waf/latest/developerguide/limits.html) // in the AWS WAF Developer Guide. // +// * ErrCodeTagOperationException "WAFTagOperationException" +// +// * ErrCodeTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// +// * ErrCodeBadRequestException "WAFBadRequestException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/CreateWebACL func (c *WAF) CreateWebACL(input *CreateWebACLInput) (*CreateWebACLOutput, error) { req, out := c.CreateWebACLRequest(input) @@ -2380,6 +2404,10 @@ func (c *WAF) DeleteRateBasedRuleRequest(input *DeleteRateBasedRuleInput) (req * // // * You tried to delete an IPSet that references one or more IP addresses. // +// * ErrCodeTagOperationException "WAFTagOperationException" +// +// * ErrCodeTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRateBasedRule func (c *WAF) DeleteRateBasedRule(input *DeleteRateBasedRuleInput) (*DeleteRateBasedRuleOutput, error) { req, out := c.DeleteRateBasedRuleRequest(input) @@ -2748,6 +2776,10 @@ func (c *WAF) DeleteRuleRequest(input *DeleteRuleInput) (req *request.Request, o // // * You tried to delete an IPSet that references one or more IP addresses. // +// * ErrCodeTagOperationException "WAFTagOperationException" +// +// * ErrCodeTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRule func (c *WAF) DeleteRule(input *DeleteRuleInput) (*DeleteRuleOutput, error) { req, out := c.DeleteRuleRequest(input) @@ -2887,6 +2919,10 @@ func (c *WAF) DeleteRuleGroupRequest(input *DeleteRuleGroupInput) (req *request. // * You tried to add a ByteMatchTuple to a ByteMatchSet, but the ByteMatchTuple // already exists in the specified WebACL. // +// * ErrCodeTagOperationException "WAFTagOperationException" +// +// * ErrCodeTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteRuleGroup func (c *WAF) DeleteRuleGroup(input *DeleteRuleGroupInput) (*DeleteRuleGroupOutput, error) { req, out := c.DeleteRuleGroupRequest(input) @@ -3265,6 +3301,10 @@ func (c *WAF) DeleteWebACLRequest(input *DeleteWebACLInput) (req *request.Reques // // * You tried to delete an IPSet that references one or more IP addresses. // +// * ErrCodeTagOperationException "WAFTagOperationException" +// +// * ErrCodeTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/DeleteWebACL func (c *WAF) DeleteWebACL(input *DeleteWebACLInput) (*DeleteWebACLOutput, error) { req, out := c.DeleteWebACLRequest(input) @@ -6167,6 +6207,122 @@ func (c *WAF) ListSubscribedRuleGroupsWithContext(ctx aws.Context, input *ListSu return out, req.Send() } +const opListTagsForResource = "ListTagsForResource" + +// ListTagsForResourceRequest generates a "aws/request.Request" representing the +// client's request for the ListTagsForResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListTagsForResource for more information on using the ListTagsForResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ListTagsForResourceRequest method. +// req, resp := client.ListTagsForResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListTagsForResource +func (c *WAF) ListTagsForResourceRequest(input *ListTagsForResourceInput) (req *request.Request, output *ListTagsForResourceOutput) { + op := &request.Operation{ + Name: opListTagsForResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListTagsForResourceInput{} + } + + output = &ListTagsForResourceOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListTagsForResource API operation for AWS WAF. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS WAF's +// API operation ListTagsForResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalErrorException "WAFInternalErrorException" +// The operation failed because of a system problem, even though the request +// was valid. Retry your request. +// +// * ErrCodeInvalidParameterException "WAFInvalidParameterException" +// The operation failed because AWS WAF didn't recognize a parameter in the +// request. For example: +// +// * You specified an invalid parameter name. +// +// * You specified an invalid value. +// +// * You tried to update an object (ByteMatchSet, IPSet, Rule, or WebACL) +// using an action other than INSERT or DELETE. +// +// * You tried to create a WebACL with a DefaultAction Type other than ALLOW, +// BLOCK, or COUNT. +// +// * You tried to create a RateBasedRule with a RateKey value other than +// IP. +// +// * You tried to update a WebACL with a WafAction Type other than ALLOW, +// BLOCK, or COUNT. +// +// * You tried to update a ByteMatchSet with a FieldToMatch Type other than +// HEADER, METHOD, QUERY_STRING, URI, or BODY. +// +// * You tried to update a ByteMatchSet with a Field of HEADER but no value +// for Data. +// +// * Your request references an ARN that is malformed, or corresponds to +// a resource with which a web ACL cannot be associated. +// +// * ErrCodeNonexistentItemException "WAFNonexistentItemException" +// The operation failed because the referenced object doesn't exist. +// +// * ErrCodeBadRequestException "WAFBadRequestException" +// +// * ErrCodeTagOperationException "WAFTagOperationException" +// +// * ErrCodeTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/ListTagsForResource +func (c *WAF) ListTagsForResource(input *ListTagsForResourceInput) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + return out, req.Send() +} + +// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *WAF) ListTagsForResourceWithContext(ctx aws.Context, input *ListTagsForResourceInput, opts ...request.Option) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opListWebACLs = "ListWebACLs" // ListWebACLsRequest generates a "aws/request.Request" representing the @@ -6589,6 +6745,246 @@ func (c *WAF) PutPermissionPolicyWithContext(ctx aws.Context, input *PutPermissi return out, req.Send() } +const opTagResource = "TagResource" + +// TagResourceRequest generates a "aws/request.Request" representing the +// client's request for the TagResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See TagResource for more information on using the TagResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the TagResourceRequest method. +// req, resp := client.TagResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/TagResource +func (c *WAF) TagResourceRequest(input *TagResourceInput) (req *request.Request, output *TagResourceOutput) { + op := &request.Operation{ + Name: opTagResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &TagResourceInput{} + } + + output = &TagResourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// TagResource API operation for AWS WAF. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS WAF's +// API operation TagResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalErrorException "WAFInternalErrorException" +// The operation failed because of a system problem, even though the request +// was valid. Retry your request. +// +// * ErrCodeInvalidParameterException "WAFInvalidParameterException" +// The operation failed because AWS WAF didn't recognize a parameter in the +// request. For example: +// +// * You specified an invalid parameter name. +// +// * You specified an invalid value. +// +// * You tried to update an object (ByteMatchSet, IPSet, Rule, or WebACL) +// using an action other than INSERT or DELETE. +// +// * You tried to create a WebACL with a DefaultAction Type other than ALLOW, +// BLOCK, or COUNT. +// +// * You tried to create a RateBasedRule with a RateKey value other than +// IP. +// +// * You tried to update a WebACL with a WafAction Type other than ALLOW, +// BLOCK, or COUNT. +// +// * You tried to update a ByteMatchSet with a FieldToMatch Type other than +// HEADER, METHOD, QUERY_STRING, URI, or BODY. +// +// * You tried to update a ByteMatchSet with a Field of HEADER but no value +// for Data. +// +// * Your request references an ARN that is malformed, or corresponds to +// a resource with which a web ACL cannot be associated. +// +// * ErrCodeLimitsExceededException "WAFLimitsExceededException" +// The operation exceeds a resource limit, for example, the maximum number of +// WebACL objects that you can create for an AWS account. For more information, +// see Limits (https://docs.aws.amazon.com/waf/latest/developerguide/limits.html) +// in the AWS WAF Developer Guide. +// +// * ErrCodeNonexistentItemException "WAFNonexistentItemException" +// The operation failed because the referenced object doesn't exist. +// +// * ErrCodeBadRequestException "WAFBadRequestException" +// +// * ErrCodeTagOperationException "WAFTagOperationException" +// +// * ErrCodeTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/TagResource +func (c *WAF) TagResource(input *TagResourceInput) (*TagResourceOutput, error) { + req, out := c.TagResourceRequest(input) + return out, req.Send() +} + +// TagResourceWithContext is the same as TagResource with the addition of +// the ability to pass a context and additional request options. +// +// See TagResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *WAF) TagResourceWithContext(ctx aws.Context, input *TagResourceInput, opts ...request.Option) (*TagResourceOutput, error) { + req, out := c.TagResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUntagResource = "UntagResource" + +// UntagResourceRequest generates a "aws/request.Request" representing the +// client's request for the UntagResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UntagResource for more information on using the UntagResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the UntagResourceRequest method. +// req, resp := client.UntagResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UntagResource +func (c *WAF) UntagResourceRequest(input *UntagResourceInput) (req *request.Request, output *UntagResourceOutput) { + op := &request.Operation{ + Name: opUntagResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UntagResourceInput{} + } + + output = &UntagResourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// UntagResource API operation for AWS WAF. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS WAF's +// API operation UntagResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalErrorException "WAFInternalErrorException" +// The operation failed because of a system problem, even though the request +// was valid. Retry your request. +// +// * ErrCodeInvalidParameterException "WAFInvalidParameterException" +// The operation failed because AWS WAF didn't recognize a parameter in the +// request. For example: +// +// * You specified an invalid parameter name. +// +// * You specified an invalid value. +// +// * You tried to update an object (ByteMatchSet, IPSet, Rule, or WebACL) +// using an action other than INSERT or DELETE. +// +// * You tried to create a WebACL with a DefaultAction Type other than ALLOW, +// BLOCK, or COUNT. +// +// * You tried to create a RateBasedRule with a RateKey value other than +// IP. +// +// * You tried to update a WebACL with a WafAction Type other than ALLOW, +// BLOCK, or COUNT. +// +// * You tried to update a ByteMatchSet with a FieldToMatch Type other than +// HEADER, METHOD, QUERY_STRING, URI, or BODY. +// +// * You tried to update a ByteMatchSet with a Field of HEADER but no value +// for Data. +// +// * Your request references an ARN that is malformed, or corresponds to +// a resource with which a web ACL cannot be associated. +// +// * ErrCodeNonexistentItemException "WAFNonexistentItemException" +// The operation failed because the referenced object doesn't exist. +// +// * ErrCodeBadRequestException "WAFBadRequestException" +// +// * ErrCodeTagOperationException "WAFTagOperationException" +// +// * ErrCodeTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24/UntagResource +func (c *WAF) UntagResource(input *UntagResourceInput) (*UntagResourceOutput, error) { + req, out := c.UntagResourceRequest(input) + return out, req.Send() +} + +// UntagResourceWithContext is the same as UntagResource with the addition of +// the ability to pass a context and additional request options. +// +// See UntagResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *WAF) UntagResourceWithContext(ctx aws.Context, input *UntagResourceInput, opts ...request.Option) (*UntagResourceOutput, error) { + req, out := c.UntagResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opUpdateByteMatchSet = "UpdateByteMatchSet" // UpdateByteMatchSetRequest generates a "aws/request.Request" representing the @@ -9866,6 +10262,8 @@ type CreateRateBasedRuleInput struct { // // RateLimit is a required field RateLimit *int64 `min:"2000" type:"long" required:"true"` + + Tags []*Tag `min:"1" type:"list"` } // String returns the string representation @@ -9905,6 +10303,19 @@ func (s *CreateRateBasedRuleInput) Validate() error { if s.RateLimit != nil && *s.RateLimit < 2000 { invalidParams.Add(request.NewErrParamMinValue("RateLimit", 2000)) } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -9942,6 +10353,12 @@ func (s *CreateRateBasedRuleInput) SetRateLimit(v int64) *CreateRateBasedRuleInp return s } +// SetTags sets the Tags field's value. +func (s *CreateRateBasedRuleInput) SetTags(v []*Tag) *CreateRateBasedRuleInput { + s.Tags = v + return s +} + type CreateRateBasedRuleOutput struct { _ struct{} `type:"structure"` @@ -10184,6 +10601,8 @@ type CreateRuleGroupInput struct { // // Name is a required field Name *string `min:"1" type:"string" required:"true"` + + Tags []*Tag `min:"1" type:"list"` } // String returns the string representation @@ -10214,6 +10633,19 @@ func (s *CreateRuleGroupInput) Validate() error { if s.Name != nil && len(*s.Name) < 1 { invalidParams.Add(request.NewErrParamMinLen("Name", 1)) } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -10239,6 +10671,12 @@ func (s *CreateRuleGroupInput) SetName(v string) *CreateRuleGroupInput { return s } +// SetTags sets the Tags field's value. +func (s *CreateRuleGroupInput) SetTags(v []*Tag) *CreateRuleGroupInput { + s.Tags = v + return s +} + type CreateRuleGroupOutput struct { _ struct{} `type:"structure"` @@ -10295,6 +10733,8 @@ type CreateRuleInput struct { // // Name is a required field Name *string `min:"1" type:"string" required:"true"` + + Tags []*Tag `min:"1" type:"list"` } // String returns the string representation @@ -10325,6 +10765,19 @@ func (s *CreateRuleInput) Validate() error { if s.Name != nil && len(*s.Name) < 1 { invalidParams.Add(request.NewErrParamMinLen("Name", 1)) } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -10350,6 +10803,12 @@ func (s *CreateRuleInput) SetName(v string) *CreateRuleInput { return s } +// SetTags sets the Tags field's value. +func (s *CreateRuleInput) SetTags(v []*Tag) *CreateRuleInput { + s.Tags = v + return s +} + type CreateRuleOutput struct { _ struct{} `type:"structure"` @@ -10601,6 +11060,8 @@ type CreateWebACLInput struct { // // Name is a required field Name *string `min:"1" type:"string" required:"true"` + + Tags []*Tag `min:"1" type:"list"` } // String returns the string representation @@ -10634,11 +11095,24 @@ func (s *CreateWebACLInput) Validate() error { if s.Name != nil && len(*s.Name) < 1 { invalidParams.Add(request.NewErrParamMinLen("Name", 1)) } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) + } if s.DefaultAction != nil { if err := s.DefaultAction.Validate(); err != nil { invalidParams.AddNested("DefaultAction", err.(request.ErrInvalidParams)) } } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -10670,6 +11144,12 @@ func (s *CreateWebACLInput) SetName(v string) *CreateWebACLInput { return s } +// SetTags sets the Tags field's value. +func (s *CreateWebACLInput) SetTags(v []*Tag) *CreateWebACLInput { + s.Tags = v + return s +} + type CreateWebACLOutput struct { _ struct{} `type:"structure"` @@ -15093,6 +15573,94 @@ func (s *ListSubscribedRuleGroupsOutput) SetRuleGroups(v []*SubscribedRuleGroupS return s } +type ListTagsForResourceInput struct { + _ struct{} `type:"structure"` + + Limit *int64 `type:"integer"` + + NextMarker *string `min:"1" type:"string"` + + // ResourceARN is a required field + ResourceARN *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s ListTagsForResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListTagsForResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListTagsForResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListTagsForResourceInput"} + if s.NextMarker != nil && len(*s.NextMarker) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextMarker", 1)) + } + if s.ResourceARN == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceARN")) + } + if s.ResourceARN != nil && len(*s.ResourceARN) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceARN", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLimit sets the Limit field's value. +func (s *ListTagsForResourceInput) SetLimit(v int64) *ListTagsForResourceInput { + s.Limit = &v + return s +} + +// SetNextMarker sets the NextMarker field's value. +func (s *ListTagsForResourceInput) SetNextMarker(v string) *ListTagsForResourceInput { + s.NextMarker = &v + return s +} + +// SetResourceARN sets the ResourceARN field's value. +func (s *ListTagsForResourceInput) SetResourceARN(v string) *ListTagsForResourceInput { + s.ResourceARN = &v + return s +} + +type ListTagsForResourceOutput struct { + _ struct{} `type:"structure"` + + NextMarker *string `min:"1" type:"string"` + + TagInfoForResource *TagInfoForResource `type:"structure"` +} + +// String returns the string representation +func (s ListTagsForResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListTagsForResourceOutput) GoString() string { + return s.String() +} + +// SetNextMarker sets the NextMarker field's value. +func (s *ListTagsForResourceOutput) SetNextMarker(v string) *ListTagsForResourceOutput { + s.NextMarker = &v + return s +} + +// SetTagInfoForResource sets the TagInfoForResource field's value. +func (s *ListTagsForResourceOutput) SetTagInfoForResource(v *TagInfoForResource) *ListTagsForResourceOutput { + s.TagInfoForResource = v + return s +} + type ListWebACLsInput struct { _ struct{} `type:"structure"` @@ -17299,6 +17867,157 @@ func (s *SubscribedRuleGroupSummary) SetRuleGroupId(v string) *SubscribedRuleGro return s } +type Tag struct { + _ struct{} `type:"structure"` + + Key *string `min:"1" type:"string"` + + Value *string `type:"string"` +} + +// String returns the string representation +func (s Tag) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Tag) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Tag) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Tag"} + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetKey sets the Key field's value. +func (s *Tag) SetKey(v string) *Tag { + s.Key = &v + return s +} + +// SetValue sets the Value field's value. +func (s *Tag) SetValue(v string) *Tag { + s.Value = &v + return s +} + +type TagInfoForResource struct { + _ struct{} `type:"structure"` + + ResourceARN *string `min:"1" type:"string"` + + TagList []*Tag `min:"1" type:"list"` +} + +// String returns the string representation +func (s TagInfoForResource) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TagInfoForResource) GoString() string { + return s.String() +} + +// SetResourceARN sets the ResourceARN field's value. +func (s *TagInfoForResource) SetResourceARN(v string) *TagInfoForResource { + s.ResourceARN = &v + return s +} + +// SetTagList sets the TagList field's value. +func (s *TagInfoForResource) SetTagList(v []*Tag) *TagInfoForResource { + s.TagList = v + return s +} + +type TagResourceInput struct { + _ struct{} `type:"structure"` + + // ResourceARN is a required field + ResourceARN *string `min:"1" type:"string" required:"true"` + + // Tags is a required field + Tags []*Tag `min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s TagResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TagResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TagResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TagResourceInput"} + if s.ResourceARN == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceARN")) + } + if s.ResourceARN != nil && len(*s.ResourceARN) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceARN", 1)) + } + if s.Tags == nil { + invalidParams.Add(request.NewErrParamRequired("Tags")) + } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResourceARN sets the ResourceARN field's value. +func (s *TagResourceInput) SetResourceARN(v string) *TagResourceInput { + s.ResourceARN = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *TagResourceInput) SetTags(v []*Tag) *TagResourceInput { + s.Tags = v + return s +} + +type TagResourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s TagResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TagResourceOutput) GoString() string { + return s.String() +} + // In a GetSampledRequests request, the StartTime and EndTime objects specify // the time range for which you want AWS WAF to return a sample of web requests. // @@ -17367,6 +18086,74 @@ func (s *TimeWindow) SetStartTime(v time.Time) *TimeWindow { return s } +type UntagResourceInput struct { + _ struct{} `type:"structure"` + + // ResourceARN is a required field + ResourceARN *string `min:"1" type:"string" required:"true"` + + // TagKeys is a required field + TagKeys []*string `min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s UntagResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UntagResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UntagResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UntagResourceInput"} + if s.ResourceARN == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceARN")) + } + if s.ResourceARN != nil && len(*s.ResourceARN) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceARN", 1)) + } + if s.TagKeys == nil { + invalidParams.Add(request.NewErrParamRequired("TagKeys")) + } + if s.TagKeys != nil && len(s.TagKeys) < 1 { + invalidParams.Add(request.NewErrParamMinLen("TagKeys", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResourceARN sets the ResourceARN field's value. +func (s *UntagResourceInput) SetResourceARN(v string) *UntagResourceInput { + s.ResourceARN = &v + return s +} + +// SetTagKeys sets the TagKeys field's value. +func (s *UntagResourceInput) SetTagKeys(v []*string) *UntagResourceInput { + s.TagKeys = v + return s +} + +type UntagResourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s UntagResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UntagResourceOutput) GoString() string { + return s.String() +} + type UpdateByteMatchSetInput struct { _ struct{} `type:"structure"` @@ -20256,6 +21043,12 @@ const ( // ParameterExceptionFieldResourceArn is a ParameterExceptionField enum value ParameterExceptionFieldResourceArn = "RESOURCE_ARN" + + // ParameterExceptionFieldTags is a ParameterExceptionField enum value + ParameterExceptionFieldTags = "TAGS" + + // ParameterExceptionFieldTagKeys is a ParameterExceptionField enum value + ParameterExceptionFieldTagKeys = "TAG_KEYS" ) const ( @@ -20267,6 +21060,9 @@ const ( // ParameterExceptionReasonIllegalArgument is a ParameterExceptionReason enum value ParameterExceptionReasonIllegalArgument = "ILLEGAL_ARGUMENT" + + // ParameterExceptionReasonInvalidTagKey is a ParameterExceptionReason enum value + ParameterExceptionReasonInvalidTagKey = "INVALID_TAG_KEY" ) const ( diff --git a/vendor/github.com/aws/aws-sdk-go/service/waf/errors.go b/vendor/github.com/aws/aws-sdk-go/service/waf/errors.go index 7e96c0026ac8..32407c2a0878 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/waf/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/waf/errors.go @@ -4,6 +4,10 @@ package waf const ( + // ErrCodeBadRequestException for service response error code + // "WAFBadRequestException". + ErrCodeBadRequestException = "WAFBadRequestException" + // ErrCodeDisallowedNameException for service response error code // "WAFDisallowedNameException". // @@ -197,4 +201,12 @@ const ( // // The specified subscription does not exist. ErrCodeSubscriptionNotFoundException = "WAFSubscriptionNotFoundException" + + // ErrCodeTagOperationException for service response error code + // "WAFTagOperationException". + ErrCodeTagOperationException = "WAFTagOperationException" + + // ErrCodeTagOperationInternalErrorException for service response error code + // "WAFTagOperationInternalErrorException". + ErrCodeTagOperationInternalErrorException = "WAFTagOperationInternalErrorException" ) diff --git a/vendor/github.com/aws/aws-sdk-go/service/wafregional/api.go b/vendor/github.com/aws/aws-sdk-go/service/wafregional/api.go index 7f0a3ddb5e43..6fd10a528975 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/wafregional/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/wafregional/api.go @@ -733,6 +733,12 @@ func (c *WAFRegional) CreateRateBasedRuleRequest(input *waf.CreateRateBasedRuleI // see Limits (https://docs.aws.amazon.com/waf/latest/developerguide/limits.html) // in the AWS WAF Developer Guide. // +// * ErrCodeWAFTagOperationException "WAFTagOperationException" +// +// * ErrCodeWAFTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// +// * ErrCodeWAFBadRequestException "WAFBadRequestException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/CreateRateBasedRule func (c *WAFRegional) CreateRateBasedRule(input *waf.CreateRateBasedRuleInput) (*waf.CreateRateBasedRuleOutput, error) { req, out := c.CreateRateBasedRuleRequest(input) @@ -1116,6 +1122,12 @@ func (c *WAFRegional) CreateRuleRequest(input *waf.CreateRuleInput) (req *reques // see Limits (https://docs.aws.amazon.com/waf/latest/developerguide/limits.html) // in the AWS WAF Developer Guide. // +// * ErrCodeWAFTagOperationException "WAFTagOperationException" +// +// * ErrCodeWAFTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// +// * ErrCodeWAFBadRequestException "WAFBadRequestException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/CreateRule func (c *WAFRegional) CreateRule(input *waf.CreateRuleInput) (*waf.CreateRuleOutput, error) { req, out := c.CreateRuleRequest(input) @@ -1222,6 +1234,12 @@ func (c *WAFRegional) CreateRuleGroupRequest(input *waf.CreateRuleGroupInput) (r // see Limits (https://docs.aws.amazon.com/waf/latest/developerguide/limits.html) // in the AWS WAF Developer Guide. // +// * ErrCodeWAFTagOperationException "WAFTagOperationException" +// +// * ErrCodeWAFTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// +// * ErrCodeWAFBadRequestException "WAFBadRequestException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/CreateRuleGroup func (c *WAFRegional) CreateRuleGroup(input *waf.CreateRuleGroupInput) (*waf.CreateRuleGroupOutput, error) { req, out := c.CreateRuleGroupRequest(input) @@ -1670,6 +1688,12 @@ func (c *WAFRegional) CreateWebACLRequest(input *waf.CreateWebACLInput) (req *re // see Limits (https://docs.aws.amazon.com/waf/latest/developerguide/limits.html) // in the AWS WAF Developer Guide. // +// * ErrCodeWAFTagOperationException "WAFTagOperationException" +// +// * ErrCodeWAFTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// +// * ErrCodeWAFBadRequestException "WAFBadRequestException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/CreateWebACL func (c *WAFRegional) CreateWebACL(input *waf.CreateWebACLInput) (*waf.CreateWebACLOutput, error) { req, out := c.CreateWebACLRequest(input) @@ -2500,6 +2524,10 @@ func (c *WAFRegional) DeleteRateBasedRuleRequest(input *waf.DeleteRateBasedRuleI // // * You tried to delete an IPSet that references one or more IP addresses. // +// * ErrCodeWAFTagOperationException "WAFTagOperationException" +// +// * ErrCodeWAFTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/DeleteRateBasedRule func (c *WAFRegional) DeleteRateBasedRule(input *waf.DeleteRateBasedRuleInput) (*waf.DeleteRateBasedRuleOutput, error) { req, out := c.DeleteRateBasedRuleRequest(input) @@ -2868,6 +2896,10 @@ func (c *WAFRegional) DeleteRuleRequest(input *waf.DeleteRuleInput) (req *reques // // * You tried to delete an IPSet that references one or more IP addresses. // +// * ErrCodeWAFTagOperationException "WAFTagOperationException" +// +// * ErrCodeWAFTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/DeleteRule func (c *WAFRegional) DeleteRule(input *waf.DeleteRuleInput) (*waf.DeleteRuleOutput, error) { req, out := c.DeleteRuleRequest(input) @@ -3007,6 +3039,10 @@ func (c *WAFRegional) DeleteRuleGroupRequest(input *waf.DeleteRuleGroupInput) (r // * You tried to add a ByteMatchTuple to a ByteMatchSet, but the ByteMatchTuple // already exists in the specified WebACL. // +// * ErrCodeWAFTagOperationException "WAFTagOperationException" +// +// * ErrCodeWAFTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/DeleteRuleGroup func (c *WAFRegional) DeleteRuleGroup(input *waf.DeleteRuleGroupInput) (*waf.DeleteRuleGroupOutput, error) { req, out := c.DeleteRuleGroupRequest(input) @@ -3385,6 +3421,10 @@ func (c *WAFRegional) DeleteWebACLRequest(input *waf.DeleteWebACLInput) (req *re // // * You tried to delete an IPSet that references one or more IP addresses. // +// * ErrCodeWAFTagOperationException "WAFTagOperationException" +// +// * ErrCodeWAFTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// // See also, https://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/DeleteWebACL func (c *WAFRegional) DeleteWebACL(input *waf.DeleteWebACLInput) (*waf.DeleteWebACLOutput, error) { req, out := c.DeleteWebACLRequest(input) @@ -6642,6 +6682,122 @@ func (c *WAFRegional) ListSubscribedRuleGroupsWithContext(ctx aws.Context, input return out, req.Send() } +const opListTagsForResource = "ListTagsForResource" + +// ListTagsForResourceRequest generates a "aws/request.Request" representing the +// client's request for the ListTagsForResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListTagsForResource for more information on using the ListTagsForResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ListTagsForResourceRequest method. +// req, resp := client.ListTagsForResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/ListTagsForResource +func (c *WAFRegional) ListTagsForResourceRequest(input *waf.ListTagsForResourceInput) (req *request.Request, output *waf.ListTagsForResourceOutput) { + op := &request.Operation{ + Name: opListTagsForResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &waf.ListTagsForResourceInput{} + } + + output = &waf.ListTagsForResourceOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListTagsForResource API operation for AWS WAF Regional. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS WAF Regional's +// API operation ListTagsForResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeWAFInternalErrorException "WAFInternalErrorException" +// The operation failed because of a system problem, even though the request +// was valid. Retry your request. +// +// * ErrCodeWAFInvalidParameterException "WAFInvalidParameterException" +// The operation failed because AWS WAF didn't recognize a parameter in the +// request. For example: +// +// * You specified an invalid parameter name. +// +// * You specified an invalid value. +// +// * You tried to update an object (ByteMatchSet, IPSet, Rule, or WebACL) +// using an action other than INSERT or DELETE. +// +// * You tried to create a WebACL with a DefaultAction Type other than ALLOW, +// BLOCK, or COUNT. +// +// * You tried to create a RateBasedRule with a RateKey value other than +// IP. +// +// * You tried to update a WebACL with a WafAction Type other than ALLOW, +// BLOCK, or COUNT. +// +// * You tried to update a ByteMatchSet with a FieldToMatch Type other than +// HEADER, METHOD, QUERY_STRING, URI, or BODY. +// +// * You tried to update a ByteMatchSet with a Field of HEADER but no value +// for Data. +// +// * Your request references an ARN that is malformed, or corresponds to +// a resource with which a web ACL cannot be associated. +// +// * ErrCodeWAFNonexistentItemException "WAFNonexistentItemException" +// The operation failed because the referenced object doesn't exist. +// +// * ErrCodeWAFBadRequestException "WAFBadRequestException" +// +// * ErrCodeWAFTagOperationException "WAFTagOperationException" +// +// * ErrCodeWAFTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/ListTagsForResource +func (c *WAFRegional) ListTagsForResource(input *waf.ListTagsForResourceInput) (*waf.ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + return out, req.Send() +} + +// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *WAFRegional) ListTagsForResourceWithContext(ctx aws.Context, input *waf.ListTagsForResourceInput, opts ...request.Option) (*waf.ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opListWebACLs = "ListWebACLs" // ListWebACLsRequest generates a "aws/request.Request" representing the @@ -7064,6 +7220,246 @@ func (c *WAFRegional) PutPermissionPolicyWithContext(ctx aws.Context, input *waf return out, req.Send() } +const opTagResource = "TagResource" + +// TagResourceRequest generates a "aws/request.Request" representing the +// client's request for the TagResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See TagResource for more information on using the TagResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the TagResourceRequest method. +// req, resp := client.TagResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/TagResource +func (c *WAFRegional) TagResourceRequest(input *waf.TagResourceInput) (req *request.Request, output *waf.TagResourceOutput) { + op := &request.Operation{ + Name: opTagResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &waf.TagResourceInput{} + } + + output = &waf.TagResourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// TagResource API operation for AWS WAF Regional. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS WAF Regional's +// API operation TagResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeWAFInternalErrorException "WAFInternalErrorException" +// The operation failed because of a system problem, even though the request +// was valid. Retry your request. +// +// * ErrCodeWAFInvalidParameterException "WAFInvalidParameterException" +// The operation failed because AWS WAF didn't recognize a parameter in the +// request. For example: +// +// * You specified an invalid parameter name. +// +// * You specified an invalid value. +// +// * You tried to update an object (ByteMatchSet, IPSet, Rule, or WebACL) +// using an action other than INSERT or DELETE. +// +// * You tried to create a WebACL with a DefaultAction Type other than ALLOW, +// BLOCK, or COUNT. +// +// * You tried to create a RateBasedRule with a RateKey value other than +// IP. +// +// * You tried to update a WebACL with a WafAction Type other than ALLOW, +// BLOCK, or COUNT. +// +// * You tried to update a ByteMatchSet with a FieldToMatch Type other than +// HEADER, METHOD, QUERY_STRING, URI, or BODY. +// +// * You tried to update a ByteMatchSet with a Field of HEADER but no value +// for Data. +// +// * Your request references an ARN that is malformed, or corresponds to +// a resource with which a web ACL cannot be associated. +// +// * ErrCodeWAFLimitsExceededException "WAFLimitsExceededException" +// The operation exceeds a resource limit, for example, the maximum number of +// WebACL objects that you can create for an AWS account. For more information, +// see Limits (https://docs.aws.amazon.com/waf/latest/developerguide/limits.html) +// in the AWS WAF Developer Guide. +// +// * ErrCodeWAFNonexistentItemException "WAFNonexistentItemException" +// The operation failed because the referenced object doesn't exist. +// +// * ErrCodeWAFBadRequestException "WAFBadRequestException" +// +// * ErrCodeWAFTagOperationException "WAFTagOperationException" +// +// * ErrCodeWAFTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/TagResource +func (c *WAFRegional) TagResource(input *waf.TagResourceInput) (*waf.TagResourceOutput, error) { + req, out := c.TagResourceRequest(input) + return out, req.Send() +} + +// TagResourceWithContext is the same as TagResource with the addition of +// the ability to pass a context and additional request options. +// +// See TagResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *WAFRegional) TagResourceWithContext(ctx aws.Context, input *waf.TagResourceInput, opts ...request.Option) (*waf.TagResourceOutput, error) { + req, out := c.TagResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUntagResource = "UntagResource" + +// UntagResourceRequest generates a "aws/request.Request" representing the +// client's request for the UntagResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UntagResource for more information on using the UntagResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the UntagResourceRequest method. +// req, resp := client.UntagResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/UntagResource +func (c *WAFRegional) UntagResourceRequest(input *waf.UntagResourceInput) (req *request.Request, output *waf.UntagResourceOutput) { + op := &request.Operation{ + Name: opUntagResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &waf.UntagResourceInput{} + } + + output = &waf.UntagResourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// UntagResource API operation for AWS WAF Regional. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS WAF Regional's +// API operation UntagResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeWAFInternalErrorException "WAFInternalErrorException" +// The operation failed because of a system problem, even though the request +// was valid. Retry your request. +// +// * ErrCodeWAFInvalidParameterException "WAFInvalidParameterException" +// The operation failed because AWS WAF didn't recognize a parameter in the +// request. For example: +// +// * You specified an invalid parameter name. +// +// * You specified an invalid value. +// +// * You tried to update an object (ByteMatchSet, IPSet, Rule, or WebACL) +// using an action other than INSERT or DELETE. +// +// * You tried to create a WebACL with a DefaultAction Type other than ALLOW, +// BLOCK, or COUNT. +// +// * You tried to create a RateBasedRule with a RateKey value other than +// IP. +// +// * You tried to update a WebACL with a WafAction Type other than ALLOW, +// BLOCK, or COUNT. +// +// * You tried to update a ByteMatchSet with a FieldToMatch Type other than +// HEADER, METHOD, QUERY_STRING, URI, or BODY. +// +// * You tried to update a ByteMatchSet with a Field of HEADER but no value +// for Data. +// +// * Your request references an ARN that is malformed, or corresponds to +// a resource with which a web ACL cannot be associated. +// +// * ErrCodeWAFNonexistentItemException "WAFNonexistentItemException" +// The operation failed because the referenced object doesn't exist. +// +// * ErrCodeWAFBadRequestException "WAFBadRequestException" +// +// * ErrCodeWAFTagOperationException "WAFTagOperationException" +// +// * ErrCodeWAFTagOperationInternalErrorException "WAFTagOperationInternalErrorException" +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/UntagResource +func (c *WAFRegional) UntagResource(input *waf.UntagResourceInput) (*waf.UntagResourceOutput, error) { + req, out := c.UntagResourceRequest(input) + return out, req.Send() +} + +// UntagResourceWithContext is the same as UntagResource with the addition of +// the ability to pass a context and additional request options. +// +// See UntagResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *WAFRegional) UntagResourceWithContext(ctx aws.Context, input *waf.UntagResourceInput, opts ...request.Option) (*waf.UntagResourceOutput, error) { + req, out := c.UntagResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opUpdateByteMatchSet = "UpdateByteMatchSet" // UpdateByteMatchSetRequest generates a "aws/request.Request" representing the @@ -10569,6 +10965,12 @@ const ( // ParameterExceptionFieldResourceArn is a ParameterExceptionField enum value ParameterExceptionFieldResourceArn = "RESOURCE_ARN" + + // ParameterExceptionFieldTags is a ParameterExceptionField enum value + ParameterExceptionFieldTags = "TAGS" + + // ParameterExceptionFieldTagKeys is a ParameterExceptionField enum value + ParameterExceptionFieldTagKeys = "TAG_KEYS" ) const ( @@ -10580,6 +10982,9 @@ const ( // ParameterExceptionReasonIllegalArgument is a ParameterExceptionReason enum value ParameterExceptionReasonIllegalArgument = "ILLEGAL_ARGUMENT" + + // ParameterExceptionReasonInvalidTagKey is a ParameterExceptionReason enum value + ParameterExceptionReasonInvalidTagKey = "INVALID_TAG_KEY" ) const ( diff --git a/vendor/github.com/aws/aws-sdk-go/service/wafregional/errors.go b/vendor/github.com/aws/aws-sdk-go/service/wafregional/errors.go index 055c6a0adce4..76315ecfbbac 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/wafregional/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/wafregional/errors.go @@ -4,6 +4,10 @@ package wafregional const ( + // ErrCodeWAFBadRequestException for service response error code + // "WAFBadRequestException". + ErrCodeWAFBadRequestException = "WAFBadRequestException" + // ErrCodeWAFDisallowedNameException for service response error code // "WAFDisallowedNameException". // @@ -198,6 +202,14 @@ const ( // The specified subscription does not exist. ErrCodeWAFSubscriptionNotFoundException = "WAFSubscriptionNotFoundException" + // ErrCodeWAFTagOperationException for service response error code + // "WAFTagOperationException". + ErrCodeWAFTagOperationException = "WAFTagOperationException" + + // ErrCodeWAFTagOperationInternalErrorException for service response error code + // "WAFTagOperationInternalErrorException". + ErrCodeWAFTagOperationInternalErrorException = "WAFTagOperationInternalErrorException" + // ErrCodeWAFUnavailableEntityException for service response error code // "WAFUnavailableEntityException". // diff --git a/vendor/modules.txt b/vendor/modules.txt index 57acb4a5f845..9eee71d30727 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -21,7 +21,7 @@ github.com/apparentlymart/go-cidr/cidr github.com/apparentlymart/go-textseg/textseg # github.com/armon/go-radix v1.0.0 github.com/armon/go-radix -# github.com/aws/aws-sdk-go v1.20.16 +# github.com/aws/aws-sdk-go v1.20.17 github.com/aws/aws-sdk-go/aws github.com/aws/aws-sdk-go/aws/arn github.com/aws/aws-sdk-go/aws/awserr From 584d95197ffb3f0855629348467d5216bb4bc4fc Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 10 Jul 2019 13:37:04 -0400 Subject: [PATCH 0170/1054] =?UTF-8?q?resource/aws=5Fbackup=5Fselection:=20?= =?UTF-8?q?IAM=20retries,=20test=20fix,=20documenta=E2=80=A6=20(#9298)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * resource/aws_backup_selection: Retry creation for IAM eventual consistency error Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/9297 Output from acceptance testing (failure present on master): ``` --- FAIL: TestAccAwsBackupSelection_withResources (12.00s) testing.go:568: Step 0 error: errors during apply: Error: error creating Backup Selection: InvalidParameterValueException: Invalid ARN: arn:aws:elasticfilesystem:us-west-2:--OMITTED--:file-system/. Specified resource is not supported status code: 400, request id: 2f845d03-51d3-48df-b853-46c077f85780 on /var/folders/v0/_d108fkx1pbbg4_sh864_7740000gn/T/tf-test308326165/main.tf line 22: (source code not available) --- PASS: TestAccAwsBackupSelection_disappears (17.20s) --- PASS: TestAccAwsBackupSelection_basic (18.44s) --- PASS: TestAccAwsBackupSelection_withTags (18.47s) --- PASS: TestAccAwsBackupSelection_updateTag (28.73s) ``` * tests/resource/aws_backup_selection: Remove wildcard usage in withResources acceptance test The usage of wildcards differs between AWS Regions while ARNs are supported everywhere. Previously from acceptance testing: ``` --- FAIL: TestAccAwsBackupSelection_withResources (12.00s) testing.go:568: Step 0 error: errors during apply: Error: error creating Backup Selection: InvalidParameterValueException: Invalid ARN: arn:aws:elasticfilesystem:us-west-2:--OMITTED--:file-system/. Specified resource is not supported ``` Output from acceptance testing: ``` --- PASS: TestAccAwsBackupSelection_withResources (29.35s) ``` * docs/resource/aws_backup_selection: Expand example documentation to show IAM Role creation and show using resource ARNs The support for wildcard resource selection does not work in all AWS Regions while ARN support is consistent. Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/9269 --- aws/resource_aws_backup_selection.go | 28 +++++++++- aws/resource_aws_backup_selection_test.go | 15 ++++- website/docs/r/backup_selection.html.markdown | 56 ++++++++++++++++++- 3 files changed, 92 insertions(+), 7 deletions(-) diff --git a/aws/resource_aws_backup_selection.go b/aws/resource_aws_backup_selection.go index 8e8d26e068a5..21062861c47e 100644 --- a/aws/resource_aws_backup_selection.go +++ b/aws/resource_aws_backup_selection.go @@ -5,9 +5,11 @@ import ( "log" "regexp" "strings" + "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/backup" + "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" ) @@ -94,12 +96,34 @@ func resourceAwsBackupSelectionCreate(d *schema.ResourceData, meta interface{}) BackupSelection: selection, } - resp, err := conn.CreateBackupSelection(input) + // Retry for IAM eventual consistency + var output *backup.CreateBackupSelectionOutput + err := resource.Retry(1*time.Minute, func() *resource.RetryError { + var err error + output, err = conn.CreateBackupSelection(input) + + // Retry on the following error: + // InvalidParameterValueException: IAM Role arn:aws:iam::123456789012:role/XXX cannot be assumed by AWS Backup + if isAWSErr(err, backup.ErrCodeInvalidParameterValueException, "cannot be assumed") { + return resource.RetryableError(err) + } + + if err != nil { + return resource.NonRetryableError(err) + } + + return nil + }) + + if isResourceTimeoutError(err) { + output, err = conn.CreateBackupSelection(input) + } + if err != nil { return fmt.Errorf("error creating Backup Selection: %s", err) } - d.SetId(*resp.SelectionId) + d.SetId(aws.StringValue(output.SelectionId)) return resourceAwsBackupSelectionRead(d, meta) } diff --git a/aws/resource_aws_backup_selection_test.go b/aws/resource_aws_backup_selection_test.go index 05165ec63a1f..3a6095359eca 100644 --- a/aws/resource_aws_backup_selection_test.go +++ b/aws/resource_aws_backup_selection_test.go @@ -304,6 +304,17 @@ resource "aws_backup_selection" "test" { func testAccBackupSelectionConfigWithResources(rInt int) string { return testAccBackupSelectionConfigBase(rInt) + fmt.Sprintf(` +data "aws_availability_zones" "available" { + state = "available" +} + +resource "aws_ebs_volume" "test" { + count = 2 + + availability_zone = "${data.aws_availability_zones.available.names[0]}" + size = 1 +} + resource "aws_backup_selection" "test" { plan_id = "${aws_backup_plan.test.id}" @@ -317,8 +328,8 @@ resource "aws_backup_selection" "test" { } resources = [ - "arn:${data.aws_partition.current.partition}:elasticfilesystem:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:file-system/", - "arn:${data.aws_partition.current.partition}:ec2:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:volume/" + "${aws_ebs_volume.test.0.arn}", + "${aws_ebs_volume.test.1.arn}", ] } `, rInt) diff --git a/website/docs/r/backup_selection.html.markdown b/website/docs/r/backup_selection.html.markdown index 50ea46471041..c6e98d9bc4a3 100644 --- a/website/docs/r/backup_selection.html.markdown +++ b/website/docs/r/backup_selection.html.markdown @@ -12,21 +12,71 @@ Manages selection conditions for AWS Backup plan resources. ## Example Usage +### IAM Role + +-> For more information about creating and managing IAM Roles for backups and restores, see the [AWS Backup Developer Guide](https://docs.aws.amazon.com/aws-backup/latest/devguide/iam-service-roles.html). + +The below example creates an IAM role with the default managed IAM Policy for allowing AWS Backup to create backups. + ```hcl +resource "aws_iam_role" "example" { + name = "example" + assume_role_policy = < Date: Wed, 10 Jul 2019 13:38:42 -0400 Subject: [PATCH 0171/1054] update CHANGELOG for #9298 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c242e72a380..db297cf8dfed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ ENHANCEMENTS: * resource/aws_wafregional_web_acl: Support resource import [GH-9248] BUG FIXES: - +* resource/aws_backup_selection: Retry creation for IAM eventual consistency error [GH-9298] * resource/aws_db_event_subscription: Prevent `Unable to find RDS Event Subscription` error during deletion and refresh [GH-9274] * resource/aws_iam_policy_attachment: Bypass `NoSuchEntity` error when detaching groups, roles, and users (support group, role (when `force_detach_policies` is enabled), and user renames (when `force_destroy` is enabled)) [GH-9278] * resource/aws_transfer_user: Final retry after timeout waiting for deletion of transfer user [GH-9241] From 75349495f17d02335aaad818d0646fff57b2d340 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 10 Jul 2019 13:41:45 -0400 Subject: [PATCH 0172/1054] =?UTF-8?q?docs/resource/aws=5Fapi=5Fgateway=5Fs?= =?UTF-8?q?tage:=20Add=20information=20about=20mana=E2=80=A6=20(#9301)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs/resource/aws_api_gateway_stage: Add information about managing the API logging CloudWatch Log Group Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/8413 * docs/resource/aws_api_gateway_stage: Use relative link --- .../docs/r/api_gateway_stage.html.markdown | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/website/docs/r/api_gateway_stage.html.markdown b/website/docs/r/api_gateway_stage.html.markdown index c88491e3977b..c5fe8d34858b 100644 --- a/website/docs/r/api_gateway_stage.html.markdown +++ b/website/docs/r/api_gateway_stage.html.markdown @@ -62,6 +62,38 @@ resource "aws_api_gateway_integration" "test" { } ``` +### Managing the API Logging CloudWatch Log Group + +API Gateway provides the ability to [enable CloudWatch API logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html). To manage the CloudWatch Log Group when this feature is enabled, the [`aws_cloudwatch_log_group` resource](/docs/providers/aws/r/cloudwatch_log_group.html) can be used where the name matches the API Gateway naming convention. If the CloudWatch Log Group previously exists, the [`aws_cloudwatch_log_group` resource can be imported into Terraform](/docs/providers/aws/r/cloudwatch_log_group.html#import) as a one time operation and recreation of the environment can occur without import. + +-> The below configuration uses [`depends_on`](/docs/configuration/resources.html#depends_on-explicit-resource-dependencies) to prevent ordering issues with API Gateway automatically creating the log group first and a variable for naming consistency. Other ordering and naming methodologies may be more appropriate for your environment. + +```hcl +variable "stage_name" { + default = "example" + type = "string" +} + +resource "aws_api_gateway_rest_api" "example" { + # ... other configuration ... +} + +resource "aws_api_gateway_stage" "example" { + depends_on = ["aws_cloudwatch_log_group.example"] + + name = "${var.stage_name}" + + # ... other configuration ... +} + +resource "aws_cloudwatch_log_group" "example" { + name = "API-Gateway-Execution-Logs_${aws_api_gateway_rest_api.example.id}/${var.stage_name}" + retention_in_days = 7 + + # ... potentially other configuration ... +} +``` + ## Argument Reference The following arguments are supported: From bce112d121958fedf2c845e6e54c634bfb032641 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 10 Jul 2019 14:12:18 -0400 Subject: [PATCH 0173/1054] =?UTF-8?q?tests/service/lightsail:=20Remove=20h?= =?UTF-8?q?ardcoded=20us-east-1=20region=20from=E2=80=A6=20(#9080)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/8983 When the AWS Lightsail service originally launched and was developed within Terraform, it was only available in the us-east-1 region. Here we update the test configurations to remove the hardcoded provider declaration (defaulting now to us-west-2 and passing in that region as matches in the Contributing Guide). This also switches the configurations to use the `amazon_linux` Blueprint, which is available in all Lightsail regions. Previously before switching blueprint: ``` --- FAIL: TestAccAWSLightsailInstance_basic (8.69s) testing.go:568: Step 0 error: errors during apply: Error: InvalidInputException: The GitLab CE blueprint gitlab_8_12_6 is not available in us-west-2 ``` Blueprint search in all AWS Commercial EC2 regions: ```console $ for REGION in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text); do if [[ "$(aws --region $REGION lightsail get-blueprints --query 'blueprints[?blueprintId==`amazon_linux`].blueprintId' --output text)" == "amazon_linux" ]]; then echo "Found amazon_linux in $REGION" else echo "Missing amazon_linux in $REGION" fi done An error occurred (AccessDeniedException) when calling the GetBlueprints operation: Missing amazon_linux in eu-north-1 Found amazon_linux in ap-south-1 Found amazon_linux in eu-west-3 Found amazon_linux in eu-west-2 Found amazon_linux in eu-west-1 Found amazon_linux in ap-northeast-2 Found amazon_linux in ap-northeast-1 Could not connect to the endpoint URL: "https://lightsail.sa-east-1.amazonaws.com/" Missing amazon_linux in sa-east-1 Found amazon_linux in ca-central-1 Found amazon_linux in ap-southeast-1 Found amazon_linux in ap-southeast-2 Found amazon_linux in eu-central-1 Found amazon_linux in us-east-1 Found amazon_linux in us-east-2 Could not connect to the endpoint URL: "https://lightsail.us-west-1.amazonaws.com/" Missing amazon_linux in us-west-1 Found amazon_linux in us-west-2 ``` The `aws_lightsail_domain` hardcoded us-east-1 configuration will be handled in a future update as this resource is required to exist in us-east-1: ``` --- FAIL: TestAccAWSLightsailDomain_basic (5.65s) testing.go:568: Step 0 error: errors during apply: Error: InvalidInputException: Domain-related APIs are only available in the us-east-1 Region. Please set your Region configuration to us-east-1 to create, view, or edit these resources. ``` Previous output from tfproviderlint AT004 (only relevant check failures shown): ``` aws/resource_aws_lightsail_instance_test.go:180:21: AT004: provider declaration should be omitted aws/resource_aws_lightsail_instance_test.go:195:21: AT004: provider declaration should be omitted aws/resource_aws_lightsail_key_pair_test.go:171:21: AT004: provider declaration should be omitted aws/resource_aws_lightsail_key_pair_test.go:183:21: AT004: provider declaration should be omitted aws/resource_aws_lightsail_key_pair_test.go:197:21: AT004: provider declaration should be omitted aws/resource_aws_lightsail_key_pair_test.go:213:21: AT004: provider declaration should be omitted aws/resource_aws_lightsail_static_ip_attachment_test.go:137:21: AT004: provider declaration should be omitted aws/resource_aws_lightsail_static_ip_test.go:183:21: AT004: provider declaration should be omitted ``` Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSLightsailStaticIp_disappears (11.47s) --- PASS: TestAccAWSLightsailStaticIp_basic (13.36s) --- PASS: TestAccAWSLightsailKeyPair_imported (24.50s) --- PASS: TestAccAWSLightsailKeyPair_encrypted (24.96s) --- PASS: TestAccAWSLightsailKeyPair_basic (25.17s) --- PASS: TestAccAWSLightsailKeyPair_nameprefix (25.74s) --- PASS: TestAccAWSLightsailInstance_disapear (60.65s) --- PASS: TestAccAWSLightsailInstance_basic (62.58s) --- PASS: TestAccAWSLightsailStaticIpAttachment_disappears (80.43s) --- PASS: TestAccAWSLightsailStaticIpAttachment_basic (81.75s) ``` Output from acceptance testing in AWS GovCloud (US): Service not available in this partition --- aws/resource_aws_lightsail_instance_test.go | 47 ++----------------- aws/resource_aws_lightsail_key_pair_test.go | 16 ------- ...aws_lightsail_static_ip_attachment_test.go | 8 ++-- aws/resource_aws_lightsail_static_ip_test.go | 4 -- 4 files changed, 8 insertions(+), 67 deletions(-) diff --git a/aws/resource_aws_lightsail_instance_test.go b/aws/resource_aws_lightsail_instance_test.go index fa23ea090a91..e4ef97d212cf 100644 --- a/aws/resource_aws_lightsail_instance_test.go +++ b/aws/resource_aws_lightsail_instance_test.go @@ -40,30 +40,6 @@ func TestAccAWSLightsailInstance_basic(t *testing.T) { }) } -func TestAccAWSLightsailInstance_euRegion(t *testing.T) { - var conf lightsail.Instance - lightsailName := fmt.Sprintf("tf-test-lightsail-%d", acctest.RandInt()) - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSLightsail(t) }, - IDRefreshName: "aws_lightsail_instance.lightsail_instance_test", - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSLightsailInstanceDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSLightsailInstanceConfig_euRegion(lightsailName), - Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLightsailInstanceExists("aws_lightsail_instance.lightsail_instance_test", &conf), - resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "availability_zone"), - resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "blueprint_id"), - resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "bundle_id"), - resource.TestCheckResourceAttrSet("aws_lightsail_instance.lightsail_instance_test", "key_pair_name"), - ), - }, - }, - }) -} - func TestAccAWSLightsailInstance_Name(t *testing.T) { var conf lightsail.Instance lightsailName := fmt.Sprintf("tf-test-lightsail-%d", acctest.RandInt()) @@ -261,14 +237,14 @@ func testAccPreCheckAWSLightsail(t *testing.T) { func testAccAWSLightsailInstanceConfig_basic(lightsailName string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-east-1" +data "aws_availability_zones" "available" { + state = "available" } resource "aws_lightsail_instance" "lightsail_instance_test" { name = "%s" - availability_zone = "us-east-1b" - blueprint_id = "gitlab_8_12_6" + availability_zone = "${data.aws_availability_zones.available.names[0]}" + blueprint_id = "amazon_linux" bundle_id = "nano_1_0" } `, lightsailName) @@ -310,18 +286,3 @@ resource "aws_lightsail_instance" "lightsail_instance_test" { } `, lightsailName) } - -func testAccAWSLightsailInstanceConfig_euRegion(lightsailName string) string { - return fmt.Sprintf(` -provider "aws" { - region = "eu-west-1" -} - -resource "aws_lightsail_instance" "lightsail_instance_test" { - name = "%s" - availability_zone = "eu-west-1a" - blueprint_id = "joomla_3_6_5" - bundle_id = "nano_1_0" -} -`, lightsailName) -} diff --git a/aws/resource_aws_lightsail_key_pair_test.go b/aws/resource_aws_lightsail_key_pair_test.go index d68a2ba7191c..6737dd9ff6d6 100644 --- a/aws/resource_aws_lightsail_key_pair_test.go +++ b/aws/resource_aws_lightsail_key_pair_test.go @@ -169,10 +169,6 @@ func testAccCheckAWSLightsailKeyPairDestroy(s *terraform.State) error { func testAccAWSLightsailKeyPairConfig_basic(lightsailName string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-east-1" -} - resource "aws_lightsail_key_pair" "lightsail_key_pair_test" { name = "%s" } @@ -181,10 +177,6 @@ resource "aws_lightsail_key_pair" "lightsail_key_pair_test" { func testAccAWSLightsailKeyPairConfig_imported(lightsailName, key string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-east-1" -} - resource "aws_lightsail_key_pair" "lightsail_key_pair_test" { name = "%s" @@ -195,10 +187,6 @@ resource "aws_lightsail_key_pair" "lightsail_key_pair_test" { func testAccAWSLightsailKeyPairConfig_encrypted(lightsailName, key string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-east-1" -} - resource "aws_lightsail_key_pair" "lightsail_key_pair_test" { name = "%s" @@ -211,10 +199,6 @@ EOF func testAccAWSLightsailKeyPairConfig_prefixed() string { return fmt.Sprintf(` -provider "aws" { - region = "us-east-1" -} - resource "aws_lightsail_key_pair" "lightsail_key_pair_test_omit" {} resource "aws_lightsail_key_pair" "lightsail_key_pair_test_prefixed" { diff --git a/aws/resource_aws_lightsail_static_ip_attachment_test.go b/aws/resource_aws_lightsail_static_ip_attachment_test.go index 9e55c2092d5d..9ce85f9e4f18 100644 --- a/aws/resource_aws_lightsail_static_ip_attachment_test.go +++ b/aws/resource_aws_lightsail_static_ip_attachment_test.go @@ -135,8 +135,8 @@ func testAccCheckAWSLightsailStaticIpAttachmentDestroy(s *terraform.State) error func testAccAWSLightsailStaticIpAttachmentConfig_basic(staticIpName, instanceName, keypairName string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-east-1" +data "aws_availability_zones" "available" { + state = "available" } resource "aws_lightsail_static_ip_attachment" "test" { @@ -150,8 +150,8 @@ resource "aws_lightsail_static_ip" "test" { resource "aws_lightsail_instance" "test" { name = "%s" - availability_zone = "us-east-1b" - blueprint_id = "wordpress_4_6_1" + availability_zone = "${data.aws_availability_zones.available.names[0]}" + blueprint_id = "amazon_linux" bundle_id = "micro_1_0" key_pair_name = "${aws_lightsail_key_pair.test.name}" } diff --git a/aws/resource_aws_lightsail_static_ip_test.go b/aws/resource_aws_lightsail_static_ip_test.go index b6b7b6740203..ed899a568bd0 100644 --- a/aws/resource_aws_lightsail_static_ip_test.go +++ b/aws/resource_aws_lightsail_static_ip_test.go @@ -181,10 +181,6 @@ func testAccCheckAWSLightsailStaticIpDestroy(s *terraform.State) error { func testAccAWSLightsailStaticIpConfig_basic(staticIpName string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-east-1" -} - resource "aws_lightsail_static_ip" "test" { name = "%s" } From 58c70e831794bca29145829a5bf35e688405b28f Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 10 Jul 2019 14:28:04 -0400 Subject: [PATCH 0174/1054] =?UTF-8?q?resource/aws=5Facmpca=5Fcertificate?= =?UTF-8?q?=5Fauthority:=20Support=20validation=20f=E2=80=A6=20(#9292)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/9081 Output from acceptance testing: ``` --- PASS: TestAccAwsAcmpcaCertificateAuthority_Type_Root (17.66s) ``` --- ...source_aws_acmpca_certificate_authority.go | 2 + ...e_aws_acmpca_certificate_authority_test.go | 46 +++++++++++++++++++ ...acmpca_certificate_authority.html.markdown | 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_acmpca_certificate_authority.go b/aws/resource_aws_acmpca_certificate_authority.go index 46bb1cedbb73..79564385b79a 100644 --- a/aws/resource_aws_acmpca_certificate_authority.go +++ b/aws/resource_aws_acmpca_certificate_authority.go @@ -255,8 +255,10 @@ func resourceAwsAcmpcaCertificateAuthority() *schema.Resource { "type": { Type: schema.TypeString, Optional: true, + ForceNew: true, Default: acmpca.CertificateAuthorityTypeSubordinate, ValidateFunc: validation.StringInSlice([]string{ + acmpca.CertificateAuthorityTypeRoot, acmpca.CertificateAuthorityTypeSubordinate, }, false), }, diff --git a/aws/resource_aws_acmpca_certificate_authority_test.go b/aws/resource_aws_acmpca_certificate_authority_test.go index 43724c4d7338..33fb906902ad 100644 --- a/aws/resource_aws_acmpca_certificate_authority_test.go +++ b/aws/resource_aws_acmpca_certificate_authority_test.go @@ -410,6 +410,34 @@ func TestAccAwsAcmpcaCertificateAuthority_Tags(t *testing.T) { }) } +func TestAccAwsAcmpcaCertificateAuthority_Type_Root(t *testing.T) { + var certificateAuthority acmpca.CertificateAuthority + resourceName := "aws_acmpca_certificate_authority.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsAcmpcaCertificateAuthorityDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAwsAcmpcaCertificateAuthorityConfigType(acmpca.CertificateAuthorityTypeRoot), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsAcmpcaCertificateAuthorityExists(resourceName, &certificateAuthority), + resource.TestCheckResourceAttr(resourceName, "type", acmpca.CertificateAuthorityTypeRoot), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "permanent_deletion_time_in_days", + }, + }, + }, + }) +} + func testAccCheckAwsAcmpcaCertificateAuthorityDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).acmpcaconn @@ -694,3 +722,21 @@ resource "aws_acmpca_certificate_authority" "test" { } } ` + +func testAccAwsAcmpcaCertificateAuthorityConfigType(certificateAuthorityType string) string { + return fmt.Sprintf(` +resource "aws_acmpca_certificate_authority" "test" { + permanent_deletion_time_in_days = 7 + type = %[1]q + + certificate_authority_configuration { + key_algorithm = "RSA_4096" + signing_algorithm = "SHA512WITHRSA" + + subject { + common_name = "terraformtesting.com" + } + } +} +`, certificateAuthorityType) +} diff --git a/website/docs/r/acmpca_certificate_authority.html.markdown b/website/docs/r/acmpca_certificate_authority.html.markdown index 656b2fe14a04..c948f54a4c1b 100644 --- a/website/docs/r/acmpca_certificate_authority.html.markdown +++ b/website/docs/r/acmpca_certificate_authority.html.markdown @@ -95,7 +95,7 @@ The following arguments are supported: * `enabled` - (Optional) Whether the certificate authority is enabled or disabled. Defaults to `true`. * `revocation_configuration` - (Optional) Nested argument containing revocation configuration. Defined below. * `tags` - (Optional) Specifies a key-value map of user-defined tags that are attached to the certificate authority. -* `type` - (Optional) The type of the certificate authority. Currently, this must be `SUBORDINATE`. +* `type` - (Optional) The type of the certificate authority. Defaults to `SUBORDINATE`. Valid values: `ROOT` and `SUBORDINATE`. * `permanent_deletion_time_in_days` - (Optional) The number of days to make a CA restorable after it has been deleted, must be between 7 to 30 days, with default to 30 days. ### certificate_authority_configuration From 577ed7880f709ae5af550eba0f701296d82f572c Mon Sep 17 00:00:00 2001 From: Wilken Rivera Date: Wed, 10 Jul 2019 14:28:05 -0400 Subject: [PATCH 0175/1054] update CHANGELOG for #9292 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db297cf8dfed..578022354c3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ FEATURES: * **New Resource:** `aws_directory_service_log_subscription` [GH-9261] ENHANCEMENTS: - +* resource/aws_acmpca_certificate_authority: Support validation for `ROOT` certificate authority type [GH-9292] * resource/aws_appmesh_virtual_node: Add `aws_cloud_map` configuration block under `spec` and `service_discovery` [GH-9271] * resource/aws_appmesh_virtual_router: Add `tags` argument [GH-9249] * resource/aws_appmesh_virtual_service: Add `tags` argument [GH-9252] From 29c41d742884d0d055fabde44737d9e3e5f18f3e Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 10 Jul 2019 14:41:37 -0400 Subject: [PATCH 0176/1054] =?UTF-8?q?tests/provider:=20Remove=20hardcoded?= =?UTF-8?q?=20us-west-2=20provider=20declaration=E2=80=A6=20(#9075)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/8983 Test configurations should omit `provider "aws"` declarations as these: * Prevents the same configuration from successfully running against multiple AWS partitions (e.g. AWS Commercial and AWS GovCloud (US)) * Reconfigure the default testing provider configuration, which can cause unexpected behavior across multiple tests In this pass, we cleanup the trivial cases of `region = "us-west-2"` declarations, which matches the default region the acceptance testing framework is configured. As an added benefit of these changes, some of these tests may begin passing in AWS GovCloud (US) and other partitions. Future updates will handle hardcoded region and availability zone testing. Previously from `tfproviderlint -AT004 ./aws` (only relevant failures shown): ``` aws/data_source_aws_availability_zone_test.go:35:52: AT004: provider declaration should be omitted aws/data_source_aws_canonical_user_id_test.go:44:51: AT004: provider declaration should be omitted aws/data_source_aws_kms_ciphertext_test.go:57:55: AT004: provider declaration should be omitted aws/data_source_aws_kms_ciphertext_test.go:74:58: AT004: provider declaration should be omitted aws/data_source_aws_kms_ciphertext_test.go:92:70: AT004: provider declaration should be omitted aws/data_source_aws_nat_gateway_test.go:45:21: AT004: provider declaration should be omitted aws/data_source_aws_prefix_list_test.go:60:46: AT004: provider declaration should be omitted aws/data_source_aws_sns_test.go:52:44: AT004: provider declaration should be omitted aws/data_source_aws_vpc_test.go:134:21: AT004: provider declaration should be omitted aws/data_source_aws_vpc_test.go:155:21: AT004: provider declaration should be omitted aws/resource_aws_autoscaling_group_test.go:2481:67: AT004: provider declaration should be omitted aws/resource_aws_autoscaling_group_test.go:2624:21: AT004: provider declaration should be omitted aws/resource_aws_default_route_table_test.go:241:41: AT004: provider declaration should be omitted aws/resource_aws_default_route_table_test.go:291:45: AT004: provider declaration should be omitted aws/resource_aws_default_route_table_test.go:384:47: AT004: provider declaration should be omitted aws/resource_aws_default_vpc_test.go:50:41: AT004: provider declaration should be omitted aws/resource_aws_elb_test.go:1680:37: AT004: provider declaration should be omitted aws/resource_aws_elb_test.go:1751:41: AT004: provider declaration should be omitted aws/resource_aws_opsworks_custom_layer_test.go:349:21: AT004: provider declaration should be omitted aws/resource_aws_opsworks_rails_app_layer_test.go:79:21: AT004: provider declaration should be omitted aws/resource_aws_opsworks_rails_app_layer_test.go:103:21: AT004: provider declaration should be omitted aws/resource_aws_opsworks_stack_test.go:726:21: AT004: provider declaration should be omitted aws/resource_aws_opsworks_stack_test.go:819:21: AT004: provider declaration should be omitted aws/resource_aws_subnet_test.go:456:47: AT004: provider declaration should be omitted aws/resource_aws_vpc_endpoint_route_table_association_test.go:105:55: AT004: provider declaration should be omitted ``` Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups (81.06s) --- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity (372.99s) --- PASS: TestAccAWSDefaultRouteTable_basic (77.18s) --- PASS: TestAccAWSDefaultRouteTable_Route_TransitGatewayID (314.28s) --- PASS: TestAccAWSDefaultRouteTable_swap (62.06s) --- PASS: TestAccAWSDefaultRouteTable_vpc_endpoint (44.30s) --- PASS: TestAccAWSDefaultVpc_basic (23.95s) --- PASS: TestAccAWSELB_swap_subnets (74.50s) --- PASS: TestAccAWSOpsworksCustomLayer_importBasic (42.93s) --- PASS: TestAccAWSOpsworksRailsAppLayer (59.16s) --- PASS: TestAccAWSOpsworksStackNoVpcCreateTags (36.37s) --- PASS: TestAccAWSSubnet_availabilityZoneId (32.60s) --- PASS: TestAccAWSVpcEndpointRouteTableAssociation_basic (44.86s) --- PASS: TestAccDataSourceAwsAvailabilityZone (12.31s) --- PASS: TestAccDataSourceAwsCanonicalUserId_basic (11.20s) --- PASS: TestAccDataSourceAwsKmsCiphertext_basic (39.08s) --- PASS: TestAccDataSourceAwsKmsCiphertext_validate (39.13s) --- PASS: TestAccDataSourceAwsKmsCiphertext_validate_withContext (39.34s) --- PASS: TestAccDataSourceAwsNatGateway (215.82s) --- PASS: TestAccDataSourceAwsPrefixList (11.04s) --- PASS: TestAccDataSourceAwsSnsTopic (14.32s) --- PASS: TestAccDataSourceAwsVpc_basic (36.01s) --- PASS: TestAccDataSourceAwsVpc_ipv6Associated (34.89s) --- PASS: TestAccDataSourceAwsVpc_multipleCidr (53.00s) ``` --- aws/data_source_aws_availability_zone_test.go | 4 ---- aws/data_source_aws_canonical_user_id_test.go | 4 ---- aws/data_source_aws_kms_ciphertext_test.go | 12 ------------ aws/data_source_aws_nat_gateway_test.go | 4 ---- aws/data_source_aws_prefix_list_test.go | 4 ---- aws/data_source_aws_sns_test.go | 4 ---- aws/data_source_aws_vpc_test.go | 8 -------- aws/resource_aws_autoscaling_group_test.go | 8 -------- aws/resource_aws_default_route_table_test.go | 12 ------------ aws/resource_aws_default_vpc_test.go | 4 ---- aws/resource_aws_elb_test.go | 8 -------- aws/resource_aws_opsworks_custom_layer_test.go | 4 ---- aws/resource_aws_opsworks_rails_app_layer_test.go | 8 -------- aws/resource_aws_opsworks_stack_test.go | 8 -------- aws/resource_aws_subnet_test.go | 4 ---- ..._aws_vpc_endpoint_route_table_association_test.go | 4 ---- 16 files changed, 100 deletions(-) diff --git a/aws/data_source_aws_availability_zone_test.go b/aws/data_source_aws_availability_zone_test.go index 0ee6c41d53ce..ad1614992444 100644 --- a/aws/data_source_aws_availability_zone_test.go +++ b/aws/data_source_aws_availability_zone_test.go @@ -33,10 +33,6 @@ func TestAccDataSourceAwsAvailabilityZone(t *testing.T) { } const testAccDataSourceAwsAvailabilityZoneConfig = ` -provider "aws" { - region = "us-west-2" -} - data "aws_availability_zone" "by_name" { name = "us-west-2a" } diff --git a/aws/data_source_aws_canonical_user_id_test.go b/aws/data_source_aws_canonical_user_id_test.go index 88a6320c71c8..bef8ea870d41 100644 --- a/aws/data_source_aws_canonical_user_id_test.go +++ b/aws/data_source_aws_canonical_user_id_test.go @@ -42,9 +42,5 @@ func testAccDataSourceAwsCanonicalUserIdCheckExists(name string) resource.TestCh } const testAccDataSourceAwsCanonicalUserIdConfig = ` -provider "aws" { - region = "us-west-2" -} - data "aws_canonical_user_id" "current" { } ` diff --git a/aws/data_source_aws_kms_ciphertext_test.go b/aws/data_source_aws_kms_ciphertext_test.go index fd45b2f592b5..292549c9587e 100644 --- a/aws/data_source_aws_kms_ciphertext_test.go +++ b/aws/data_source_aws_kms_ciphertext_test.go @@ -55,10 +55,6 @@ func TestAccDataSourceAwsKmsCiphertext_validate_withContext(t *testing.T) { } const testAccDataSourceAwsKmsCiphertextConfig_basic = ` -provider "aws" { - region = "us-west-2" -} - resource "aws_kms_key" "foo" { description = "tf-test-acc-data-source-aws-kms-ciphertext-basic" is_enabled = true @@ -72,10 +68,6 @@ data "aws_kms_ciphertext" "foo" { ` const testAccDataSourceAwsKmsCiphertextConfig_validate = ` -provider "aws" { - region = "us-west-2" -} - resource "aws_kms_key" "foo" { description = "tf-test-acc-data-source-aws-kms-ciphertext-validate" is_enabled = true @@ -90,10 +82,6 @@ data "aws_kms_ciphertext" "foo" { ` const testAccDataSourceAwsKmsCiphertextConfig_validate_withContext = ` -provider "aws" { - region = "us-west-2" -} - resource "aws_kms_key" "foo" { description = "tf-test-acc-data-source-aws-kms-ciphertext-validate-with-context" is_enabled = true diff --git a/aws/data_source_aws_nat_gateway_test.go b/aws/data_source_aws_nat_gateway_test.go index e1482f32c95a..0d9bb25a6fc5 100644 --- a/aws/data_source_aws_nat_gateway_test.go +++ b/aws/data_source_aws_nat_gateway_test.go @@ -43,10 +43,6 @@ func TestAccDataSourceAwsNatGateway(t *testing.T) { func testAccDataSourceAwsNatGatewayConfig(rInt int) string { return fmt.Sprintf(` -provider "aws" { - region = "us-west-2" -} - resource "aws_vpc" "test" { cidr_block = "172.%d.0.0/16" diff --git a/aws/data_source_aws_prefix_list_test.go b/aws/data_source_aws_prefix_list_test.go index 0839788bd53a..3666d1371eb4 100644 --- a/aws/data_source_aws_prefix_list_test.go +++ b/aws/data_source_aws_prefix_list_test.go @@ -58,10 +58,6 @@ func testAccDataSourceAwsPrefixListCheck(name string) resource.TestCheckFunc { } const testAccDataSourceAwsPrefixListConfig = ` -provider "aws" { - region = "us-west-2" -} - data "aws_prefix_list" "s3_by_id" { prefix_list_id = "pl-68a54001" } diff --git a/aws/data_source_aws_sns_test.go b/aws/data_source_aws_sns_test.go index 60c09a853dc6..0bc54b106e7e 100644 --- a/aws/data_source_aws_sns_test.go +++ b/aws/data_source_aws_sns_test.go @@ -50,10 +50,6 @@ func testAccDataSourceAwsSnsTopicCheck(name string) resource.TestCheckFunc { } const testAccDataSourceAwsSnsTopicConfig = ` -provider "aws" { - region = "us-west-2" -} - resource "aws_sns_topic" "tf_wrong1" { name = "wrong1" } diff --git a/aws/data_source_aws_vpc_test.go b/aws/data_source_aws_vpc_test.go index 61ee58b9c830..74baac45d49b 100644 --- a/aws/data_source_aws_vpc_test.go +++ b/aws/data_source_aws_vpc_test.go @@ -132,10 +132,6 @@ func TestAccDataSourceAwsVpc_multipleCidr(t *testing.T) { func testAccDataSourceAwsVpcConfigIpv6(cidr, tag string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-west-2" -} - resource "aws_vpc" "test" { cidr_block = "%s" assign_generated_ipv6_cidr_block = true @@ -153,10 +149,6 @@ data "aws_vpc" "by_id" { func testAccDataSourceAwsVpcConfig(cidr, tag string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-west-2" -} - resource "aws_vpc" "test" { cidr_block = "%s" diff --git a/aws/resource_aws_autoscaling_group_test.go b/aws/resource_aws_autoscaling_group_test.go index a15be248614b..79dfb76e05be 100644 --- a/aws/resource_aws_autoscaling_group_test.go +++ b/aws/resource_aws_autoscaling_group_test.go @@ -2479,10 +2479,6 @@ resource "aws_security_group" "tf_test_self" { ` const testAccAWSAutoScalingGroupConfig_ALB_TargetGroup_post_duo = ` -provider "aws" { - region = "us-west-2" -} - resource "aws_vpc" "default" { cidr_block = "10.0.0.0/16" @@ -2622,10 +2618,6 @@ resource "aws_autoscaling_group" "bar" { func testAccAWSAutoScalingGroupConfig_ALB_TargetGroup_ELBCapacity(rInt int) string { return fmt.Sprintf(` -provider "aws" { - region = "us-west-2" -} - resource "aws_vpc" "default" { cidr_block = "10.0.0.0/16" enable_dns_hostnames = "true" diff --git a/aws/resource_aws_default_route_table_test.go b/aws/resource_aws_default_route_table_test.go index 6f1fd4b6900c..b81202c6efce 100644 --- a/aws/resource_aws_default_route_table_test.go +++ b/aws/resource_aws_default_route_table_test.go @@ -239,10 +239,6 @@ resource "aws_internet_gateway" "gw" { }` const testAccDefaultRouteTable_change = ` -provider "aws" { - region = "us-west-2" -} - resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" enable_dns_hostnames = true @@ -289,10 +285,6 @@ resource "aws_route_table" "r" { ` const testAccDefaultRouteTable_change_mod = ` -provider "aws" { - region = "us-west-2" -} - resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" enable_dns_hostnames = true @@ -382,10 +374,6 @@ resource "aws_default_route_table" "test" { } const testAccDefaultRouteTable_vpc_endpoint = ` -provider "aws" { - region = "us-west-2" -} - resource "aws_vpc" "test" { cidr_block = "10.0.0.0/16" diff --git a/aws/resource_aws_default_vpc_test.go b/aws/resource_aws_default_vpc_test.go index 21f249a1ef61..9e49be5c4bc0 100644 --- a/aws/resource_aws_default_vpc_test.go +++ b/aws/resource_aws_default_vpc_test.go @@ -48,10 +48,6 @@ func testAccCheckAWSDefaultVpcDestroy(s *terraform.State) error { } const testAccAWSDefaultVpcConfigBasic = ` -provider "aws" { - region = "us-west-2" -} - resource "aws_default_vpc" "foo" { tags = { Name = "Default VPC" diff --git a/aws/resource_aws_elb_test.go b/aws/resource_aws_elb_test.go index 7aa650dedfd0..2a501c1ea6b7 100644 --- a/aws/resource_aws_elb_test.go +++ b/aws/resource_aws_elb_test.go @@ -1678,10 +1678,6 @@ resource "aws_elb" "bar" { } const testAccAWSELBConfig_subnets = ` -provider "aws" { - region = "us-west-2" -} - resource "aws_vpc" "azelb" { cidr_block = "10.1.0.0/16" enable_dns_hostnames = true @@ -1749,10 +1745,6 @@ resource "aws_internet_gateway" "gw" { ` const testAccAWSELBConfig_subnet_swap = ` -provider "aws" { - region = "us-west-2" -} - resource "aws_vpc" "azelb" { cidr_block = "10.1.0.0/16" enable_dns_hostnames = true diff --git a/aws/resource_aws_opsworks_custom_layer_test.go b/aws/resource_aws_opsworks_custom_layer_test.go index 8f7184982db6..406ce5b140bf 100644 --- a/aws/resource_aws_opsworks_custom_layer_test.go +++ b/aws/resource_aws_opsworks_custom_layer_test.go @@ -347,10 +347,6 @@ resource "aws_opsworks_custom_layer" "tf-acc" { func testAccAwsOpsworksCustomLayerConfigVpcCreate(name string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-west-2" -} - resource "aws_opsworks_custom_layer" "tf-acc" { stack_id = "${aws_opsworks_stack.tf-acc.id}" name = "%s" diff --git a/aws/resource_aws_opsworks_rails_app_layer_test.go b/aws/resource_aws_opsworks_rails_app_layer_test.go index 4d33058a74e8..9f1fd7b4c582 100644 --- a/aws/resource_aws_opsworks_rails_app_layer_test.go +++ b/aws/resource_aws_opsworks_rails_app_layer_test.go @@ -77,10 +77,6 @@ func testAccCheckAwsOpsworksRailsAppLayerDestroy(s *terraform.State) error { func testAccAwsOpsworksRailsAppLayerConfigVpcCreate(name string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-west-2" -} - resource "aws_opsworks_rails_app_layer" "tf-acc" { stack_id = "${aws_opsworks_stack.tf-acc.id}" name = "%s" @@ -101,10 +97,6 @@ resource "aws_opsworks_rails_app_layer" "tf-acc" { func testAccAwsOpsworksRailsAppLayerNoManageBundlerConfigVpcCreate(name string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-west-2" -} - resource "aws_opsworks_rails_app_layer" "tf-acc" { stack_id = "${aws_opsworks_stack.tf-acc.id}" name = "%s" diff --git a/aws/resource_aws_opsworks_stack_test.go b/aws/resource_aws_opsworks_stack_test.go index 5f21e816df39..03ce3c736216 100644 --- a/aws/resource_aws_opsworks_stack_test.go +++ b/aws/resource_aws_opsworks_stack_test.go @@ -724,10 +724,6 @@ resource "aws_iam_instance_profile" "opsworks_instance" { func testAccAwsOpsworksStackConfigNoVpcCreateTags(name string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-west-2" -} - resource "aws_opsworks_stack" "tf-acc" { name = "%s" region = "us-west-2" @@ -817,10 +813,6 @@ resource "aws_iam_instance_profile" "opsworks_instance" { func testAccAwsOpsworksStackConfigNoVpcUpdateTags(name string) string { return fmt.Sprintf(` -provider "aws" { - region = "us-west-2" -} - resource "aws_opsworks_stack" "tf-acc" { name = "%s" region = "us-west-2" diff --git a/aws/resource_aws_subnet_test.go b/aws/resource_aws_subnet_test.go index 47700465401e..0e34156d7ef0 100644 --- a/aws/resource_aws_subnet_test.go +++ b/aws/resource_aws_subnet_test.go @@ -454,10 +454,6 @@ resource "aws_subnet" "foo" { ` const testAccSubnetConfigAvailabilityZoneId = ` -provider "aws" { - region = "us-west-2" -} - resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" tags = { diff --git a/aws/resource_aws_vpc_endpoint_route_table_association_test.go b/aws/resource_aws_vpc_endpoint_route_table_association_test.go index 2ccc567a7b1d..5456724c6a59 100644 --- a/aws/resource_aws_vpc_endpoint_route_table_association_test.go +++ b/aws/resource_aws_vpc_endpoint_route_table_association_test.go @@ -103,10 +103,6 @@ func testAccCheckVpcEndpointRouteTableAssociationExists(n string, vpce *ec2.VpcE } const testAccVpcEndpointRouteTableAssociationConfig = ` -provider "aws" { - region = "us-west-2" -} - resource "aws_vpc" "foo" { cidr_block = "10.0.0.0/16" tags = { From 0e51db560acd86ab43b80fbc3810a34aa070abb6 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 10 Jul 2019 15:53:41 -0400 Subject: [PATCH 0177/1054] resource/aws_ssm_document: Verify schema version 1.0 updates complete as expected, remove extraneous skip update code Output from acceptance testing: ``` --- PASS: TestAccAWSSSMDocument_basic (22.85s) --- PASS: TestAccAWSSSMDocument_session (23.28s) --- PASS: TestAccAWSSSMDocument_params (30.43s) --- PASS: TestAccAWSSSMDocument_permission_batching (32.29s) --- PASS: TestAccAWSSSMDocument_update (33.08s) --- PASS: TestAccAWSSSMDocument_permission_private (35.62s) --- PASS: TestAccAWSSSMDocument_DocumentFormat_YAML (43.34s) --- PASS: TestAccAWSSSMDocument_Tags (43.64s) --- PASS: TestAccAWSSSMDocument_automation (46.07s) --- PASS: TestAccAWSSSMDocument_SchemaVersion_1 (57.55s) --- PASS: TestAccAWSSSMDocument_permission_change (66.23s) --- PASS: TestAccAWSSSMDocument_permission_public (72.01s) ``` --- aws/resource_aws_ssm_document.go | 11 ---- aws/resource_aws_ssm_document_test.go | 75 +++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 11 deletions(-) diff --git a/aws/resource_aws_ssm_document.go b/aws/resource_aws_ssm_document.go index cf96d589ff51..70deec3fa537 100644 --- a/aws/resource_aws_ssm_document.go +++ b/aws/resource_aws_ssm_document.go @@ -3,7 +3,6 @@ package aws import ( "fmt" "log" - "strconv" "strings" "time" @@ -17,7 +16,6 @@ import ( ) const ( - MINIMUM_VERSIONED_SCHEMA = 2.0 SSM_DOCUMENT_PERMISSIONS_BATCH_LIMIT = 20 ) @@ -319,15 +317,6 @@ func resourceAwsSsmDocumentUpdate(d *schema.ResourceData, meta interface{}) erro return nil } - if schemaVersion, ok := d.GetOk("schemaVersion"); ok { - schemaNumber, _ := strconv.ParseFloat(schemaVersion.(string), 64) - - if schemaNumber < MINIMUM_VERSIONED_SCHEMA { - log.Printf("[DEBUG] Skipping document update because document version is not 2.0 %q", d.Id()) - return nil - } - } - if err := updateAwsSSMDocument(d, meta); err != nil { return err } diff --git a/aws/resource_aws_ssm_document_test.go b/aws/resource_aws_ssm_document_test.go index 7d12d3122890..0f1841ab5d3f 100644 --- a/aws/resource_aws_ssm_document_test.go +++ b/aws/resource_aws_ssm_document_test.go @@ -219,6 +219,33 @@ func TestAccAWSSSMDocument_automation(t *testing.T) { }) } +func TestAccAWSSSMDocument_SchemaVersion_1(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ssm_document.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSSMDocumentDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSSMDocumentConfigSchemaVersion1(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMDocumentExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "schema_version", "1.0"), + ), + }, + { + Config: testAccAWSSSMDocumentConfigSchemaVersion1Update(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMDocumentExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "schema_version", "1.0"), + ), + }, + }, + }) +} + func TestAccAWSSSMDocument_session(t *testing.T) { name := acctest.RandString(10) resource.ParallelTest(t, resource.TestCase{ @@ -719,6 +746,54 @@ DOC `, rName, content) } +func testAccAWSSSMDocumentConfigSchemaVersion1(rName string) string { + return fmt.Sprintf(` +resource "aws_ssm_document" "test" { + name = %[1]q + document_type = "Session" + + content = < Date: Wed, 10 Jul 2019 22:08:41 +0200 Subject: [PATCH 0178/1054] Fix S3 bucket lifecycle rule filters with a single tag and no prefix (#7162) * Add test case to reproduce #7156 * Accept S3 lifecycle with filter on tags only (resolves #7156) * Add additional S3 lifecycle test case with a filter on a single tag (still no prefix) * Rename TestAccAWSS3Bucket_Lifecycle to TestAccAWSS3Bucket_LifecycleBasic to allow targetting this test without also matching TestAccAWSS3Bucket_LifecycleExpireMarkerOnly * Log read lifecycle rule at debug level --- aws/resource_aws_s3_bucket.go | 5 ++++ aws/resource_aws_s3_bucket_test.go | 47 +++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_s3_bucket.go b/aws/resource_aws_s3_bucket.go index c8c75e81ce71..9fe560056995 100644 --- a/aws/resource_aws_s3_bucket.go +++ b/aws/resource_aws_s3_bucket.go @@ -1011,6 +1011,7 @@ func resourceAwsS3BucketRead(d *schema.ResourceData, meta interface{}) error { lifecycleRules = make([]map[string]interface{}, 0, len(lifecycle.Rules)) for _, lifecycleRule := range lifecycle.Rules { + log.Printf("[DEBUG] S3 bucket: %s, read lifecycle rule: %v", d.Id(), lifecycleRule) rule := make(map[string]interface{}) // ID @@ -1033,6 +1034,10 @@ func resourceAwsS3BucketRead(d *schema.ResourceData, meta interface{}) error { if filter.Prefix != nil && *filter.Prefix != "" { rule["prefix"] = *filter.Prefix } + // Tag + if filter.Tag != nil { + rule["tags"] = tagsToMapS3([]*s3.Tag{filter.Tag}) + } } } else { if lifecycleRule.Prefix != nil { diff --git a/aws/resource_aws_s3_bucket_test.go b/aws/resource_aws_s3_bucket_test.go index 926f3d3468be..4c75bee6c5a1 100644 --- a/aws/resource_aws_s3_bucket_test.go +++ b/aws/resource_aws_s3_bucket_test.go @@ -867,7 +867,7 @@ func TestAccAWSS3Bucket_Logging(t *testing.T) { }) } -func TestAccAWSS3Bucket_Lifecycle(t *testing.T) { +func TestAccAWSS3Bucket_LifecycleBasic(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -942,6 +942,24 @@ func TestAccAWSS3Bucket_Lifecycle(t *testing.T) { "aws_s3_bucket.bucket", "lifecycle_rule.3.tags.tagKey", "tagValue"), resource.TestCheckResourceAttr( "aws_s3_bucket.bucket", "lifecycle_rule.3.tags.terraform", "hashicorp"), + resource.TestCheckResourceAttr( + "aws_s3_bucket.bucket", "lifecycle_rule.4.id", "id5"), + resource.TestCheckResourceAttr( + "aws_s3_bucket.bucket", "lifecycle_rule.4.tags.tagKey", "tagValue"), + resource.TestCheckResourceAttr( + "aws_s3_bucket.bucket", "lifecycle_rule.4.tags.terraform", "hashicorp"), + resource.TestCheckResourceAttr( + "aws_s3_bucket.bucket", "lifecycle_rule.4.transition.460947558.days", "0"), + resource.TestCheckResourceAttr( + "aws_s3_bucket.bucket", "lifecycle_rule.4.transition.460947558.storage_class", "GLACIER"), + resource.TestCheckResourceAttr( + "aws_s3_bucket.bucket", "lifecycle_rule.5.id", "id6"), + resource.TestCheckResourceAttr( + "aws_s3_bucket.bucket", "lifecycle_rule.5.tags.tagKey", "tagValue"), + resource.TestCheckResourceAttr( + "aws_s3_bucket.bucket", "lifecycle_rule.5.transition.460947558.days", "0"), + resource.TestCheckResourceAttr( + "aws_s3_bucket.bucket", "lifecycle_rule.5.transition.460947558.storage_class", "GLACIER"), ), }, { @@ -2539,6 +2557,33 @@ resource "aws_s3_bucket" "bucket" { date = "2016-01-12" } } + lifecycle_rule { + id = "id5" + enabled = true + + tags = { + "tagKey" = "tagValue" + "terraform" = "hashicorp" + } + + transition { + days = 0 + storage_class = "GLACIER" + } + } + lifecycle_rule { + id = "id6" + enabled = true + + tags = { + "tagKey" = "tagValue" + } + + transition { + days = 0 + storage_class = "GLACIER" + } + } } `, randInt) } From 9dcbc8e44ceb6fa46833eca86691b3f14df10034 Mon Sep 17 00:00:00 2001 From: Wilken Rivera Date: Wed, 10 Jul 2019 16:19:00 -0400 Subject: [PATCH 0179/1054] update CHANGELOG for #7162 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 578022354c3b..3989a39c4476 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ BUG FIXES: * resource/aws_backup_selection: Retry creation for IAM eventual consistency error [GH-9298] * resource/aws_db_event_subscription: Prevent `Unable to find RDS Event Subscription` error during deletion and refresh [GH-9274] * resource/aws_iam_policy_attachment: Bypass `NoSuchEntity` error when detaching groups, roles, and users (support group, role (when `force_detach_policies` is enabled), and user renames (when `force_destroy` is enabled)) [GH-9278] +* resource/aws_s3_bucket: Properly handle the creation of tags defined in `lifecycle_rule` when no prefix argument is specified [GH-7162] * resource/aws_transfer_user: Final retry after timeout waiting for deletion of transfer user [GH-9241] * service/organizations: Automatically retry API calls on `ConcurrentModificationException` error [GH-9195] From 72a75e251d1eae40f4a3972e1fd7d329f911c3bf Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 10 Jul 2019 16:20:22 -0400 Subject: [PATCH 0180/1054] resource/aws_ssm_document: Ensure content is refreshed into Terraform state for drift detection Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/7516 Output from acceptance testing: ``` --- PASS: TestAccAWSSSMDocument_params (21.85s) --- PASS: TestAccAWSSSMDocument_permission_private (21.85s) --- PASS: TestAccAWSSSMDocument_permission_public (26.31s) --- PASS: TestAccAWSSSMDocument_permission_batching (36.87s) --- PASS: TestAccAWSSSMDocument_automation (38.18s) --- PASS: TestAccAWSSSMDocument_SchemaVersion_1 (41.09s) --- PASS: TestAccAWSSSMDocument_update (42.55s) --- PASS: TestAccAWSSSMDocument_DocumentFormat_YAML (44.60s) --- PASS: TestAccAWSSSMDocument_session (47.62s) --- PASS: TestAccAWSSSMDocument_permission_change (50.90s) --- PASS: TestAccAWSSSMDocument_Tags (54.43s) --- PASS: TestAccAWSSSMDocument_basic (70.90s) PASS ``` --- aws/resource_aws_ssm_document.go | 43 ++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/aws/resource_aws_ssm_document.go b/aws/resource_aws_ssm_document.go index 70deec3fa537..20450e17607b 100644 --- a/aws/resource_aws_ssm_document.go +++ b/aws/resource_aws_ssm_document.go @@ -8,7 +8,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/arn" - "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/ssm" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" @@ -202,21 +201,45 @@ func resourceAwsSsmDocumentRead(d *schema.ResourceData, meta interface{}) error log.Printf("[DEBUG] Reading SSM Document: %s", d.Id()) - docInput := &ssm.DescribeDocumentInput{ + describeDocumentInput := &ssm.DescribeDocumentInput{ Name: aws.String(d.Get("name").(string)), } - resp, err := ssmconn.DescribeDocument(docInput) + describeDocumentOutput, err := ssmconn.DescribeDocument(describeDocumentInput) + + if isAWSErr(err, ssm.ErrCodeInvalidDocument, "") { + log.Printf("[WARN] SSM Document not found so removing from state") + d.SetId("") + return nil + } + if err != nil { - if ssmErr, ok := err.(awserr.Error); ok && ssmErr.Code() == "InvalidDocument" { - log.Printf("[WARN] SSM Document not found so removing from state") - d.SetId("") - return nil - } - return fmt.Errorf("Error describing SSM document: %s", err) + return fmt.Errorf("error describing SSM Document (%s): %s", d.Id(), err) + } + + if describeDocumentOutput == nil || describeDocumentOutput.Document == nil { + return fmt.Errorf("error describing SSM Document (%s): empty result", d.Id()) } - doc := resp.Document + getDocumentInput := &ssm.GetDocumentInput{ + DocumentFormat: describeDocumentOutput.Document.DocumentFormat, + DocumentVersion: aws.String("$LATEST"), + Name: describeDocumentOutput.Document.Name, + } + + getDocumentOutput, err := ssmconn.GetDocument(getDocumentInput) + + if err != nil { + return fmt.Errorf("error getting SSM Document (%s): %s", d.Id(), err) + } + + if getDocumentOutput == nil { + return fmt.Errorf("error getting SSM Document (%s): empty result", d.Id()) + } + + doc := describeDocumentOutput.Document + + d.Set("content", getDocumentOutput.Content) d.Set("created_date", doc.CreatedDate) d.Set("default_version", doc.DefaultVersion) d.Set("description", doc.Description) From 2e46ab39b623210ce351265b4f862e4a0a9fa4e2 Mon Sep 17 00:00:00 2001 From: stack72 Date: Thu, 11 Jul 2019 13:43:32 +0300 Subject: [PATCH 0181/1054] resource/aws_ssm_document: Removing the code that adds Null parameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I actually added this code back in 2016 and there is zero reason for it. It should have skipped over if there were no parameters present ``` ▶ acctests aws TestAccAWSSSMDocument_ === RUN TestAccAWSSSMDocument_basic === PAUSE TestAccAWSSSMDocument_basic === RUN TestAccAWSSSMDocument_update === PAUSE TestAccAWSSSMDocument_update === RUN TestAccAWSSSMDocument_permission_public === PAUSE TestAccAWSSSMDocument_permission_public === RUN TestAccAWSSSMDocument_permission_private === PAUSE TestAccAWSSSMDocument_permission_private === RUN TestAccAWSSSMDocument_permission_batching === PAUSE TestAccAWSSSMDocument_permission_batching === RUN TestAccAWSSSMDocument_permission_change === PAUSE TestAccAWSSSMDocument_permission_change === RUN TestAccAWSSSMDocument_params === PAUSE TestAccAWSSSMDocument_params === RUN TestAccAWSSSMDocument_automation === PAUSE TestAccAWSSSMDocument_automation === RUN TestAccAWSSSMDocument_session === PAUSE TestAccAWSSSMDocument_session === RUN TestAccAWSSSMDocument_DocumentFormat_YAML === PAUSE TestAccAWSSSMDocument_DocumentFormat_YAML === RUN TestAccAWSSSMDocument_Tags === PAUSE TestAccAWSSSMDocument_Tags === CONT TestAccAWSSSMDocument_basic === CONT TestAccAWSSSMDocument_params === CONT TestAccAWSSSMDocument_permission_change === CONT TestAccAWSSSMDocument_Tags === CONT TestAccAWSSSMDocument_DocumentFormat_YAML === CONT TestAccAWSSSMDocument_permission_public === CONT TestAccAWSSSMDocument_permission_private === CONT TestAccAWSSSMDocument_update === CONT TestAccAWSSSMDocument_permission_batching === CONT TestAccAWSSSMDocument_automation === CONT TestAccAWSSSMDocument_session --- PASS: TestAccAWSSSMDocument_session (30.23s) --- PASS: TestAccAWSSSMDocument_params (30.26s) --- PASS: TestAccAWSSSMDocument_basic (32.52s) --- PASS: TestAccAWSSSMDocument_permission_private (34.13s) --- PASS: TestAccAWSSSMDocument_permission_public (34.36s) --- PASS: TestAccAWSSSMDocument_automation (44.68s) --- PASS: TestAccAWSSSMDocument_permission_batching (49.03s) --- PASS: TestAccAWSSSMDocument_DocumentFormat_YAML (52.10s) --- PASS: TestAccAWSSSMDocument_update (54.77s) --- PASS: TestAccAWSSSMDocument_Tags (70.72s) --- PASS: TestAccAWSSSMDocument_permission_change (71.78s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 71.833s ``` --- aws/resource_aws_ssm_document.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/aws/resource_aws_ssm_document.go b/aws/resource_aws_ssm_document.go index cf96d589ff51..5e17bd4fc9e7 100644 --- a/aws/resource_aws_ssm_document.go +++ b/aws/resource_aws_ssm_document.go @@ -278,10 +278,6 @@ func resourceAwsSsmDocumentRead(d *schema.ResourceData, meta interface{}) error params = append(params, param) } - if len(params) == 0 { - params = make([]map[string]interface{}, 1) - } - if err := d.Set("parameter", params); err != nil { return err } From 47a5a31ebf90b3c00ccaf0693c7b894020408372 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Thu, 11 Jul 2019 08:58:11 -0400 Subject: [PATCH 0182/1054] Update CHANGELOG for #9290 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3989a39c4476..7c5a88be2664 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ FEATURES: * **New Data Source:** `aws_msk_configuration` [GH-9088] +* **New Resource:** `aws_athena_workgroup` [GH-9290] * **New Resource:** `aws_datapipeline_pipeline` [GH-9267] * **New Resource:** `aws_directory_service_log_subscription` [GH-9261] From 56cc5f5b616ab5c8618b295d6b99c1b9cad53b42 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Thu, 11 Jul 2019 09:18:27 -0400 Subject: [PATCH 0183/1054] resource/aws_ssm_document: Support resource import Output from acceptance testing: ``` --- PASS: TestAccAWSSSMDocument_session (20.77s) --- PASS: TestAccAWSSSMDocument_permission_public (20.81s) --- PASS: TestAccAWSSSMDocument_params (27.54s) --- PASS: TestAccAWSSSMDocument_permission_batching (35.68s) --- PASS: TestAccAWSSSMDocument_basic (35.72s) --- PASS: TestAccAWSSSMDocument_permission_private (38.92s) --- PASS: TestAccAWSSSMDocument_update (48.37s) --- PASS: TestAccAWSSSMDocument_SchemaVersion_1 (48.81s) --- PASS: TestAccAWSSSMDocument_Tags (52.70s) --- PASS: TestAccAWSSSMDocument_automation (53.60s) --- PASS: TestAccAWSSSMDocument_permission_change (59.26s) --- PASS: TestAccAWSSSMDocument_DocumentFormat_YAML (60.57s) PASS ``` --- aws/resource_aws_ssm_document.go | 11 ++--- aws/resource_aws_ssm_document_test.go | 60 +++++++++++++++++++++++ website/docs/r/ssm_document.html.markdown | 8 +++ 3 files changed, 73 insertions(+), 6 deletions(-) diff --git a/aws/resource_aws_ssm_document.go b/aws/resource_aws_ssm_document.go index 20450e17607b..68356bc1d6ff 100644 --- a/aws/resource_aws_ssm_document.go +++ b/aws/resource_aws_ssm_document.go @@ -24,6 +24,9 @@ func resourceAwsSsmDocument() *schema.Resource { Read: resourceAwsSsmDocumentRead, Update: resourceAwsSsmDocumentUpdate, Delete: resourceAwsSsmDocumentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "arn": { @@ -202,7 +205,7 @@ func resourceAwsSsmDocumentRead(d *schema.ResourceData, meta interface{}) error log.Printf("[DEBUG] Reading SSM Document: %s", d.Id()) describeDocumentInput := &ssm.DescribeDocumentInput{ - Name: aws.String(d.Get("name").(string)), + Name: aws.String(d.Id()), } describeDocumentOutput, err := ssmconn.DescribeDocument(describeDocumentInput) @@ -244,12 +247,8 @@ func resourceAwsSsmDocumentRead(d *schema.ResourceData, meta interface{}) error d.Set("default_version", doc.DefaultVersion) d.Set("description", doc.Description) d.Set("schema_version", doc.SchemaVersion) - - if _, ok := d.GetOk("document_type"); ok { - d.Set("document_type", doc.DocumentType) - } - d.Set("document_format", doc.DocumentFormat) + d.Set("document_type", doc.DocumentType) d.Set("document_version", doc.DocumentVersion) d.Set("hash", doc.Hash) d.Set("hash_type", doc.HashType) diff --git a/aws/resource_aws_ssm_document_test.go b/aws/resource_aws_ssm_document_test.go index 0f1841ab5d3f..59b2e7c2e230 100644 --- a/aws/resource_aws_ssm_document_test.go +++ b/aws/resource_aws_ssm_document_test.go @@ -32,6 +32,11 @@ func TestAccAWSSSMDocument_basic(t *testing.T) { "aws_ssm_document.foo", "tags.Name", "My Document"), ), }, + { + ResourceName: "aws_ssm_document.foo", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -55,6 +60,11 @@ func TestAccAWSSSMDocument_update(t *testing.T) { "aws_ssm_document.foo", "default_version", "1"), ), }, + { + ResourceName: "aws_ssm_document.foo", + ImportState: true, + ImportStateVerify: true, + }, { Config: testAccAWSSSMDocument20UpdatedConfig(name), Check: resource.ComposeTestCheckFunc( @@ -86,6 +96,11 @@ func TestAccAWSSSMDocument_permission_public(t *testing.T) { "aws_ssm_document.foo", "permissions.account_ids", "all"), ), }, + { + ResourceName: "aws_ssm_document.foo", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -106,6 +121,11 @@ func TestAccAWSSSMDocument_permission_private(t *testing.T) { "aws_ssm_document.foo", "permissions.type", "Share"), ), }, + { + ResourceName: "aws_ssm_document.foo", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -126,6 +146,11 @@ func TestAccAWSSSMDocument_permission_batching(t *testing.T) { "aws_ssm_document.foo", "permissions.type", "Share"), ), }, + { + ResourceName: "aws_ssm_document.foo", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -149,6 +174,11 @@ func TestAccAWSSSMDocument_permission_change(t *testing.T) { resource.TestCheckResourceAttr("aws_ssm_document.foo", "permissions.account_ids", idsInitial), ), }, + { + ResourceName: "aws_ssm_document.foo", + ImportState: true, + ImportStateVerify: true, + }, { Config: testAccAWSSSMDocumentPrivatePermissionConfig(name, idsRemove), Check: resource.ComposeTestCheckFunc( @@ -196,6 +226,11 @@ func TestAccAWSSSMDocument_params(t *testing.T) { "aws_ssm_document.foo", "parameter.2.type", "String"), ), }, + { + ResourceName: "aws_ssm_document.foo", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -215,6 +250,11 @@ func TestAccAWSSSMDocument_automation(t *testing.T) { "aws_ssm_document.foo", "document_type", "Automation"), ), }, + { + ResourceName: "aws_ssm_document.foo", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -235,6 +275,11 @@ func TestAccAWSSSMDocument_SchemaVersion_1(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "schema_version", "1.0"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, { Config: testAccAWSSSMDocumentConfigSchemaVersion1Update(rName), Check: resource.ComposeTestCheckFunc( @@ -261,6 +306,11 @@ func TestAccAWSSSMDocument_session(t *testing.T) { "aws_ssm_document.foo", "document_type", "Session"), ), }, + { + ResourceName: "aws_ssm_document.foo", + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -302,6 +352,11 @@ mainSteps: resource.TestCheckResourceAttr("aws_ssm_document.foo", "document_format", "YAML"), ), }, + { + ResourceName: "aws_ssm_document.foo", + ImportState: true, + ImportStateVerify: true, + }, { Config: testAccAWSSSMDocumentConfig_DocumentFormat_YAML(name, content2), Check: resource.ComposeTestCheckFunc( @@ -331,6 +386,11 @@ func TestAccAWSSSMDocument_Tags(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, { Config: testAccAWSSSMDocumentConfig_Tags_Multiple(rName, "key1", "value1updated", "key2", "value2"), Check: resource.ComposeTestCheckFunc( diff --git a/website/docs/r/ssm_document.html.markdown b/website/docs/r/ssm_document.html.markdown index 956eb98fc458..860031322a36 100644 --- a/website/docs/r/ssm_document.html.markdown +++ b/website/docs/r/ssm_document.html.markdown @@ -82,3 +82,11 @@ The permissions mapping supports the following: * `type` - The permission type for the document. The permission type can be `Share`. * `account_ids` - The AWS user accounts that should have access to the document. The account IDs can either be a group of account IDs or `All`. + +## Import + +SSM Documents can be imported using the name, e.g. + +``` +$ terraform import aws_ssm_document.example example +``` From e53b3b3c9bb77d2d823fa5196e2b756d73c02209 Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 11 Jul 2019 16:30:39 +0100 Subject: [PATCH 0184/1054] Added New datasource for WAF Rule lookup --- aws/data_source_aws_waf_rule.go | 64 +++++++++++++++++++++++++ aws/data_source_aws_waf_rule_test.go | 67 +++++++++++++++++++++++++++ aws/provider.go | 1 + website/aws.erb | 3 ++ website/docs/d/waf_rule.html.markdown | 31 +++++++++++++ 5 files changed, 166 insertions(+) create mode 100644 aws/data_source_aws_waf_rule.go create mode 100644 aws/data_source_aws_waf_rule_test.go create mode 100644 website/docs/d/waf_rule.html.markdown diff --git a/aws/data_source_aws_waf_rule.go b/aws/data_source_aws_waf_rule.go new file mode 100644 index 000000000000..fcdd0f14af9f --- /dev/null +++ b/aws/data_source_aws_waf_rule.go @@ -0,0 +1,64 @@ +package aws + +import ( + "fmt" + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/waf" + "github.com/hashicorp/terraform/helper/schema" +) + +func dataSourceAwsWafRule() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAwsWafRuleRead, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataSourceAwsWafRuleRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).wafconn + name := d.Get("name").(string) + + rules := make([]*waf.RuleSummary, 0) + // ListRulesInput does not have a name parameter for filtering + input := &waf.ListRulesInput{} + for { + output, err := conn.ListRules(input) + if err != nil { + return fmt.Errorf("error reading WAF Rules: %s", err) + } + for _, rule := range output.Rules { + if aws.StringValue(rule.Name) == name { + rules = append(rules, rule) + } + } + + if output.NextMarker == nil { + break + } + input.NextMarker = output.NextMarker + } + + if len(rules) == 0 { + return fmt.Errorf("WAF Rules not found for name: %s", name) + } + + if len(rules) > 1 { + return fmt.Errorf("multiple WAF Rules found for name: %s", name) + } + + rule := rules[0] + + d.SetId(aws.StringValue(rule.RuleId)) + + return nil +} diff --git a/aws/data_source_aws_waf_rule_test.go b/aws/data_source_aws_waf_rule_test.go new file mode 100644 index 000000000000..8b10265276e3 --- /dev/null +++ b/aws/data_source_aws_waf_rule_test.go @@ -0,0 +1,67 @@ +package aws + +import ( + "fmt" + "regexp" + "testing" + + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccDataSourceAwsWafRule_Basic(t *testing.T) { + name := "tf-acc-test" + resourceName := "aws_waf_rule.wafrule" + datasourceName := "data.aws_waf_rule.wafrule" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsWafRuleConfig_NonExistent, + ExpectError: regexp.MustCompile(`WAF Rules not found`), + }, + { + Config: testAccDataSourceAwsWafRuleConfig_Name(name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(datasourceName, "id", resourceName, "id"), + resource.TestCheckResourceAttrPair(datasourceName, "name", resourceName, "name"), + ), + }, + }, + }) +} + +func testAccDataSourceAwsWafRuleConfig_Name(name string) string { + return fmt.Sprintf(` +resource "aws_waf_rule" "wafrule" { + name = "%s" + metric_name = "WafruleTest" + + predicates { + data_id = "${aws_waf_ipset.test.id}" + negated = false + type = "IPMatch" + } +} + +resource "aws_waf_ipset" "test" { + name = "%s" + + ip_set_descriptors { + type = "IPV4" + value = "10.0.0.0/8" + } +} + +data "aws_waf_rule" "wafrule" { + name = "${aws_waf_rule.wafrule.name}" +} +`, name, name) +} + +const testAccDataSourceAwsWafRuleConfig_NonExistent = ` +data "aws_waf_rule" "wafrule" { + name = "tf-acc-test-does-not-exist" +} +` diff --git a/aws/provider.go b/aws/provider.go index 4d7c6f312ca6..f52f890e102b 100644 --- a/aws/provider.go +++ b/aws/provider.go @@ -272,6 +272,7 @@ func Provider() terraform.ResourceProvider { "aws_vpc_endpoint_service": dataSourceAwsVpcEndpointService(), "aws_vpc_peering_connection": dataSourceAwsVpcPeeringConnection(), "aws_vpn_gateway": dataSourceAwsVpnGateway(), + "aws_waf_rule": dataSourceAwsWafRule(), "aws_workspaces_bundle": dataSourceAwsWorkspaceBundle(), // Adding the Aliases for the ALB -> LB Rename diff --git a/website/aws.erb b/website/aws.erb index 9f9b5088f4b3..27db8e404b13 100644 --- a/website/aws.erb +++ b/website/aws.erb @@ -451,6 +451,9 @@
  • aws_vpn_gateway
  • +
  • + aws_vpn_gateway +
  • aws_workspaces_bundle
  • diff --git a/website/docs/d/waf_rule.html.markdown b/website/docs/d/waf_rule.html.markdown new file mode 100644 index 000000000000..2d91ef1333a3 --- /dev/null +++ b/website/docs/d/waf_rule.html.markdown @@ -0,0 +1,31 @@ +--- +layout: "aws" +page_title: "AWS: aws_waf_rule" +sidebar_current: "docs-aws-datasource-waf-rule" +description: |- + Retrieves a AWS WAF rule id. +--- + +# Data Source: aws_waf_rule + +`aws_waf_rule` Retrieves a WAF Rule Resource Id. + +## Example Usage + +```hcl +data "aws_waf_rule" "example" { + name = "tfWAFRule" +} + +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name or description of the rule. + +## Attributes Reference +In addition to all arguments above, the following attributes are exported: + +* `id` - The WAF rule ID. From 229a0c5d833c5a5de0627b6d91bcbcb2599f7dd6 Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 11 Jul 2019 17:25:27 +0100 Subject: [PATCH 0185/1054] Added datasource aws_wafregional_rule --- aws/data_source_aws_wafregional_rule.go | 65 ++++++++++++++++++ aws/data_source_aws_wafregional_rule_test.go | 67 +++++++++++++++++++ aws/provider.go | 1 + website/aws.erb | 3 + website/docs/d/wafregional_rule.html.markdown | 30 +++++++++ 5 files changed, 166 insertions(+) create mode 100644 aws/data_source_aws_wafregional_rule.go create mode 100644 aws/data_source_aws_wafregional_rule_test.go create mode 100644 website/docs/d/wafregional_rule.html.markdown diff --git a/aws/data_source_aws_wafregional_rule.go b/aws/data_source_aws_wafregional_rule.go new file mode 100644 index 000000000000..4e3cb4e1fa08 --- /dev/null +++ b/aws/data_source_aws_wafregional_rule.go @@ -0,0 +1,65 @@ +package aws + +import ( + "fmt" + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/waf" + + "github.com/hashicorp/terraform/helper/schema" +) + +func dataSourceAwsWafRegionalRule() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAwsWafRegionalRuleRead, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataSourceAwsWafRegionalRuleRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).wafregionalconn + name := d.Get("name").(string) + + rules := make([]*waf.RuleSummary, 0) + // ListRulesInput does not have a name parameter for filtering + input := &waf.ListRulesInput{} + for { + output, err := conn.ListRules(input) + if err != nil { + return fmt.Errorf("error reading WAF Rule: %s", err) + } + for _, rule := range output.Rules { + if aws.StringValue(rule.Name) == name { + rules = append(rules, rule) + } + } + + if output.NextMarker == nil { + break + } + input.NextMarker = output.NextMarker + } + + if len(rules) == 0 { + return fmt.Errorf("WAF Rule not found for name: %s", name) + } + + if len(rules) > 1 { + return fmt.Errorf("multiple WAF Rules found for name: %s", name) + } + + rule := rules[0] + + d.SetId(aws.StringValue(rule.RuleId)) + + return nil +} diff --git a/aws/data_source_aws_wafregional_rule_test.go b/aws/data_source_aws_wafregional_rule_test.go new file mode 100644 index 000000000000..83fadd17b159 --- /dev/null +++ b/aws/data_source_aws_wafregional_rule_test.go @@ -0,0 +1,67 @@ +package aws + +import ( + "fmt" + "regexp" + "testing" + + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccDataSourceAwsWafRegionalRule_Basic(t *testing.T) { + name := "tf-acc-test" + resourceName := "aws_wafregional_rule.wafrule" + datasourceName := "data.aws_wafregional_rule.wafrule" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsWafRegionalRuleConfig_NonExistent, + ExpectError: regexp.MustCompile(`WAF Rule not found`), + }, + { + Config: testAccDataSourceAwsWafRegionalRuleConfig_Name(name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(datasourceName, "id", resourceName, "id"), + resource.TestCheckResourceAttrPair(datasourceName, "name", resourceName, "name"), + ), + }, + }, + }) +} + +func testAccDataSourceAwsWafRegionalRuleConfig_Name(name string) string { + return fmt.Sprintf(` +resource "aws_wafregional_rule" "wafrule" { + name = "%s" + metric_name = "WafruleTest" + + predicate { + data_id = "${aws_wafregional_ipset.test.id}" + negated = false + type = "IPMatch" + } +} + +resource "aws_wafregional_ipset" "test" { + name = "%s" + + ip_set_descriptor { + type = "IPV4" + value = "10.0.0.0/8" + } +} + +data "aws_wafregional_rule" "wafrule" { + name = "${aws_wafregional_rule.wafrule.name}" +} +`, name, name) +} + +const testAccDataSourceAwsWafRegionalRuleConfig_NonExistent = ` +data "aws_wafregional_rule" "wafrule" { + name = "tf-acc-test-does-not-exist" +} +` diff --git a/aws/provider.go b/aws/provider.go index 4d7c6f312ca6..ab60cbb848e2 100644 --- a/aws/provider.go +++ b/aws/provider.go @@ -272,6 +272,7 @@ func Provider() terraform.ResourceProvider { "aws_vpc_endpoint_service": dataSourceAwsVpcEndpointService(), "aws_vpc_peering_connection": dataSourceAwsVpcPeeringConnection(), "aws_vpn_gateway": dataSourceAwsVpnGateway(), + "aws_wafregional_rule": dataSourceAwsWafRegionalRule(), "aws_workspaces_bundle": dataSourceAwsWorkspaceBundle(), // Adding the Aliases for the ALB -> LB Rename diff --git a/website/aws.erb b/website/aws.erb index 9f9b5088f4b3..df79cbb6647d 100644 --- a/website/aws.erb +++ b/website/aws.erb @@ -451,6 +451,9 @@
  • aws_vpn_gateway
  • +
  • + aws_wafregional_rule +
  • aws_workspaces_bundle
  • diff --git a/website/docs/d/wafregional_rule.html.markdown b/website/docs/d/wafregional_rule.html.markdown new file mode 100644 index 000000000000..8a4c2c154cf8 --- /dev/null +++ b/website/docs/d/wafregional_rule.html.markdown @@ -0,0 +1,30 @@ +--- +layout: "aws" +page_title: "AWS: aws_wafregional_rule" +sidebar_current: "docs-aws-datasource-wafregional-rule" +description: |- + Retrieves an AWS WAF Regional rule id. +--- + +# Data Source: aws_waf_rule + +`aws_wafregional_rule` Retrieves a WAF Regional Rule Resource Id. + +## Example Usage + +```hcl +data "aws_wafregional_rule" "example" { + name = "tfWAFRule" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the WAF rule. + +## Attributes Reference +In addition to all arguments above, the following attributes are exported: + +* `id` - The WAF rule ID. From 574aeca739c01e487d4d6155f4477a7b69d82cdf Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 11 Jul 2019 17:32:03 +0100 Subject: [PATCH 0186/1054] Changed documentation --- website/docs/d/wafregional_rule.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/d/wafregional_rule.html.markdown b/website/docs/d/wafregional_rule.html.markdown index 8a4c2c154cf8..8d015fc54350 100644 --- a/website/docs/d/wafregional_rule.html.markdown +++ b/website/docs/d/wafregional_rule.html.markdown @@ -27,4 +27,4 @@ The following arguments are supported: ## Attributes Reference In addition to all arguments above, the following attributes are exported: -* `id` - The WAF rule ID. +* `id` - The ID of the WAF Regional rule. From d15a59046eadbc8b2d1b9dd5e52484ada3fd8886 Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 11 Jul 2019 17:35:33 +0100 Subject: [PATCH 0187/1054] Updated documentation --- website/docs/d/waf_rule.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/d/waf_rule.html.markdown b/website/docs/d/waf_rule.html.markdown index 2d91ef1333a3..56a425f68457 100644 --- a/website/docs/d/waf_rule.html.markdown +++ b/website/docs/d/waf_rule.html.markdown @@ -3,7 +3,7 @@ layout: "aws" page_title: "AWS: aws_waf_rule" sidebar_current: "docs-aws-datasource-waf-rule" description: |- - Retrieves a AWS WAF rule id. + Retrieves an AWS WAF rule id. --- # Data Source: aws_waf_rule @@ -28,4 +28,4 @@ The following arguments are supported: ## Attributes Reference In addition to all arguments above, the following attributes are exported: -* `id` - The WAF rule ID. +* `id` - The ID of the WAF rule. From 2cb78853463a091ac70722d98c94f956769f67a6 Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 11 Jul 2019 17:37:20 +0100 Subject: [PATCH 0188/1054] Correct name details in docs --- website/docs/d/waf_rule.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/d/waf_rule.html.markdown b/website/docs/d/waf_rule.html.markdown index 56a425f68457..05c1bf680d5c 100644 --- a/website/docs/d/waf_rule.html.markdown +++ b/website/docs/d/waf_rule.html.markdown @@ -23,7 +23,7 @@ data "aws_waf_rule" "example" { The following arguments are supported: -* `name` - (Required) The name or description of the rule. +* `name` - (Required) The name of the WAF Regional rule. ## Attributes Reference In addition to all arguments above, the following attributes are exported: From 016303107ea1c4705879744316aa667d3f793b83 Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 11 Jul 2019 17:38:36 +0100 Subject: [PATCH 0189/1054] Correct name details in docs --- website/docs/d/waf_rule.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/d/waf_rule.html.markdown b/website/docs/d/waf_rule.html.markdown index 05c1bf680d5c..0bb9a016e01d 100644 --- a/website/docs/d/waf_rule.html.markdown +++ b/website/docs/d/waf_rule.html.markdown @@ -23,7 +23,7 @@ data "aws_waf_rule" "example" { The following arguments are supported: -* `name` - (Required) The name of the WAF Regional rule. +* `name` - (Required) The name of the WAF rule. ## Attributes Reference In addition to all arguments above, the following attributes are exported: From b93a3397d57c7464b5d29eae08068326fc737a17 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Thu, 11 Jul 2019 15:36:08 -0400 Subject: [PATCH 0190/1054] Update CHANGELOG for #9313 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c5a88be2664..fa6ecf8867de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ FEATURES: * **New Resource:** `aws_directory_service_log_subscription` [GH-9261] ENHANCEMENTS: + * resource/aws_acmpca_certificate_authority: Support validation for `ROOT` certificate authority type [GH-9292] * resource/aws_appmesh_virtual_node: Add `aws_cloud_map` configuration block under `spec` and `service_discovery` [GH-9271] * resource/aws_appmesh_virtual_router: Add `tags` argument [GH-9249] @@ -19,6 +20,7 @@ ENHANCEMENTS: * resource/aws_lightsail_instance: Add `tags` argument [GH-9273] * resource/aws_organizations_account: Add `tags` argument [GH-9202] * resource/aws_service_discovery_service: Add `namespace_id` argument (Support HTTP namespaces) [GH-7341] +* resource/aws_ssm_document: Support resource import [GH-9313] * resource/aws_waf_rule_group: Support resource import [GH-9254] * resource/aws_wafregional_byte_match_set: Support resource import [GH-9258] * resource/aws_wafregional_rule: Support resource import [GH-9239] @@ -26,10 +28,12 @@ ENHANCEMENTS: * resource/aws_wafregional_web_acl: Support resource import [GH-9248] BUG FIXES: + * resource/aws_backup_selection: Retry creation for IAM eventual consistency error [GH-9298] * resource/aws_db_event_subscription: Prevent `Unable to find RDS Event Subscription` error during deletion and refresh [GH-9274] * resource/aws_iam_policy_attachment: Bypass `NoSuchEntity` error when detaching groups, roles, and users (support group, role (when `force_detach_policies` is enabled), and user renames (when `force_destroy` is enabled)) [GH-9278] * resource/aws_s3_bucket: Properly handle the creation of tags defined in `lifecycle_rule` when no prefix argument is specified [GH-7162] +* resource/aws_ssm_document: Ensure `content` attribute is always refreshed [GH-9313] * resource/aws_transfer_user: Final retry after timeout waiting for deletion of transfer user [GH-9241] * service/organizations: Automatically retry API calls on `ConcurrentModificationException` error [GH-9195] From 47c154113643028f8ad9dcf9d0f2e793f89746ce Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 11 Jul 2019 19:44:39 +0000 Subject: [PATCH 0191/1054] Update module aws/aws-sdk-go to v1.20.19 --- go.mod | 2 +- go.sum | 4 +- .../github.com/aws/aws-sdk-go/aws/csm/doc.go | 65 +- .../aws/aws-sdk-go/aws/csm/enable.go | 34 +- .../aws/aws-sdk-go/aws/csm/reporter.go | 25 +- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 3 + .../aws/aws-sdk-go/aws/request/request.go | 12 +- .../aws/aws-sdk-go/aws/session/credentials.go | 14 +- .../aws/aws-sdk-go/aws/session/env_config.go | 5 + .../aws/aws-sdk-go/aws/session/session.go | 33 +- .../aws-sdk-go/aws/session/shared_config.go | 8 +- .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../service/cloudwatchevents/api.go | 5302 +++++++++++++---- .../service/cloudwatchevents/doc.go | 22 +- .../service/cloudwatchevents/errors.go | 31 +- .../aws/aws-sdk-go/service/glacier/api.go | 462 +- .../aws/aws-sdk-go/service/glacier/doc.go | 34 +- .../aws/aws-sdk-go/service/glacier/errors.go | 4 +- .../aws/aws-sdk-go/service/kafka/api.go | 2 +- .../aws/aws-sdk-go/service/quicksight/api.go | 39 +- .../aws-sdk-go/service/servicecatalog/api.go | 213 + vendor/modules.txt | 2 +- 22 files changed, 4726 insertions(+), 1592 deletions(-) diff --git a/go.mod b/go.mod index bdcbe679b0c9..c16d2375148f 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/terraform-providers/terraform-provider-aws require ( - github.com/aws/aws-sdk-go v1.20.17 + github.com/aws/aws-sdk-go v1.20.19 github.com/beevik/etree v1.1.0 github.com/bflad/tfproviderlint v0.4.0 github.com/client9/misspell v0.3.4 diff --git a/go.sum b/go.sum index 010927236518..5130d6ac6e21 100644 --- a/go.sum +++ b/go.sum @@ -52,8 +52,8 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.16.36/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.20.17 h1:ZQ0cM9FpuufVDHlNViD8vD68IkEQL/VUOMwJPBqkaaM= -github.com/aws/aws-sdk-go v1.20.17/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.20.19 h1:RQDLGGlcffQzAceEXGdMu+uGGPGhNu+vNG3BrUZAMPI= +github.com/aws/aws-sdk-go v1.20.19/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs= github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A= diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go index 152d785b362b..25a66d1dda22 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go @@ -1,30 +1,61 @@ -// Package csm provides Client Side Monitoring (CSM) which enables sending metrics -// via UDP connection. Using the Start function will enable the reporting of -// metrics on a given port. If Start is called, with different parameters, again, -// a panic will occur. +// Package csm provides the Client Side Monitoring (CSM) client which enables +// sending metrics via UDP connection to the CSM agent. This package provides +// control options, and configuration for the CSM client. The client can be +// controlled manually, or automatically via the SDK's Session configuration. // -// Pause can be called to pause any metrics publishing on a given port. Sessions -// that have had their handlers modified via InjectHandlers may still be used. -// However, the handlers will act as a no-op meaning no metrics will be published. +// Enabling CSM client via SDK's Session configuration +// +// The CSM client can be enabled automatically via SDK's Session configuration. +// The SDK's session configuration enables the CSM client if the AWS_CSM_PORT +// environment variable is set to a non-empty value. +// +// The configuration options for the CSM client via the SDK's session +// configuration are: +// +// * AWS_CSM_PORT= +// The port number the CSM agent will receive metrics on. +// +// * AWS_CSM_HOST= +// The hostname, or IP address the CSM agent will receive metrics on. +// Without port number. +// +// Manually enabling the CSM client +// +// The CSM client can be started, paused, and resumed manually. The Start +// function will enable the CSM client to publish metrics to the CSM agent. It +// is safe to call Start concurrently, but if Start is called additional times +// with different ClientID or address it will panic. // -// Example: // r, err := csm.Start("clientID", ":31000") // if err != nil { // panic(fmt.Errorf("failed starting CSM: %v", err)) // } // +// When controlling the CSM client manually, you must also inject its request +// handlers into the SDK's Session configuration for the SDK's API clients to +// publish metrics. +// // sess, err := session.NewSession(&aws.Config{}) // if err != nil { // panic(fmt.Errorf("failed loading session: %v", err)) // } // +// // Add CSM client's metric publishing request handlers to the SDK's +// // Session Configuration. // r.InjectHandlers(&sess.Handlers) // -// client := s3.New(sess) -// resp, err := client.GetObject(&s3.GetObjectInput{ -// Bucket: aws.String("bucket"), -// Key: aws.String("key"), -// }) +// Controlling CSM client +// +// Once the CSM client has been enabled the Get function will return a Reporter +// value that you can use to pause and resume the metrics published to the CSM +// agent. If Get function is called before the reporter is enabled with the +// Start function or via SDK's Session configuration nil will be returned. +// +// The Pause method can be called to stop the CSM client publishing metrics to +// the CSM agent. The Continue method will resume metric publishing. +// +// // Get the CSM client Reporter. +// r := csm.Get() // // // Will pause monitoring // r.Pause() @@ -35,12 +66,4 @@ // // // Resume monitoring // r.Continue() -// -// Start returns a Reporter that is used to enable or disable monitoring. If -// access to the Reporter is required later, calling Get will return the Reporter -// singleton. -// -// Example: -// r := csm.Get() -// r.Continue() package csm diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go index 2f0c6eac9a80..4b19e2800e3c 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go @@ -2,6 +2,7 @@ package csm import ( "fmt" + "strings" "sync" ) @@ -9,19 +10,40 @@ var ( lock sync.Mutex ) -// Client side metric handler names const ( - APICallMetricHandlerName = "awscsm.SendAPICallMetric" - APICallAttemptMetricHandlerName = "awscsm.SendAPICallAttemptMetric" + // DefaultPort is used when no port is specified. + DefaultPort = "31000" + + // DefaultHost is the host that will be used when none is specified. + DefaultHost = "127.0.0.1" ) -// Start will start the a long running go routine to capture +// AddressWithDefaults returns a CSM address built from the host and port +// values. If the host or port is not set, default values will be used +// instead. If host is "localhost" it will be replaced with "127.0.0.1". +func AddressWithDefaults(host, port string) string { + if len(host) == 0 || strings.EqualFold(host, "localhost") { + host = DefaultHost + } + + if len(port) == 0 { + port = DefaultPort + } + + // Only IP6 host can contain a colon + if strings.Contains(host, ":") { + return "[" + host + "]:" + port + } + + return host + ":" + port +} + +// Start will start a long running go routine to capture // client side metrics. Calling start multiple time will only // start the metric listener once and will panic if a different // client ID or port is passed in. // -// Example: -// r, err := csm.Start("clientID", "127.0.0.1:8094") +// r, err := csm.Start("clientID", "127.0.0.1:31000") // if err != nil { // panic(fmt.Errorf("expected no error, but received %v", err)) // } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go index d9aa5b062a40..0d3684914d60 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go @@ -10,11 +10,6 @@ import ( "github.com/aws/aws-sdk-go/aws/request" ) -const ( - // DefaultPort is used when no port is specified - DefaultPort = "31000" -) - // Reporter will gather metrics of API requests made and // send those metrics to the CSM endpoint. type Reporter struct { @@ -190,8 +185,9 @@ func (rep *Reporter) start() { } } -// Pause will pause the metric channel preventing any new metrics from -// being added. +// Pause will pause the metric channel preventing any new metrics from being +// added. It is safe to call concurrently with other calls to Pause, but if +// called concurently with Continue can lead to unexpected state. func (rep *Reporter) Pause() { lock.Lock() defer lock.Unlock() @@ -203,8 +199,9 @@ func (rep *Reporter) Pause() { rep.close() } -// Continue will reopen the metric channel and allow for monitoring -// to be resumed. +// Continue will reopen the metric channel and allow for monitoring to be +// resumed. It is safe to call concurrently with other calls to Continue, but +// if called concurently with Pause can lead to unexpected state. func (rep *Reporter) Continue() { lock.Lock() defer lock.Unlock() @@ -219,10 +216,18 @@ func (rep *Reporter) Continue() { rep.metricsCh.Continue() } +// Client side metric handler names +const ( + APICallMetricHandlerName = "awscsm.SendAPICallMetric" + APICallAttemptMetricHandlerName = "awscsm.SendAPICallAttemptMetric" +) + // InjectHandlers will will enable client side metrics and inject the proper // handlers to handle how metrics are sent. // -// Example: +// InjectHandlers is NOT safe to call concurrently. Calling InjectHandlers +// multiple times may lead to unexpected behavior, (e.g. duplicate metrics). +// // // Start must be called in order to inject the correct handlers // r, err := csm.Start("clientID", "127.0.0.1:8094") // if err != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index d93f7b33c38d..371dfa6ff6e5 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -1631,6 +1631,7 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -1729,6 +1730,7 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "us-east-1": endpoint{}, @@ -1897,6 +1899,7 @@ var awsPartition = partition{ "license-manager": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go index 0c46b7d2c31f..2f0c4a90efd5 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "io" + "net" "net/http" "net/url" "reflect" @@ -484,7 +485,7 @@ func (r *Request) Send() error { if err := r.sendRequest(); err == nil { return nil - } else if !shouldRetryCancel(r.Error) { + } else if !shouldRetryError(r.Error) { return err } else { r.Handlers.Retry.Run(r) @@ -576,13 +577,13 @@ type temporary interface { Temporary() bool } -func shouldRetryCancel(origErr error) bool { +func shouldRetryError(origErr error) bool { switch err := origErr.(type) { case awserr.Error: if err.Code() == CanceledErrorCode { return false } - return shouldRetryCancel(err.OrigErr()) + return shouldRetryError(err.OrigErr()) case *url.Error: if strings.Contains(err.Error(), "connection refused") { // Refused connections should be retried as the service may not yet @@ -592,8 +593,11 @@ func shouldRetryCancel(origErr error) bool { } // *url.Error only implements Temporary after golang 1.6 but since // url.Error only wraps the error: - return shouldRetryCancel(err.Err) + return shouldRetryError(err.Err) case temporary: + if netErr, ok := err.(*net.OpError); ok && netErr.Op == "dial" { + return true + } // If the error is temporary, we want to allow continuation of the // retry process return err.Temporary() || isErrConnectionReset(origErr) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go b/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go index 0c9dcf7c890c..9fd663681735 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go @@ -64,11 +64,15 @@ func resolveCredsFromProfile(cfg *aws.Config, ), nil } else if len(sharedCfg.CredentialProcess) > 0 { - // Credential Process credentials from Shared Config/Credentials file. - return processcreds.NewCredentials( - sharedCfg.CredentialProcess, - ), nil - + // Get credentials from CredentialProcess + cred := processcreds.NewCredentials(sharedCfg.CredentialProcess) + // if RoleARN is provided, so the obtained cred from the Credential Process to assume the role using RoleARN + if len(sharedCfg.AssumeRole.RoleARN) > 0 { + cfgCp := *cfg + cfgCp.Credentials = cred + return credsFromAssumeRole(cfgCp, handlers, sharedCfg, sessOpts) + } + return cred, nil } else if envCfg.EnableSharedConfig && len(sharedCfg.AssumeRole.CredentialSource) > 0 { // Assume IAM Role with specific credential source. return resolveCredsFromSource(cfg, envCfg, sharedCfg, handlers, sessOpts) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go index e3959b959ef9..cdb42497e76f 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go @@ -102,6 +102,7 @@ type envConfig struct { CSMEnabled bool CSMPort string CSMClientID string + CSMHost string enableEndpointDiscovery string // Enables endpoint discovery via environment variables. @@ -114,6 +115,9 @@ var ( csmEnabledEnvKey = []string{ "AWS_CSM_ENABLED", } + csmHostEnvKey = []string{ + "AWS_CSM_HOST", + } csmPortEnvKey = []string{ "AWS_CSM_PORT", } @@ -184,6 +188,7 @@ func envConfigLoad(enableSharedConfig bool) envConfig { // CSM environment variables setFromEnvVal(&cfg.csmEnabled, csmEnabledEnvKey) + setFromEnvVal(&cfg.CSMHost, csmHostEnvKey) setFromEnvVal(&cfg.CSMPort, csmPortEnvKey) setFromEnvVal(&cfg.CSMClientID, csmClientIDEnvKey) cfg.CSMEnabled = len(cfg.csmEnabled) > 0 diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go index 84b01f0e785a..5da98abe750d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go @@ -3,6 +3,7 @@ package session import ( "crypto/tls" "crypto/x509" + "fmt" "io" "io/ioutil" "net/http" @@ -104,7 +105,15 @@ func New(cfgs ...*aws.Config) *Session { s := deprecatedNewSession(cfgs...) if envCfg.CSMEnabled { - enableCSM(&s.Handlers, envCfg.CSMClientID, envCfg.CSMPort, s.Config.Logger) + err := enableCSM(&s.Handlers, envCfg.CSMClientID, + envCfg.CSMHost, envCfg.CSMPort, s.Config.Logger) + if err != nil { + err = fmt.Errorf("failed to enable CSM, %v", err) + s.Config.Logger.Log("ERROR:", err.Error()) + s.Handlers.Validate.PushBack(func(r *request.Request) { + r.Error = err + }) + } } return s @@ -338,17 +347,21 @@ func deprecatedNewSession(cfgs ...*aws.Config) *Session { return s } -func enableCSM(handlers *request.Handlers, clientID string, port string, logger aws.Logger) { - logger.Log("Enabling CSM") - if len(port) == 0 { - port = csm.DefaultPort +func enableCSM(handlers *request.Handlers, + clientID, host, port string, + logger aws.Logger, +) error { + if logger != nil { + logger.Log("Enabling CSM") } - r, err := csm.Start(clientID, "127.0.0.1:"+port) + r, err := csm.Start(clientID, csm.AddressWithDefaults(host, port)) if err != nil { - return + return err } r.InjectHandlers(handlers) + + return nil } func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { @@ -395,7 +408,11 @@ func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, initHandlers(s) if envCfg.CSMEnabled { - enableCSM(&s.Handlers, envCfg.CSMClientID, envCfg.CSMPort, s.Config.Logger) + err := enableCSM(&s.Handlers, envCfg.CSMClientID, + envCfg.CSMHost, envCfg.CSMPort, s.Config.Logger) + if err != nil { + return nil, err + } } // Setup HTTP client with custom cert bundle if enabled diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go index e0102363ddd5..324927f56aaf 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go @@ -5,7 +5,6 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/internal/ini" ) @@ -167,7 +166,8 @@ func (cfg *sharedConfig) setAssumeRoleSource(origProfile string, files []sharedC } if cfg.AssumeRole.SourceProfile == origProfile || len(assumeRoleSrc.AssumeRole.SourceProfile) == 0 { - if len(assumeRoleSrc.AssumeRole.CredentialSource) == 0 && len(assumeRoleSrc.Creds.AccessKeyID) == 0 { + //Check if at least either Credential Source, static creds, or credential process is set to retain credentials. + if len(assumeRoleSrc.AssumeRole.CredentialSource) == 0 && len(assumeRoleSrc.Creds.AccessKeyID) == 0 && len(assumeRoleSrc.CredentialProcess) == 0 { return SharedConfigAssumeRoleError{RoleARN: cfg.AssumeRole.RoleARN} } } @@ -226,7 +226,9 @@ func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile) e roleArn := section.String(roleArnKey) srcProfile := section.String(sourceProfileKey) credentialSource := section.String(credentialSourceKey) - hasSource := len(srcProfile) > 0 || len(credentialSource) > 0 + credentialProcess := section.String(credentialProcessKey) + //Has source to make sure the Assume Role has at least either srcProfile, credential Source, or credential Process. + hasSource := len(srcProfile) > 0 || len(credentialSource) > 0 || len(credentialProcess) > 0 if len(roleArn) > 0 && hasSource { cfg.AssumeRole = assumeRoleConfig{ RoleARN: roleArn, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index f6e9f55e8dec..e5e93a8bb640 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.20.17" +const SDKVersion = "1.20.19" diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/api.go b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/api.go index c439aef2961b..99b12487c2ba 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/api.go @@ -13,1853 +13,3961 @@ import ( "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" ) -const opDeleteRule = "DeleteRule" +const opActivateEventSource = "ActivateEventSource" -// DeleteRuleRequest generates a "aws/request.Request" representing the -// client's request for the DeleteRule operation. The "output" return +// ActivateEventSourceRequest generates a "aws/request.Request" representing the +// client's request for the ActivateEventSource operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See DeleteRule for more information on using the DeleteRule +// See ActivateEventSource for more information on using the ActivateEventSource // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the DeleteRuleRequest method. -// req, resp := client.DeleteRuleRequest(params) +// // Example sending a request using the ActivateEventSourceRequest method. +// req, resp := client.ActivateEventSourceRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DeleteRule -func (c *CloudWatchEvents) DeleteRuleRequest(input *DeleteRuleInput) (req *request.Request, output *DeleteRuleOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ActivateEventSource +func (c *CloudWatchEvents) ActivateEventSourceRequest(input *ActivateEventSourceInput) (req *request.Request, output *ActivateEventSourceOutput) { op := &request.Operation{ - Name: opDeleteRule, + Name: opActivateEventSource, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &DeleteRuleInput{} + input = &ActivateEventSourceInput{} } - output = &DeleteRuleOutput{} + output = &ActivateEventSourceOutput{} req = c.newRequest(op, input, output) req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } -// DeleteRule API operation for Amazon CloudWatch Events. -// -// Deletes the specified rule. -// -// Before you can delete the rule, you must remove all targets, using RemoveTargets. +// ActivateEventSource API operation for Amazon CloudWatch Events. // -// When you delete a rule, incoming events might continue to match to the deleted -// rule. Allow a short period of time for changes to take effect. +// Activates a partner event source that has been deactivated. Once activated, +// your matching event bus will start receiving events from the event source. // -// Managed rules are rules created and managed by another AWS service on your -// behalf. These rules are created by those other AWS services to support functionality -// in those services. You can delete these rules using the Force option, but -// you should do so only if you are sure the other service is not still using -// that rule. +// This operation is performed by AWS customers, not by SaaS partners. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation DeleteRule for usage and error information. +// API operation ActivateEventSource for usage and error information. // // Returned Error Codes: -// * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// There is concurrent modification on a rule or target. +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. // -// * ErrCodeManagedRuleException "ManagedRuleException" -// This rule was created by an AWS service on behalf of your account. It is -// managed by that service. If you see this error in response to DeleteRule -// or RemoveTargets, you can use the Force parameter in those calls to delete -// the rule or remove targets from the rule. You cannot modify these managed -// rules by using DisableRule, EnableRule, PutTargets, PutRule, TagResource, -// or UntagResource. +// * ErrCodeInvalidStateException "InvalidStateException" +// The specified state isn't a valid state for an event source. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DeleteRule -func (c *CloudWatchEvents) DeleteRule(input *DeleteRuleInput) (*DeleteRuleOutput, error) { - req, out := c.DeleteRuleRequest(input) +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ActivateEventSource +func (c *CloudWatchEvents) ActivateEventSource(input *ActivateEventSourceInput) (*ActivateEventSourceOutput, error) { + req, out := c.ActivateEventSourceRequest(input) return out, req.Send() } -// DeleteRuleWithContext is the same as DeleteRule with the addition of +// ActivateEventSourceWithContext is the same as ActivateEventSource with the addition of // the ability to pass a context and additional request options. // -// See DeleteRule for details on how to use this API operation. +// See ActivateEventSource for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) DeleteRuleWithContext(ctx aws.Context, input *DeleteRuleInput, opts ...request.Option) (*DeleteRuleOutput, error) { - req, out := c.DeleteRuleRequest(input) +func (c *CloudWatchEvents) ActivateEventSourceWithContext(ctx aws.Context, input *ActivateEventSourceInput, opts ...request.Option) (*ActivateEventSourceOutput, error) { + req, out := c.ActivateEventSourceRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opDescribeEventBus = "DescribeEventBus" +const opCreateEventBus = "CreateEventBus" -// DescribeEventBusRequest generates a "aws/request.Request" representing the -// client's request for the DescribeEventBus operation. The "output" return +// CreateEventBusRequest generates a "aws/request.Request" representing the +// client's request for the CreateEventBus operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See DescribeEventBus for more information on using the DescribeEventBus +// See CreateEventBus for more information on using the CreateEventBus // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the DescribeEventBusRequest method. -// req, resp := client.DescribeEventBusRequest(params) +// // Example sending a request using the CreateEventBusRequest method. +// req, resp := client.CreateEventBusRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeEventBus -func (c *CloudWatchEvents) DescribeEventBusRequest(input *DescribeEventBusInput) (req *request.Request, output *DescribeEventBusOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/CreateEventBus +func (c *CloudWatchEvents) CreateEventBusRequest(input *CreateEventBusInput) (req *request.Request, output *CreateEventBusOutput) { op := &request.Operation{ - Name: opDescribeEventBus, + Name: opCreateEventBus, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &DescribeEventBusInput{} + input = &CreateEventBusInput{} } - output = &DescribeEventBusOutput{} + output = &CreateEventBusOutput{} req = c.newRequest(op, input, output) return } -// DescribeEventBus API operation for Amazon CloudWatch Events. +// CreateEventBus API operation for Amazon CloudWatch Events. +// +// Creates a new event bus within your account. This can be a custom event bus +// which you can use to receive events from your own custom applications and +// services, or it can be a partner event bus which can be matched to a partner +// event source. // -// Displays the external AWS accounts that are permitted to write events to -// your account using your account's event bus, and the associated policy. To -// enable your account to receive events from other accounts, use PutPermission. +// This operation is used by AWS customers, not by SaaS partners. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation DescribeEventBus for usage and error information. +// API operation CreateEventBus for usage and error information. // // Returned Error Codes: +// * ErrCodeResourceAlreadyExistsException "ResourceAlreadyExistsException" +// The resource that you're trying to create already exists. +// // * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// An entity that you specified does not exist. +// An entity that you specified doesn't exist. +// +// * ErrCodeInvalidStateException "InvalidStateException" +// The specified state isn't a valid state for an event source. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeEventBus -func (c *CloudWatchEvents) DescribeEventBus(input *DescribeEventBusInput) (*DescribeEventBusOutput, error) { - req, out := c.DescribeEventBusRequest(input) +// * ErrCodeConcurrentModificationException "ConcurrentModificationException" +// There is concurrent modification on a resource. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// You tried to create more resources than is allowed. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/CreateEventBus +func (c *CloudWatchEvents) CreateEventBus(input *CreateEventBusInput) (*CreateEventBusOutput, error) { + req, out := c.CreateEventBusRequest(input) return out, req.Send() } -// DescribeEventBusWithContext is the same as DescribeEventBus with the addition of +// CreateEventBusWithContext is the same as CreateEventBus with the addition of // the ability to pass a context and additional request options. // -// See DescribeEventBus for details on how to use this API operation. +// See CreateEventBus for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) DescribeEventBusWithContext(ctx aws.Context, input *DescribeEventBusInput, opts ...request.Option) (*DescribeEventBusOutput, error) { - req, out := c.DescribeEventBusRequest(input) +func (c *CloudWatchEvents) CreateEventBusWithContext(ctx aws.Context, input *CreateEventBusInput, opts ...request.Option) (*CreateEventBusOutput, error) { + req, out := c.CreateEventBusRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opDescribeRule = "DescribeRule" +const opCreatePartnerEventSource = "CreatePartnerEventSource" -// DescribeRuleRequest generates a "aws/request.Request" representing the -// client's request for the DescribeRule operation. The "output" return +// CreatePartnerEventSourceRequest generates a "aws/request.Request" representing the +// client's request for the CreatePartnerEventSource operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See DescribeRule for more information on using the DescribeRule +// See CreatePartnerEventSource for more information on using the CreatePartnerEventSource // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the DescribeRuleRequest method. -// req, resp := client.DescribeRuleRequest(params) +// // Example sending a request using the CreatePartnerEventSourceRequest method. +// req, resp := client.CreatePartnerEventSourceRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeRule -func (c *CloudWatchEvents) DescribeRuleRequest(input *DescribeRuleInput) (req *request.Request, output *DescribeRuleOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/CreatePartnerEventSource +func (c *CloudWatchEvents) CreatePartnerEventSourceRequest(input *CreatePartnerEventSourceInput) (req *request.Request, output *CreatePartnerEventSourceOutput) { op := &request.Operation{ - Name: opDescribeRule, + Name: opCreatePartnerEventSource, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &DescribeRuleInput{} + input = &CreatePartnerEventSourceInput{} } - output = &DescribeRuleOutput{} + output = &CreatePartnerEventSourceOutput{} req = c.newRequest(op, input, output) return } -// DescribeRule API operation for Amazon CloudWatch Events. +// CreatePartnerEventSource API operation for Amazon CloudWatch Events. // -// Describes the specified rule. +// Called by an SaaS partner to create a partner event source. // -// DescribeRule does not list the targets of a rule. To see the targets associated -// with a rule, use ListTargetsByRule. +// This operation is not used by AWS customers. +// +// Each partner event source can be used by one AWS account to create a matching +// partner event bus in that AWS account. A SaaS partner must create one partner +// event source for each AWS account that wants to receive those event types. +// +// A partner event source creates events based on resources in the SaaS partner's +// service or application. +// +// An AWS account that creates a partner event bus that matches the partner +// event source can use that event bus to receive events from the partner, and +// then process them using AWS Events rules and targets. +// +// Partner event source names follow this format: +// +// aws.partner/partner_name/event_namespace/event_name +// +// * partner_name is determined during partner registration and identifies +// the partner to AWS customers. +// +// * For event_namespace, we recommend that partners use a string that identifies +// the AWS customer within the partner's system. This should not be the customer's +// AWS account ID. +// +// * event_name is determined by the partner, and should uniquely identify +// an event-generating resource within the partner system. This should help +// AWS customers decide whether to create an event bus to receive these events. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation DescribeRule for usage and error information. +// API operation CreatePartnerEventSource for usage and error information. // // Returned Error Codes: -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// An entity that you specified does not exist. +// * ErrCodeResourceAlreadyExistsException "ResourceAlreadyExistsException" +// The resource that you're trying to create already exists. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeRule -func (c *CloudWatchEvents) DescribeRule(input *DescribeRuleInput) (*DescribeRuleOutput, error) { - req, out := c.DescribeRuleRequest(input) +// * ErrCodeConcurrentModificationException "ConcurrentModificationException" +// There is concurrent modification on a resource. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// You tried to create more resources than is allowed. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/CreatePartnerEventSource +func (c *CloudWatchEvents) CreatePartnerEventSource(input *CreatePartnerEventSourceInput) (*CreatePartnerEventSourceOutput, error) { + req, out := c.CreatePartnerEventSourceRequest(input) return out, req.Send() } -// DescribeRuleWithContext is the same as DescribeRule with the addition of +// CreatePartnerEventSourceWithContext is the same as CreatePartnerEventSource with the addition of // the ability to pass a context and additional request options. // -// See DescribeRule for details on how to use this API operation. +// See CreatePartnerEventSource for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) DescribeRuleWithContext(ctx aws.Context, input *DescribeRuleInput, opts ...request.Option) (*DescribeRuleOutput, error) { - req, out := c.DescribeRuleRequest(input) +func (c *CloudWatchEvents) CreatePartnerEventSourceWithContext(ctx aws.Context, input *CreatePartnerEventSourceInput, opts ...request.Option) (*CreatePartnerEventSourceOutput, error) { + req, out := c.CreatePartnerEventSourceRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opDisableRule = "DisableRule" +const opDeactivateEventSource = "DeactivateEventSource" -// DisableRuleRequest generates a "aws/request.Request" representing the -// client's request for the DisableRule operation. The "output" return +// DeactivateEventSourceRequest generates a "aws/request.Request" representing the +// client's request for the DeactivateEventSource operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See DisableRule for more information on using the DisableRule +// See DeactivateEventSource for more information on using the DeactivateEventSource // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the DisableRuleRequest method. -// req, resp := client.DisableRuleRequest(params) +// // Example sending a request using the DeactivateEventSourceRequest method. +// req, resp := client.DeactivateEventSourceRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DisableRule -func (c *CloudWatchEvents) DisableRuleRequest(input *DisableRuleInput) (req *request.Request, output *DisableRuleOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DeactivateEventSource +func (c *CloudWatchEvents) DeactivateEventSourceRequest(input *DeactivateEventSourceInput) (req *request.Request, output *DeactivateEventSourceOutput) { op := &request.Operation{ - Name: opDisableRule, + Name: opDeactivateEventSource, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &DisableRuleInput{} + input = &DeactivateEventSourceInput{} } - output = &DisableRuleOutput{} + output = &DeactivateEventSourceOutput{} req = c.newRequest(op, input, output) req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } -// DisableRule API operation for Amazon CloudWatch Events. +// DeactivateEventSource API operation for Amazon CloudWatch Events. // -// Disables the specified rule. A disabled rule won't match any events, and -// won't self-trigger if it has a schedule expression. +// An AWS customer uses this operation to temporarily stop receiving events +// from the specified partner event source. The matching event bus isn't deleted. // -// When you disable a rule, incoming events might continue to match to the disabled -// rule. Allow a short period of time for changes to take effect. +// When you deactivate a partner event source, the source goes into PENDING +// state. If it remains in PENDING state for more than two weeks, it's deleted. +// +// To activate a deactivated partner event source, use ActivateEventSource. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation DisableRule for usage and error information. +// API operation DeactivateEventSource for usage and error information. // // Returned Error Codes: // * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// An entity that you specified does not exist. -// -// * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// There is concurrent modification on a rule or target. +// An entity that you specified doesn't exist. // -// * ErrCodeManagedRuleException "ManagedRuleException" -// This rule was created by an AWS service on behalf of your account. It is -// managed by that service. If you see this error in response to DeleteRule -// or RemoveTargets, you can use the Force parameter in those calls to delete -// the rule or remove targets from the rule. You cannot modify these managed -// rules by using DisableRule, EnableRule, PutTargets, PutRule, TagResource, -// or UntagResource. +// * ErrCodeInvalidStateException "InvalidStateException" +// The specified state isn't a valid state for an event source. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DisableRule -func (c *CloudWatchEvents) DisableRule(input *DisableRuleInput) (*DisableRuleOutput, error) { - req, out := c.DisableRuleRequest(input) +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DeactivateEventSource +func (c *CloudWatchEvents) DeactivateEventSource(input *DeactivateEventSourceInput) (*DeactivateEventSourceOutput, error) { + req, out := c.DeactivateEventSourceRequest(input) return out, req.Send() } -// DisableRuleWithContext is the same as DisableRule with the addition of +// DeactivateEventSourceWithContext is the same as DeactivateEventSource with the addition of // the ability to pass a context and additional request options. // -// See DisableRule for details on how to use this API operation. +// See DeactivateEventSource for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) DisableRuleWithContext(ctx aws.Context, input *DisableRuleInput, opts ...request.Option) (*DisableRuleOutput, error) { - req, out := c.DisableRuleRequest(input) +func (c *CloudWatchEvents) DeactivateEventSourceWithContext(ctx aws.Context, input *DeactivateEventSourceInput, opts ...request.Option) (*DeactivateEventSourceOutput, error) { + req, out := c.DeactivateEventSourceRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opEnableRule = "EnableRule" +const opDeleteEventBus = "DeleteEventBus" -// EnableRuleRequest generates a "aws/request.Request" representing the -// client's request for the EnableRule operation. The "output" return +// DeleteEventBusRequest generates a "aws/request.Request" representing the +// client's request for the DeleteEventBus operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See EnableRule for more information on using the EnableRule +// See DeleteEventBus for more information on using the DeleteEventBus // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the EnableRuleRequest method. -// req, resp := client.EnableRuleRequest(params) +// // Example sending a request using the DeleteEventBusRequest method. +// req, resp := client.DeleteEventBusRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/EnableRule -func (c *CloudWatchEvents) EnableRuleRequest(input *EnableRuleInput) (req *request.Request, output *EnableRuleOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DeleteEventBus +func (c *CloudWatchEvents) DeleteEventBusRequest(input *DeleteEventBusInput) (req *request.Request, output *DeleteEventBusOutput) { op := &request.Operation{ - Name: opEnableRule, + Name: opDeleteEventBus, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &EnableRuleInput{} + input = &DeleteEventBusInput{} } - output = &EnableRuleOutput{} + output = &DeleteEventBusOutput{} req = c.newRequest(op, input, output) req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } -// EnableRule API operation for Amazon CloudWatch Events. +// DeleteEventBus API operation for Amazon CloudWatch Events. // -// Enables the specified rule. If the rule does not exist, the operation fails. +// Deletes the specified custom event bus or partner event bus. All rules associated +// with this event bus are also deleted. You can't delete your account's default +// event bus. // -// When you enable a rule, incoming events might not immediately start matching -// to a newly enabled rule. Allow a short period of time for changes to take -// effect. +// This operation is performed by AWS customers, not by SaaS partners. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation EnableRule for usage and error information. +// API operation DeleteEventBus for usage and error information. // // Returned Error Codes: -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// An entity that you specified does not exist. -// -// * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// There is concurrent modification on a rule or target. -// -// * ErrCodeManagedRuleException "ManagedRuleException" -// This rule was created by an AWS service on behalf of your account. It is -// managed by that service. If you see this error in response to DeleteRule -// or RemoveTargets, you can use the Force parameter in those calls to delete -// the rule or remove targets from the rule. You cannot modify these managed -// rules by using DisableRule, EnableRule, PutTargets, PutRule, TagResource, -// or UntagResource. -// // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/EnableRule -func (c *CloudWatchEvents) EnableRule(input *EnableRuleInput) (*EnableRuleOutput, error) { - req, out := c.EnableRuleRequest(input) +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DeleteEventBus +func (c *CloudWatchEvents) DeleteEventBus(input *DeleteEventBusInput) (*DeleteEventBusOutput, error) { + req, out := c.DeleteEventBusRequest(input) return out, req.Send() } -// EnableRuleWithContext is the same as EnableRule with the addition of +// DeleteEventBusWithContext is the same as DeleteEventBus with the addition of // the ability to pass a context and additional request options. // -// See EnableRule for details on how to use this API operation. +// See DeleteEventBus for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) EnableRuleWithContext(ctx aws.Context, input *EnableRuleInput, opts ...request.Option) (*EnableRuleOutput, error) { - req, out := c.EnableRuleRequest(input) +func (c *CloudWatchEvents) DeleteEventBusWithContext(ctx aws.Context, input *DeleteEventBusInput, opts ...request.Option) (*DeleteEventBusOutput, error) { + req, out := c.DeleteEventBusRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opListRuleNamesByTarget = "ListRuleNamesByTarget" +const opDeletePartnerEventSource = "DeletePartnerEventSource" -// ListRuleNamesByTargetRequest generates a "aws/request.Request" representing the -// client's request for the ListRuleNamesByTarget operation. The "output" return +// DeletePartnerEventSourceRequest generates a "aws/request.Request" representing the +// client's request for the DeletePartnerEventSource operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See ListRuleNamesByTarget for more information on using the ListRuleNamesByTarget +// See DeletePartnerEventSource for more information on using the DeletePartnerEventSource // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the ListRuleNamesByTargetRequest method. -// req, resp := client.ListRuleNamesByTargetRequest(params) +// // Example sending a request using the DeletePartnerEventSourceRequest method. +// req, resp := client.DeletePartnerEventSourceRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRuleNamesByTarget -func (c *CloudWatchEvents) ListRuleNamesByTargetRequest(input *ListRuleNamesByTargetInput) (req *request.Request, output *ListRuleNamesByTargetOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DeletePartnerEventSource +func (c *CloudWatchEvents) DeletePartnerEventSourceRequest(input *DeletePartnerEventSourceInput) (req *request.Request, output *DeletePartnerEventSourceOutput) { op := &request.Operation{ - Name: opListRuleNamesByTarget, + Name: opDeletePartnerEventSource, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &ListRuleNamesByTargetInput{} + input = &DeletePartnerEventSourceInput{} } - output = &ListRuleNamesByTargetOutput{} + output = &DeletePartnerEventSourceOutput{} req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } -// ListRuleNamesByTarget API operation for Amazon CloudWatch Events. +// DeletePartnerEventSource API operation for Amazon CloudWatch Events. +// +// This operation is used by SaaS partners to delete a partner event source. +// AWS customers don't use this operation. // -// Lists the rules for the specified target. You can see which of the rules -// in Amazon CloudWatch Events can invoke a specific target in your account. +// When you delete an event source, the status of the corresponding partner +// event bus in the AWS customer account becomes DELETED. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation ListRuleNamesByTarget for usage and error information. +// API operation DeletePartnerEventSource for usage and error information. // // Returned Error Codes: // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRuleNamesByTarget -func (c *CloudWatchEvents) ListRuleNamesByTarget(input *ListRuleNamesByTargetInput) (*ListRuleNamesByTargetOutput, error) { - req, out := c.ListRuleNamesByTargetRequest(input) +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DeletePartnerEventSource +func (c *CloudWatchEvents) DeletePartnerEventSource(input *DeletePartnerEventSourceInput) (*DeletePartnerEventSourceOutput, error) { + req, out := c.DeletePartnerEventSourceRequest(input) return out, req.Send() } -// ListRuleNamesByTargetWithContext is the same as ListRuleNamesByTarget with the addition of +// DeletePartnerEventSourceWithContext is the same as DeletePartnerEventSource with the addition of // the ability to pass a context and additional request options. // -// See ListRuleNamesByTarget for details on how to use this API operation. +// See DeletePartnerEventSource for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) ListRuleNamesByTargetWithContext(ctx aws.Context, input *ListRuleNamesByTargetInput, opts ...request.Option) (*ListRuleNamesByTargetOutput, error) { - req, out := c.ListRuleNamesByTargetRequest(input) +func (c *CloudWatchEvents) DeletePartnerEventSourceWithContext(ctx aws.Context, input *DeletePartnerEventSourceInput, opts ...request.Option) (*DeletePartnerEventSourceOutput, error) { + req, out := c.DeletePartnerEventSourceRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opListRules = "ListRules" +const opDeleteRule = "DeleteRule" -// ListRulesRequest generates a "aws/request.Request" representing the -// client's request for the ListRules operation. The "output" return +// DeleteRuleRequest generates a "aws/request.Request" representing the +// client's request for the DeleteRule operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See ListRules for more information on using the ListRules +// See DeleteRule for more information on using the DeleteRule // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the ListRulesRequest method. -// req, resp := client.ListRulesRequest(params) +// // Example sending a request using the DeleteRuleRequest method. +// req, resp := client.DeleteRuleRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRules -func (c *CloudWatchEvents) ListRulesRequest(input *ListRulesInput) (req *request.Request, output *ListRulesOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DeleteRule +func (c *CloudWatchEvents) DeleteRuleRequest(input *DeleteRuleInput) (req *request.Request, output *DeleteRuleOutput) { op := &request.Operation{ - Name: opListRules, + Name: opDeleteRule, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &ListRulesInput{} + input = &DeleteRuleInput{} } - output = &ListRulesOutput{} + output = &DeleteRuleOutput{} req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } -// ListRules API operation for Amazon CloudWatch Events. +// DeleteRule API operation for Amazon CloudWatch Events. // -// Lists your Amazon CloudWatch Events rules. You can either list all the rules -// or you can provide a prefix to match to the rule names. +// Deletes the specified rule. // -// ListRules does not list the targets of a rule. To see the targets associated -// with a rule, use ListTargetsByRule. +// Before you can delete the rule, you must remove all targets, using RemoveTargets. +// +// When you delete a rule, incoming events might continue to match to the deleted +// rule. Allow a short period of time for changes to take effect. +// +// Managed rules are rules created and managed by another AWS service on your +// behalf. These rules are created by those other AWS services to support functionality +// in those services. You can delete these rules using the Force option, but +// you should do so only if you're sure that the other service isn't still using +// that rule. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation ListRules for usage and error information. +// API operation DeleteRule for usage and error information. // // Returned Error Codes: +// * ErrCodeConcurrentModificationException "ConcurrentModificationException" +// There is concurrent modification on a resource. +// +// * ErrCodeManagedRuleException "ManagedRuleException" +// An AWS service created this rule on behalf of your account. That service +// manages it. If you see this error in response to DeleteRule or RemoveTargets, +// you can use the Force parameter in those calls to delete the rule or remove +// targets from the rule. You can't modify these managed rules by using DisableRule, +// EnableRule, PutTargets, PutRule, TagResource, or UntagResource. +// // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRules -func (c *CloudWatchEvents) ListRules(input *ListRulesInput) (*ListRulesOutput, error) { - req, out := c.ListRulesRequest(input) +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DeleteRule +func (c *CloudWatchEvents) DeleteRule(input *DeleteRuleInput) (*DeleteRuleOutput, error) { + req, out := c.DeleteRuleRequest(input) return out, req.Send() } -// ListRulesWithContext is the same as ListRules with the addition of +// DeleteRuleWithContext is the same as DeleteRule with the addition of // the ability to pass a context and additional request options. // -// See ListRules for details on how to use this API operation. +// See DeleteRule for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) ListRulesWithContext(ctx aws.Context, input *ListRulesInput, opts ...request.Option) (*ListRulesOutput, error) { - req, out := c.ListRulesRequest(input) +func (c *CloudWatchEvents) DeleteRuleWithContext(ctx aws.Context, input *DeleteRuleInput, opts ...request.Option) (*DeleteRuleOutput, error) { + req, out := c.DeleteRuleRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opListTagsForResource = "ListTagsForResource" +const opDescribeEventBus = "DescribeEventBus" -// ListTagsForResourceRequest generates a "aws/request.Request" representing the -// client's request for the ListTagsForResource operation. The "output" return +// DescribeEventBusRequest generates a "aws/request.Request" representing the +// client's request for the DescribeEventBus operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See ListTagsForResource for more information on using the ListTagsForResource +// See DescribeEventBus for more information on using the DescribeEventBus // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the ListTagsForResourceRequest method. -// req, resp := client.ListTagsForResourceRequest(params) +// // Example sending a request using the DescribeEventBusRequest method. +// req, resp := client.DescribeEventBusRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListTagsForResource -func (c *CloudWatchEvents) ListTagsForResourceRequest(input *ListTagsForResourceInput) (req *request.Request, output *ListTagsForResourceOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeEventBus +func (c *CloudWatchEvents) DescribeEventBusRequest(input *DescribeEventBusInput) (req *request.Request, output *DescribeEventBusOutput) { op := &request.Operation{ - Name: opListTagsForResource, + Name: opDescribeEventBus, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &ListTagsForResourceInput{} + input = &DescribeEventBusInput{} } - output = &ListTagsForResourceOutput{} + output = &DescribeEventBusOutput{} req = c.newRequest(op, input, output) return } -// ListTagsForResource API operation for Amazon CloudWatch Events. +// DescribeEventBus API operation for Amazon CloudWatch Events. +// +// Displays details about an event bus in your account. This can include the +// external AWS accounts that are permitted to write events to your default +// event bus, and the associated policy. For custom event buses and partner +// event buses, it displays the name, ARN, policy, state, and creation time. +// +// To enable your account to receive events from other accounts on its default +// event bus, use PutPermission. // -// Displays the tags associated with a CloudWatch Events resource. In CloudWatch -// Events, rules can be tagged. +// For more information about partner event buses, see CreateEventBus. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation ListTagsForResource for usage and error information. +// API operation DescribeEventBus for usage and error information. // // Returned Error Codes: // * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// An entity that you specified does not exist. +// An entity that you specified doesn't exist. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListTagsForResource -func (c *CloudWatchEvents) ListTagsForResource(input *ListTagsForResourceInput) (*ListTagsForResourceOutput, error) { - req, out := c.ListTagsForResourceRequest(input) +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeEventBus +func (c *CloudWatchEvents) DescribeEventBus(input *DescribeEventBusInput) (*DescribeEventBusOutput, error) { + req, out := c.DescribeEventBusRequest(input) return out, req.Send() } -// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// DescribeEventBusWithContext is the same as DescribeEventBus with the addition of // the ability to pass a context and additional request options. // -// See ListTagsForResource for details on how to use this API operation. +// See DescribeEventBus for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) ListTagsForResourceWithContext(ctx aws.Context, input *ListTagsForResourceInput, opts ...request.Option) (*ListTagsForResourceOutput, error) { - req, out := c.ListTagsForResourceRequest(input) +func (c *CloudWatchEvents) DescribeEventBusWithContext(ctx aws.Context, input *DescribeEventBusInput, opts ...request.Option) (*DescribeEventBusOutput, error) { + req, out := c.DescribeEventBusRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opListTargetsByRule = "ListTargetsByRule" +const opDescribeEventSource = "DescribeEventSource" -// ListTargetsByRuleRequest generates a "aws/request.Request" representing the -// client's request for the ListTargetsByRule operation. The "output" return +// DescribeEventSourceRequest generates a "aws/request.Request" representing the +// client's request for the DescribeEventSource operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See ListTargetsByRule for more information on using the ListTargetsByRule +// See DescribeEventSource for more information on using the DescribeEventSource // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the ListTargetsByRuleRequest method. -// req, resp := client.ListTargetsByRuleRequest(params) +// // Example sending a request using the DescribeEventSourceRequest method. +// req, resp := client.DescribeEventSourceRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListTargetsByRule -func (c *CloudWatchEvents) ListTargetsByRuleRequest(input *ListTargetsByRuleInput) (req *request.Request, output *ListTargetsByRuleOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeEventSource +func (c *CloudWatchEvents) DescribeEventSourceRequest(input *DescribeEventSourceInput) (req *request.Request, output *DescribeEventSourceOutput) { op := &request.Operation{ - Name: opListTargetsByRule, + Name: opDescribeEventSource, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &ListTargetsByRuleInput{} + input = &DescribeEventSourceInput{} } - output = &ListTargetsByRuleOutput{} + output = &DescribeEventSourceOutput{} req = c.newRequest(op, input, output) return } -// ListTargetsByRule API operation for Amazon CloudWatch Events. +// DescribeEventSource API operation for Amazon CloudWatch Events. // -// Lists the targets assigned to the specified rule. +// This operation lists details about a partner event source that is shared +// with your account. +// +// This operation is run by AWS customers, not by SaaS partners. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation ListTargetsByRule for usage and error information. +// API operation DescribeEventSource for usage and error information. // // Returned Error Codes: // * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// An entity that you specified does not exist. +// An entity that you specified doesn't exist. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListTargetsByRule -func (c *CloudWatchEvents) ListTargetsByRule(input *ListTargetsByRuleInput) (*ListTargetsByRuleOutput, error) { - req, out := c.ListTargetsByRuleRequest(input) +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeEventSource +func (c *CloudWatchEvents) DescribeEventSource(input *DescribeEventSourceInput) (*DescribeEventSourceOutput, error) { + req, out := c.DescribeEventSourceRequest(input) return out, req.Send() } -// ListTargetsByRuleWithContext is the same as ListTargetsByRule with the addition of +// DescribeEventSourceWithContext is the same as DescribeEventSource with the addition of // the ability to pass a context and additional request options. // -// See ListTargetsByRule for details on how to use this API operation. +// See DescribeEventSource for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) ListTargetsByRuleWithContext(ctx aws.Context, input *ListTargetsByRuleInput, opts ...request.Option) (*ListTargetsByRuleOutput, error) { - req, out := c.ListTargetsByRuleRequest(input) +func (c *CloudWatchEvents) DescribeEventSourceWithContext(ctx aws.Context, input *DescribeEventSourceInput, opts ...request.Option) (*DescribeEventSourceOutput, error) { + req, out := c.DescribeEventSourceRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opPutEvents = "PutEvents" +const opDescribePartnerEventSource = "DescribePartnerEventSource" -// PutEventsRequest generates a "aws/request.Request" representing the -// client's request for the PutEvents operation. The "output" return +// DescribePartnerEventSourceRequest generates a "aws/request.Request" representing the +// client's request for the DescribePartnerEventSource operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See PutEvents for more information on using the PutEvents +// See DescribePartnerEventSource for more information on using the DescribePartnerEventSource // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the PutEventsRequest method. -// req, resp := client.PutEventsRequest(params) +// // Example sending a request using the DescribePartnerEventSourceRequest method. +// req, resp := client.DescribePartnerEventSourceRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutEvents -func (c *CloudWatchEvents) PutEventsRequest(input *PutEventsInput) (req *request.Request, output *PutEventsOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribePartnerEventSource +func (c *CloudWatchEvents) DescribePartnerEventSourceRequest(input *DescribePartnerEventSourceInput) (req *request.Request, output *DescribePartnerEventSourceOutput) { op := &request.Operation{ - Name: opPutEvents, + Name: opDescribePartnerEventSource, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &PutEventsInput{} + input = &DescribePartnerEventSourceInput{} } - output = &PutEventsOutput{} + output = &DescribePartnerEventSourceOutput{} req = c.newRequest(op, input, output) return } -// PutEvents API operation for Amazon CloudWatch Events. +// DescribePartnerEventSource API operation for Amazon CloudWatch Events. // -// Sends custom events to Amazon CloudWatch Events so that they can be matched -// to rules. +// An SaaS partner can use this operation to list details about a partner event +// source that they have created. +// +// AWS customers do not use this operation. Instead, AWS customers can use DescribeEventSource +// to see details about a partner event source that is shared with them. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation PutEvents for usage and error information. +// API operation DescribePartnerEventSource for usage and error information. // // Returned Error Codes: +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. +// // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutEvents -func (c *CloudWatchEvents) PutEvents(input *PutEventsInput) (*PutEventsOutput, error) { - req, out := c.PutEventsRequest(input) +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribePartnerEventSource +func (c *CloudWatchEvents) DescribePartnerEventSource(input *DescribePartnerEventSourceInput) (*DescribePartnerEventSourceOutput, error) { + req, out := c.DescribePartnerEventSourceRequest(input) return out, req.Send() } -// PutEventsWithContext is the same as PutEvents with the addition of +// DescribePartnerEventSourceWithContext is the same as DescribePartnerEventSource with the addition of // the ability to pass a context and additional request options. // -// See PutEvents for details on how to use this API operation. +// See DescribePartnerEventSource for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) PutEventsWithContext(ctx aws.Context, input *PutEventsInput, opts ...request.Option) (*PutEventsOutput, error) { - req, out := c.PutEventsRequest(input) +func (c *CloudWatchEvents) DescribePartnerEventSourceWithContext(ctx aws.Context, input *DescribePartnerEventSourceInput, opts ...request.Option) (*DescribePartnerEventSourceOutput, error) { + req, out := c.DescribePartnerEventSourceRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opPutPermission = "PutPermission" +const opDescribeRule = "DescribeRule" -// PutPermissionRequest generates a "aws/request.Request" representing the -// client's request for the PutPermission operation. The "output" return +// DescribeRuleRequest generates a "aws/request.Request" representing the +// client's request for the DescribeRule operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See PutPermission for more information on using the PutPermission +// See DescribeRule for more information on using the DescribeRule // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the PutPermissionRequest method. -// req, resp := client.PutPermissionRequest(params) +// // Example sending a request using the DescribeRuleRequest method. +// req, resp := client.DescribeRuleRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutPermission -func (c *CloudWatchEvents) PutPermissionRequest(input *PutPermissionInput) (req *request.Request, output *PutPermissionOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeRule +func (c *CloudWatchEvents) DescribeRuleRequest(input *DescribeRuleInput) (req *request.Request, output *DescribeRuleOutput) { op := &request.Operation{ - Name: opPutPermission, + Name: opDescribeRule, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &PutPermissionInput{} + input = &DescribeRuleInput{} } - output = &PutPermissionOutput{} + output = &DescribeRuleOutput{} req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } -// PutPermission API operation for Amazon CloudWatch Events. -// -// Running PutPermission permits the specified AWS account or AWS organization -// to put events to your account's default event bus. CloudWatch Events rules -// in your account are triggered by these events arriving to your default event -// bus. -// -// For another account to send events to your account, that external account -// must have a CloudWatch Events rule with your account's default event bus -// as a target. -// -// To enable multiple AWS accounts to put events to your default event bus, -// run PutPermission once for each of these accounts. Or, if all the accounts -// are members of the same AWS organization, you can run PutPermission once -// specifying Principal as "*" and specifying the AWS organization ID in Condition, -// to grant permissions to all accounts in that organization. +// DescribeRule API operation for Amazon CloudWatch Events. // -// If you grant permissions using an organization, then accounts in that organization -// must specify a RoleArn with proper permissions when they use PutTarget to -// add your account's event bus as a target. For more information, see Sending -// and Receiving Events Between AWS Accounts (https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEvents-CrossAccountEventDelivery.html) -// in the Amazon CloudWatch Events User Guide. +// Describes the specified rule. // -// The permission policy on the default event bus cannot exceed 10 KB in size. +// DescribeRule doesn't list the targets of a rule. To see the targets associated +// with a rule, use ListTargetsByRule. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation PutPermission for usage and error information. +// API operation DescribeRule for usage and error information. // // Returned Error Codes: // * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// An entity that you specified does not exist. -// -// * ErrCodePolicyLengthExceededException "PolicyLengthExceededException" -// The event bus policy is too long. For more information, see the limits. +// An entity that you specified doesn't exist. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// There is concurrent modification on a rule or target. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutPermission -func (c *CloudWatchEvents) PutPermission(input *PutPermissionInput) (*PutPermissionOutput, error) { - req, out := c.PutPermissionRequest(input) +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeRule +func (c *CloudWatchEvents) DescribeRule(input *DescribeRuleInput) (*DescribeRuleOutput, error) { + req, out := c.DescribeRuleRequest(input) return out, req.Send() } -// PutPermissionWithContext is the same as PutPermission with the addition of +// DescribeRuleWithContext is the same as DescribeRule with the addition of // the ability to pass a context and additional request options. // -// See PutPermission for details on how to use this API operation. +// See DescribeRule for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) PutPermissionWithContext(ctx aws.Context, input *PutPermissionInput, opts ...request.Option) (*PutPermissionOutput, error) { - req, out := c.PutPermissionRequest(input) +func (c *CloudWatchEvents) DescribeRuleWithContext(ctx aws.Context, input *DescribeRuleInput, opts ...request.Option) (*DescribeRuleOutput, error) { + req, out := c.DescribeRuleRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opPutRule = "PutRule" +const opDisableRule = "DisableRule" -// PutRuleRequest generates a "aws/request.Request" representing the -// client's request for the PutRule operation. The "output" return +// DisableRuleRequest generates a "aws/request.Request" representing the +// client's request for the DisableRule operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See PutRule for more information on using the PutRule +// See DisableRule for more information on using the DisableRule // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the PutRuleRequest method. -// req, resp := client.PutRuleRequest(params) +// // Example sending a request using the DisableRuleRequest method. +// req, resp := client.DisableRuleRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutRule -func (c *CloudWatchEvents) PutRuleRequest(input *PutRuleInput) (req *request.Request, output *PutRuleOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DisableRule +func (c *CloudWatchEvents) DisableRuleRequest(input *DisableRuleInput) (req *request.Request, output *DisableRuleOutput) { op := &request.Operation{ - Name: opPutRule, + Name: opDisableRule, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &PutRuleInput{} + input = &DisableRuleInput{} } - output = &PutRuleOutput{} + output = &DisableRuleOutput{} req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } -// PutRule API operation for Amazon CloudWatch Events. -// -// Creates or updates the specified rule. Rules are enabled by default, or based -// on value of the state. You can disable a rule using DisableRule. -// -// If you are updating an existing rule, the rule is replaced with what you -// specify in this PutRule command. If you omit arguments in PutRule, the old -// values for those arguments are not kept. Instead, they are replaced with -// null values. -// -// When you create or update a rule, incoming events might not immediately start -// matching to new or updated rules. Allow a short period of time for changes -// to take effect. -// -// A rule must contain at least an EventPattern or ScheduleExpression. Rules -// with EventPatterns are triggered when a matching event is observed. Rules -// with ScheduleExpressions self-trigger based on the given schedule. A rule -// can have both an EventPattern and a ScheduleExpression, in which case the -// rule triggers on matching events as well as on a schedule. -// -// When you initially create a rule, you can optionally assign one or more tags -// to the rule. Tags can help you organize and categorize your resources. You -// can also use them to scope user permissions, by granting a user permission -// to access or change only rules with certain tag values. To use the PutRule -// operation and assign tags, you must have both the events:PutRule and events:TagResource -// permissions. -// -// If you are updating an existing rule, any tags you specify in the PutRule -// operation are ignored. To update the tags of an existing rule, use TagResource -// and UntagResource. -// -// Most services in AWS treat : or / as the same character in Amazon Resource -// Names (ARNs). However, CloudWatch Events uses an exact match in event patterns -// and rules. Be sure to use the correct ARN characters when creating event -// patterns so that they match the ARN syntax in the event you want to match. -// -// In CloudWatch Events, it is possible to create rules that lead to infinite -// loops, where a rule is fired repeatedly. For example, a rule might detect -// that ACLs have changed on an S3 bucket, and trigger software to change them -// to the desired state. If the rule is not written carefully, the subsequent -// change to the ACLs fires the rule again, creating an infinite loop. +// DisableRule API operation for Amazon CloudWatch Events. // -// To prevent this, write the rules so that the triggered actions do not re-fire -// the same rule. For example, your rule could fire only if ACLs are found to -// be in a bad state, instead of after any change. +// Disables the specified rule. A disabled rule won't match any events and won't +// self-trigger if it has a schedule expression. // -// An infinite loop can quickly cause higher than expected charges. We recommend -// that you use budgeting, which alerts you when charges exceed your specified -// limit. For more information, see Managing Your Costs with Budgets (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/budgets-managing-costs.html). +// When you disable a rule, incoming events might continue to match to the disabled +// rule. Allow a short period of time for changes to take effect. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation PutRule for usage and error information. +// API operation DisableRule for usage and error information. // // Returned Error Codes: -// * ErrCodeInvalidEventPatternException "InvalidEventPatternException" -// The event pattern is not valid. -// -// * ErrCodeLimitExceededException "LimitExceededException" -// You tried to create more rules or add more targets to a rule than is allowed. +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. // // * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// There is concurrent modification on a rule or target. +// There is concurrent modification on a resource. // // * ErrCodeManagedRuleException "ManagedRuleException" -// This rule was created by an AWS service on behalf of your account. It is -// managed by that service. If you see this error in response to DeleteRule -// or RemoveTargets, you can use the Force parameter in those calls to delete -// the rule or remove targets from the rule. You cannot modify these managed -// rules by using DisableRule, EnableRule, PutTargets, PutRule, TagResource, -// or UntagResource. +// An AWS service created this rule on behalf of your account. That service +// manages it. If you see this error in response to DeleteRule or RemoveTargets, +// you can use the Force parameter in those calls to delete the rule or remove +// targets from the rule. You can't modify these managed rules by using DisableRule, +// EnableRule, PutTargets, PutRule, TagResource, or UntagResource. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutRule -func (c *CloudWatchEvents) PutRule(input *PutRuleInput) (*PutRuleOutput, error) { - req, out := c.PutRuleRequest(input) +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DisableRule +func (c *CloudWatchEvents) DisableRule(input *DisableRuleInput) (*DisableRuleOutput, error) { + req, out := c.DisableRuleRequest(input) return out, req.Send() } -// PutRuleWithContext is the same as PutRule with the addition of +// DisableRuleWithContext is the same as DisableRule with the addition of // the ability to pass a context and additional request options. // -// See PutRule for details on how to use this API operation. +// See DisableRule for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) PutRuleWithContext(ctx aws.Context, input *PutRuleInput, opts ...request.Option) (*PutRuleOutput, error) { - req, out := c.PutRuleRequest(input) +func (c *CloudWatchEvents) DisableRuleWithContext(ctx aws.Context, input *DisableRuleInput, opts ...request.Option) (*DisableRuleOutput, error) { + req, out := c.DisableRuleRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opPutTargets = "PutTargets" +const opEnableRule = "EnableRule" -// PutTargetsRequest generates a "aws/request.Request" representing the -// client's request for the PutTargets operation. The "output" return +// EnableRuleRequest generates a "aws/request.Request" representing the +// client's request for the EnableRule operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See PutTargets for more information on using the PutTargets +// See EnableRule for more information on using the EnableRule // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the PutTargetsRequest method. -// req, resp := client.PutTargetsRequest(params) +// // Example sending a request using the EnableRuleRequest method. +// req, resp := client.EnableRuleRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutTargets -func (c *CloudWatchEvents) PutTargetsRequest(input *PutTargetsInput) (req *request.Request, output *PutTargetsOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/EnableRule +func (c *CloudWatchEvents) EnableRuleRequest(input *EnableRuleInput) (req *request.Request, output *EnableRuleOutput) { op := &request.Operation{ - Name: opPutTargets, + Name: opEnableRule, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &PutTargetsInput{} + input = &EnableRuleInput{} } - output = &PutTargetsOutput{} + output = &EnableRuleOutput{} req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } -// PutTargets API operation for Amazon CloudWatch Events. +// EnableRule API operation for Amazon CloudWatch Events. // -// Adds the specified targets to the specified rule, or updates the targets -// if they are already associated with the rule. +// Enables the specified rule. If the rule doesn't exist, the operation fails. // -// Targets are the resources that are invoked when a rule is triggered. +// When you enable a rule, incoming events might not immediately start matching +// to a newly enabled rule. Allow a short period of time for changes to take +// effect. // -// You can configure the following as targets for CloudWatch Events: +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. // -// * EC2 instances +// See the AWS API reference guide for Amazon CloudWatch Events's +// API operation EnableRule for usage and error information. // -// * SSM Run Command +// Returned Error Codes: +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. // -// * SSM Automation +// * ErrCodeConcurrentModificationException "ConcurrentModificationException" +// There is concurrent modification on a resource. // -// * AWS Lambda functions +// * ErrCodeManagedRuleException "ManagedRuleException" +// An AWS service created this rule on behalf of your account. That service +// manages it. If you see this error in response to DeleteRule or RemoveTargets, +// you can use the Force parameter in those calls to delete the rule or remove +// targets from the rule. You can't modify these managed rules by using DisableRule, +// EnableRule, PutTargets, PutRule, TagResource, or UntagResource. // -// * Data streams in Amazon Kinesis Data Streams +// * ErrCodeInternalException "InternalException" +// This exception occurs due to unexpected causes. // -// * Data delivery streams in Amazon Kinesis Data Firehose +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/EnableRule +func (c *CloudWatchEvents) EnableRule(input *EnableRuleInput) (*EnableRuleOutput, error) { + req, out := c.EnableRuleRequest(input) + return out, req.Send() +} + +// EnableRuleWithContext is the same as EnableRule with the addition of +// the ability to pass a context and additional request options. // -// * Amazon ECS tasks -// -// * AWS Step Functions state machines -// -// * AWS Batch jobs -// -// * AWS CodeBuild projects -// -// * Pipelines in AWS CodePipeline -// -// * Amazon Inspector assessment templates -// -// * Amazon SNS topics -// -// * Amazon SQS queues, including FIFO queues -// -// * The default event bus of another AWS account -// -// Creating rules with built-in targets is supported only in the AWS Management -// Console. The built-in targets are EC2 CreateSnapshot API call, EC2 RebootInstances -// API call, EC2 StopInstances API call, and EC2 TerminateInstances API call. -// -// For some target types, PutTargets provides target-specific parameters. If -// the target is a Kinesis data stream, you can optionally specify which shard -// the event goes to by using the KinesisParameters argument. To invoke a command -// on multiple EC2 instances with one rule, you can use the RunCommandParameters -// field. -// -// To be able to make API calls against the resources that you own, Amazon CloudWatch -// Events needs the appropriate permissions. For AWS Lambda and Amazon SNS resources, -// CloudWatch Events relies on resource-based policies. For EC2 instances, Kinesis -// data streams, and AWS Step Functions state machines, CloudWatch Events relies -// on IAM roles that you specify in the RoleARN argument in PutTargets. For -// more information, see Authentication and Access Control (https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/auth-and-access-control-cwe.html) -// in the Amazon CloudWatch Events User Guide. -// -// If another AWS account is in the same region and has granted you permission -// (using PutPermission), you can send events to that account. Set that account's -// event bus as a target of the rules in your account. To send the matched events -// to the other account, specify that account's event bus as the Arn value when -// you run PutTargets. If your account sends events to another account, your -// account is charged for each sent event. Each event sent to another account -// is charged as a custom event. The account receiving the event is not charged. -// For more information, see Amazon CloudWatch Pricing (https://aws.amazon.com/cloudwatch/pricing/). -// -// If you are setting the event bus of another account as the target, and that -// account granted permission to your account through an organization instead -// of directly by the account ID, then you must specify a RoleArn with proper -// permissions in the Target structure. For more information, see Sending and -// Receiving Events Between AWS Accounts (https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEvents-CrossAccountEventDelivery.html) -// in the Amazon CloudWatch Events User Guide. -// -// For more information about enabling cross-account events, see PutPermission. -// -// Input, InputPath, and InputTransformer are mutually exclusive and optional -// parameters of a target. When a rule is triggered due to a matched event: -// -// * If none of the following arguments are specified for a target, then -// the entire event is passed to the target in JSON format (unless the target -// is Amazon EC2 Run Command or Amazon ECS task, in which case nothing from -// the event is passed to the target). -// -// * If Input is specified in the form of valid JSON, then the matched event -// is overridden with this constant. -// -// * If InputPath is specified in the form of JSONPath (for example, $.detail), -// then only the part of the event specified in the path is passed to the -// target (for example, only the detail part of the event is passed). -// -// * If InputTransformer is specified, then one or more specified JSONPaths -// are extracted from the event and used as values in a template that you -// specify as the input to the target. -// -// When you specify InputPath or InputTransformer, you must use JSON dot notation, -// not bracket notation. -// -// When you add targets to a rule and the associated rule triggers soon after, -// new or updated targets might not be immediately invoked. Allow a short period -// of time for changes to take effect. -// -// This action can partially fail if too many requests are made at the same -// time. If that happens, FailedEntryCount is non-zero in the response and each -// entry in FailedEntries provides the ID of the failed target and the error -// code. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for Amazon CloudWatch Events's -// API operation PutTargets for usage and error information. -// -// Returned Error Codes: -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// An entity that you specified does not exist. -// -// * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// There is concurrent modification on a rule or target. -// -// * ErrCodeLimitExceededException "LimitExceededException" -// You tried to create more rules or add more targets to a rule than is allowed. -// -// * ErrCodeManagedRuleException "ManagedRuleException" -// This rule was created by an AWS service on behalf of your account. It is -// managed by that service. If you see this error in response to DeleteRule -// or RemoveTargets, you can use the Force parameter in those calls to delete -// the rule or remove targets from the rule. You cannot modify these managed -// rules by using DisableRule, EnableRule, PutTargets, PutRule, TagResource, -// or UntagResource. -// -// * ErrCodeInternalException "InternalException" -// This exception occurs due to unexpected causes. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutTargets -func (c *CloudWatchEvents) PutTargets(input *PutTargetsInput) (*PutTargetsOutput, error) { - req, out := c.PutTargetsRequest(input) - return out, req.Send() -} - -// PutTargetsWithContext is the same as PutTargets with the addition of -// the ability to pass a context and additional request options. -// -// See PutTargets for details on how to use this API operation. +// See EnableRule for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) PutTargetsWithContext(ctx aws.Context, input *PutTargetsInput, opts ...request.Option) (*PutTargetsOutput, error) { - req, out := c.PutTargetsRequest(input) +func (c *CloudWatchEvents) EnableRuleWithContext(ctx aws.Context, input *EnableRuleInput, opts ...request.Option) (*EnableRuleOutput, error) { + req, out := c.EnableRuleRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opRemovePermission = "RemovePermission" +const opListEventBuses = "ListEventBuses" -// RemovePermissionRequest generates a "aws/request.Request" representing the -// client's request for the RemovePermission operation. The "output" return +// ListEventBusesRequest generates a "aws/request.Request" representing the +// client's request for the ListEventBuses operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See RemovePermission for more information on using the RemovePermission +// See ListEventBuses for more information on using the ListEventBuses // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the RemovePermissionRequest method. -// req, resp := client.RemovePermissionRequest(params) +// // Example sending a request using the ListEventBusesRequest method. +// req, resp := client.ListEventBusesRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RemovePermission -func (c *CloudWatchEvents) RemovePermissionRequest(input *RemovePermissionInput) (req *request.Request, output *RemovePermissionOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListEventBuses +func (c *CloudWatchEvents) ListEventBusesRequest(input *ListEventBusesInput) (req *request.Request, output *ListEventBusesOutput) { op := &request.Operation{ - Name: opRemovePermission, + Name: opListEventBuses, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &RemovePermissionInput{} + input = &ListEventBusesInput{} } - output = &RemovePermissionOutput{} + output = &ListEventBusesOutput{} req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } -// RemovePermission API operation for Amazon CloudWatch Events. +// ListEventBuses API operation for Amazon CloudWatch Events. // -// Revokes the permission of another AWS account to be able to put events to -// your default event bus. Specify the account to revoke by the StatementId -// value that you associated with the account when you granted it permission -// with PutPermission. You can find the StatementId by using DescribeEventBus. +// Lists all the event buses in your account, including the default event bus, +// custom event buses, and partner event buses. +// +// This operation is run by AWS customers, not by SaaS partners. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation RemovePermission for usage and error information. +// API operation ListEventBuses for usage and error information. // // Returned Error Codes: -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// An entity that you specified does not exist. -// // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// There is concurrent modification on a rule or target. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RemovePermission -func (c *CloudWatchEvents) RemovePermission(input *RemovePermissionInput) (*RemovePermissionOutput, error) { - req, out := c.RemovePermissionRequest(input) +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListEventBuses +func (c *CloudWatchEvents) ListEventBuses(input *ListEventBusesInput) (*ListEventBusesOutput, error) { + req, out := c.ListEventBusesRequest(input) return out, req.Send() } -// RemovePermissionWithContext is the same as RemovePermission with the addition of +// ListEventBusesWithContext is the same as ListEventBuses with the addition of // the ability to pass a context and additional request options. // -// See RemovePermission for details on how to use this API operation. +// See ListEventBuses for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) RemovePermissionWithContext(ctx aws.Context, input *RemovePermissionInput, opts ...request.Option) (*RemovePermissionOutput, error) { - req, out := c.RemovePermissionRequest(input) +func (c *CloudWatchEvents) ListEventBusesWithContext(ctx aws.Context, input *ListEventBusesInput, opts ...request.Option) (*ListEventBusesOutput, error) { + req, out := c.ListEventBusesRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opRemoveTargets = "RemoveTargets" +const opListEventSources = "ListEventSources" -// RemoveTargetsRequest generates a "aws/request.Request" representing the -// client's request for the RemoveTargets operation. The "output" return +// ListEventSourcesRequest generates a "aws/request.Request" representing the +// client's request for the ListEventSources operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See RemoveTargets for more information on using the RemoveTargets +// See ListEventSources for more information on using the ListEventSources // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the RemoveTargetsRequest method. -// req, resp := client.RemoveTargetsRequest(params) +// // Example sending a request using the ListEventSourcesRequest method. +// req, resp := client.ListEventSourcesRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RemoveTargets -func (c *CloudWatchEvents) RemoveTargetsRequest(input *RemoveTargetsInput) (req *request.Request, output *RemoveTargetsOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListEventSources +func (c *CloudWatchEvents) ListEventSourcesRequest(input *ListEventSourcesInput) (req *request.Request, output *ListEventSourcesOutput) { op := &request.Operation{ - Name: opRemoveTargets, + Name: opListEventSources, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &RemoveTargetsInput{} + input = &ListEventSourcesInput{} } - output = &RemoveTargetsOutput{} + output = &ListEventSourcesOutput{} req = c.newRequest(op, input, output) return } -// RemoveTargets API operation for Amazon CloudWatch Events. +// ListEventSources API operation for Amazon CloudWatch Events. // -// Removes the specified targets from the specified rule. When the rule is triggered, -// those targets are no longer be invoked. -// -// When you remove a target, when the associated rule triggers, removed targets -// might continue to be invoked. Allow a short period of time for changes to -// take effect. +// You can use this to see all the partner event sources that have been shared +// with your AWS account. For more information about partner event sources, +// see CreateEventBus. // -// This action can partially fail if too many requests are made at the same -// time. If that happens, FailedEntryCount is non-zero in the response and each -// entry in FailedEntries provides the ID of the failed target and the error -// code. +// This operation is run by AWS customers, not by SaaS partners. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation RemoveTargets for usage and error information. +// API operation ListEventSources for usage and error information. // // Returned Error Codes: -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// An entity that you specified does not exist. -// -// * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// There is concurrent modification on a rule or target. -// -// * ErrCodeManagedRuleException "ManagedRuleException" -// This rule was created by an AWS service on behalf of your account. It is -// managed by that service. If you see this error in response to DeleteRule -// or RemoveTargets, you can use the Force parameter in those calls to delete -// the rule or remove targets from the rule. You cannot modify these managed -// rules by using DisableRule, EnableRule, PutTargets, PutRule, TagResource, -// or UntagResource. -// // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RemoveTargets -func (c *CloudWatchEvents) RemoveTargets(input *RemoveTargetsInput) (*RemoveTargetsOutput, error) { - req, out := c.RemoveTargetsRequest(input) +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListEventSources +func (c *CloudWatchEvents) ListEventSources(input *ListEventSourcesInput) (*ListEventSourcesOutput, error) { + req, out := c.ListEventSourcesRequest(input) return out, req.Send() } -// RemoveTargetsWithContext is the same as RemoveTargets with the addition of +// ListEventSourcesWithContext is the same as ListEventSources with the addition of // the ability to pass a context and additional request options. // -// See RemoveTargets for details on how to use this API operation. +// See ListEventSources for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) RemoveTargetsWithContext(ctx aws.Context, input *RemoveTargetsInput, opts ...request.Option) (*RemoveTargetsOutput, error) { - req, out := c.RemoveTargetsRequest(input) +func (c *CloudWatchEvents) ListEventSourcesWithContext(ctx aws.Context, input *ListEventSourcesInput, opts ...request.Option) (*ListEventSourcesOutput, error) { + req, out := c.ListEventSourcesRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opTagResource = "TagResource" +const opListPartnerEventSourceAccounts = "ListPartnerEventSourceAccounts" -// TagResourceRequest generates a "aws/request.Request" representing the -// client's request for the TagResource operation. The "output" return +// ListPartnerEventSourceAccountsRequest generates a "aws/request.Request" representing the +// client's request for the ListPartnerEventSourceAccounts operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See TagResource for more information on using the TagResource +// See ListPartnerEventSourceAccounts for more information on using the ListPartnerEventSourceAccounts // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the TagResourceRequest method. -// req, resp := client.TagResourceRequest(params) +// // Example sending a request using the ListPartnerEventSourceAccountsRequest method. +// req, resp := client.ListPartnerEventSourceAccountsRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/TagResource -func (c *CloudWatchEvents) TagResourceRequest(input *TagResourceInput) (req *request.Request, output *TagResourceOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListPartnerEventSourceAccounts +func (c *CloudWatchEvents) ListPartnerEventSourceAccountsRequest(input *ListPartnerEventSourceAccountsInput) (req *request.Request, output *ListPartnerEventSourceAccountsOutput) { op := &request.Operation{ - Name: opTagResource, + Name: opListPartnerEventSourceAccounts, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &TagResourceInput{} + input = &ListPartnerEventSourceAccountsInput{} } - output = &TagResourceOutput{} + output = &ListPartnerEventSourceAccountsOutput{} req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } -// TagResource API operation for Amazon CloudWatch Events. -// -// Assigns one or more tags (key-value pairs) to the specified CloudWatch Events -// resource. Tags can help you organize and categorize your resources. You can -// also use them to scope user permissions by granting a user permission to -// access or change only resources with certain tag values. In CloudWatch Events, -// rules can be tagged. -// -// Tags don't have any semantic meaning to AWS and are interpreted strictly -// as strings of characters. +// ListPartnerEventSourceAccounts API operation for Amazon CloudWatch Events. // -// You can use the TagResource action with a rule that already has tags. If -// you specify a new tag key for the rule, this tag is appended to the list -// of tags associated with the rule. If you specify a tag key that is already -// associated with the rule, the new tag value that you specify replaces the -// previous value for that tag. +// An SaaS partner can use this operation to display the AWS account ID that +// a particular partner event source name is associated with. // -// You can associate as many as 50 tags with a resource. +// This operation is used by SaaS partners, not by AWS customers. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation TagResource for usage and error information. +// API operation ListPartnerEventSourceAccounts for usage and error information. // // Returned Error Codes: // * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// An entity that you specified does not exist. -// -// * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// There is concurrent modification on a rule or target. +// An entity that you specified doesn't exist. // // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// * ErrCodeManagedRuleException "ManagedRuleException" -// This rule was created by an AWS service on behalf of your account. It is -// managed by that service. If you see this error in response to DeleteRule -// or RemoveTargets, you can use the Force parameter in those calls to delete -// the rule or remove targets from the rule. You cannot modify these managed -// rules by using DisableRule, EnableRule, PutTargets, PutRule, TagResource, -// or UntagResource. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/TagResource -func (c *CloudWatchEvents) TagResource(input *TagResourceInput) (*TagResourceOutput, error) { - req, out := c.TagResourceRequest(input) +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListPartnerEventSourceAccounts +func (c *CloudWatchEvents) ListPartnerEventSourceAccounts(input *ListPartnerEventSourceAccountsInput) (*ListPartnerEventSourceAccountsOutput, error) { + req, out := c.ListPartnerEventSourceAccountsRequest(input) return out, req.Send() } -// TagResourceWithContext is the same as TagResource with the addition of +// ListPartnerEventSourceAccountsWithContext is the same as ListPartnerEventSourceAccounts with the addition of // the ability to pass a context and additional request options. // -// See TagResource for details on how to use this API operation. +// See ListPartnerEventSourceAccounts for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) TagResourceWithContext(ctx aws.Context, input *TagResourceInput, opts ...request.Option) (*TagResourceOutput, error) { - req, out := c.TagResourceRequest(input) +func (c *CloudWatchEvents) ListPartnerEventSourceAccountsWithContext(ctx aws.Context, input *ListPartnerEventSourceAccountsInput, opts ...request.Option) (*ListPartnerEventSourceAccountsOutput, error) { + req, out := c.ListPartnerEventSourceAccountsRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opTestEventPattern = "TestEventPattern" +const opListPartnerEventSources = "ListPartnerEventSources" -// TestEventPatternRequest generates a "aws/request.Request" representing the -// client's request for the TestEventPattern operation. The "output" return +// ListPartnerEventSourcesRequest generates a "aws/request.Request" representing the +// client's request for the ListPartnerEventSources operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See TestEventPattern for more information on using the TestEventPattern +// See ListPartnerEventSources for more information on using the ListPartnerEventSources // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the TestEventPatternRequest method. -// req, resp := client.TestEventPatternRequest(params) +// // Example sending a request using the ListPartnerEventSourcesRequest method. +// req, resp := client.ListPartnerEventSourcesRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/TestEventPattern -func (c *CloudWatchEvents) TestEventPatternRequest(input *TestEventPatternInput) (req *request.Request, output *TestEventPatternOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListPartnerEventSources +func (c *CloudWatchEvents) ListPartnerEventSourcesRequest(input *ListPartnerEventSourcesInput) (req *request.Request, output *ListPartnerEventSourcesOutput) { op := &request.Operation{ - Name: opTestEventPattern, + Name: opListPartnerEventSources, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &TestEventPatternInput{} + input = &ListPartnerEventSourcesInput{} } - output = &TestEventPatternOutput{} + output = &ListPartnerEventSourcesOutput{} req = c.newRequest(op, input, output) return } -// TestEventPattern API operation for Amazon CloudWatch Events. +// ListPartnerEventSources API operation for Amazon CloudWatch Events. // -// Tests whether the specified event pattern matches the provided event. +// An SaaS partner can use this operation to list all the partner event source +// names that they have created. // -// Most services in AWS treat : or / as the same character in Amazon Resource -// Names (ARNs). However, CloudWatch Events uses an exact match in event patterns -// and rules. Be sure to use the correct ARN characters when creating event -// patterns so that they match the ARN syntax in the event you want to match. +// This operation is not used by AWS customers. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation TestEventPattern for usage and error information. +// API operation ListPartnerEventSources for usage and error information. // // Returned Error Codes: -// * ErrCodeInvalidEventPatternException "InvalidEventPatternException" -// The event pattern is not valid. -// // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/TestEventPattern -func (c *CloudWatchEvents) TestEventPattern(input *TestEventPatternInput) (*TestEventPatternOutput, error) { - req, out := c.TestEventPatternRequest(input) +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListPartnerEventSources +func (c *CloudWatchEvents) ListPartnerEventSources(input *ListPartnerEventSourcesInput) (*ListPartnerEventSourcesOutput, error) { + req, out := c.ListPartnerEventSourcesRequest(input) return out, req.Send() } -// TestEventPatternWithContext is the same as TestEventPattern with the addition of +// ListPartnerEventSourcesWithContext is the same as ListPartnerEventSources with the addition of // the ability to pass a context and additional request options. // -// See TestEventPattern for details on how to use this API operation. +// See ListPartnerEventSources for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) TestEventPatternWithContext(ctx aws.Context, input *TestEventPatternInput, opts ...request.Option) (*TestEventPatternOutput, error) { - req, out := c.TestEventPatternRequest(input) +func (c *CloudWatchEvents) ListPartnerEventSourcesWithContext(ctx aws.Context, input *ListPartnerEventSourcesInput, opts ...request.Option) (*ListPartnerEventSourcesOutput, error) { + req, out := c.ListPartnerEventSourcesRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -const opUntagResource = "UntagResource" +const opListRuleNamesByTarget = "ListRuleNamesByTarget" -// UntagResourceRequest generates a "aws/request.Request" representing the -// client's request for the UntagResource operation. The "output" return +// ListRuleNamesByTargetRequest generates a "aws/request.Request" representing the +// client's request for the ListRuleNamesByTarget operation. The "output" return // value will be populated with the request's response once the request completes // successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. // -// See UntagResource for more information on using the UntagResource +// See ListRuleNamesByTarget for more information on using the ListRuleNamesByTarget // API call, and error handling. // // This method is useful when you want to inject custom logic or configuration // into the SDK's request lifecycle. Such as custom headers, or retry logic. // // -// // Example sending a request using the UntagResourceRequest method. -// req, resp := client.UntagResourceRequest(params) +// // Example sending a request using the ListRuleNamesByTargetRequest method. +// req, resp := client.ListRuleNamesByTargetRequest(params) // // err := req.Send() // if err == nil { // resp is now filled // fmt.Println(resp) // } // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/UntagResource -func (c *CloudWatchEvents) UntagResourceRequest(input *UntagResourceInput) (req *request.Request, output *UntagResourceOutput) { +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRuleNamesByTarget +func (c *CloudWatchEvents) ListRuleNamesByTargetRequest(input *ListRuleNamesByTargetInput) (req *request.Request, output *ListRuleNamesByTargetOutput) { op := &request.Operation{ - Name: opUntagResource, + Name: opListRuleNamesByTarget, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &UntagResourceInput{} + input = &ListRuleNamesByTargetInput{} } - output = &UntagResourceOutput{} + output = &ListRuleNamesByTargetOutput{} req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } -// UntagResource API operation for Amazon CloudWatch Events. +// ListRuleNamesByTarget API operation for Amazon CloudWatch Events. // -// Removes one or more tags from the specified CloudWatch Events resource. In -// CloudWatch Events, rules can be tagged. +// Lists the rules for the specified target. You can see which rules can invoke +// a specific target in your account. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. // // See the AWS API reference guide for Amazon CloudWatch Events's -// API operation UntagResource for usage and error information. +// API operation ListRuleNamesByTarget for usage and error information. // // Returned Error Codes: -// * ErrCodeResourceNotFoundException "ResourceNotFoundException" -// An entity that you specified does not exist. -// // * ErrCodeInternalException "InternalException" // This exception occurs due to unexpected causes. // -// * ErrCodeConcurrentModificationException "ConcurrentModificationException" -// There is concurrent modification on a rule or target. -// -// * ErrCodeManagedRuleException "ManagedRuleException" -// This rule was created by an AWS service on behalf of your account. It is -// managed by that service. If you see this error in response to DeleteRule -// or RemoveTargets, you can use the Force parameter in those calls to delete -// the rule or remove targets from the rule. You cannot modify these managed -// rules by using DisableRule, EnableRule, PutTargets, PutRule, TagResource, -// or UntagResource. +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. // -// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/UntagResource -func (c *CloudWatchEvents) UntagResource(input *UntagResourceInput) (*UntagResourceOutput, error) { - req, out := c.UntagResourceRequest(input) +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRuleNamesByTarget +func (c *CloudWatchEvents) ListRuleNamesByTarget(input *ListRuleNamesByTargetInput) (*ListRuleNamesByTargetOutput, error) { + req, out := c.ListRuleNamesByTargetRequest(input) return out, req.Send() } -// UntagResourceWithContext is the same as UntagResource with the addition of +// ListRuleNamesByTargetWithContext is the same as ListRuleNamesByTarget with the addition of // the ability to pass a context and additional request options. // -// See UntagResource for details on how to use this API operation. +// See ListRuleNamesByTarget for details on how to use this API operation. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. -func (c *CloudWatchEvents) UntagResourceWithContext(ctx aws.Context, input *UntagResourceInput, opts ...request.Option) (*UntagResourceOutput, error) { - req, out := c.UntagResourceRequest(input) +func (c *CloudWatchEvents) ListRuleNamesByTargetWithContext(ctx aws.Context, input *ListRuleNamesByTargetInput, opts ...request.Option) (*ListRuleNamesByTargetOutput, error) { + req, out := c.ListRuleNamesByTargetRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opListRules = "ListRules" + +// ListRulesRequest generates a "aws/request.Request" representing the +// client's request for the ListRules operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListRules for more information on using the ListRules +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ListRulesRequest method. +// req, resp := client.ListRulesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRules +func (c *CloudWatchEvents) ListRulesRequest(input *ListRulesInput) (req *request.Request, output *ListRulesOutput) { + op := &request.Operation{ + Name: opListRules, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListRulesInput{} + } + + output = &ListRulesOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListRules API operation for Amazon CloudWatch Events. +// +// Lists your EventBridge rules. You can either list all the rules or provide +// a prefix to match to the rule names. +// +// ListRules doesn't list the targets of a rule. To see the targets associated +// with a rule, use ListTargetsByRule. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Events's +// API operation ListRules for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalException "InternalException" +// This exception occurs due to unexpected causes. +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRules +func (c *CloudWatchEvents) ListRules(input *ListRulesInput) (*ListRulesOutput, error) { + req, out := c.ListRulesRequest(input) + return out, req.Send() +} + +// ListRulesWithContext is the same as ListRules with the addition of +// the ability to pass a context and additional request options. +// +// See ListRules for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchEvents) ListRulesWithContext(ctx aws.Context, input *ListRulesInput, opts ...request.Option) (*ListRulesOutput, error) { + req, out := c.ListRulesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opListTagsForResource = "ListTagsForResource" + +// ListTagsForResourceRequest generates a "aws/request.Request" representing the +// client's request for the ListTagsForResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListTagsForResource for more information on using the ListTagsForResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ListTagsForResourceRequest method. +// req, resp := client.ListTagsForResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListTagsForResource +func (c *CloudWatchEvents) ListTagsForResourceRequest(input *ListTagsForResourceInput) (req *request.Request, output *ListTagsForResourceOutput) { + op := &request.Operation{ + Name: opListTagsForResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListTagsForResourceInput{} + } + + output = &ListTagsForResourceOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListTagsForResource API operation for Amazon CloudWatch Events. +// +// Displays the tags associated with an EventBridge resource. In EventBridge, +// rules can be tagged. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Events's +// API operation ListTagsForResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. +// +// * ErrCodeInternalException "InternalException" +// This exception occurs due to unexpected causes. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListTagsForResource +func (c *CloudWatchEvents) ListTagsForResource(input *ListTagsForResourceInput) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + return out, req.Send() +} + +// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchEvents) ListTagsForResourceWithContext(ctx aws.Context, input *ListTagsForResourceInput, opts ...request.Option) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opListTargetsByRule = "ListTargetsByRule" + +// ListTargetsByRuleRequest generates a "aws/request.Request" representing the +// client's request for the ListTargetsByRule operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListTargetsByRule for more information on using the ListTargetsByRule +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ListTargetsByRuleRequest method. +// req, resp := client.ListTargetsByRuleRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListTargetsByRule +func (c *CloudWatchEvents) ListTargetsByRuleRequest(input *ListTargetsByRuleInput) (req *request.Request, output *ListTargetsByRuleOutput) { + op := &request.Operation{ + Name: opListTargetsByRule, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListTargetsByRuleInput{} + } + + output = &ListTargetsByRuleOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListTargetsByRule API operation for Amazon CloudWatch Events. +// +// Lists the targets assigned to the specified rule. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Events's +// API operation ListTargetsByRule for usage and error information. +// +// Returned Error Codes: +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. +// +// * ErrCodeInternalException "InternalException" +// This exception occurs due to unexpected causes. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListTargetsByRule +func (c *CloudWatchEvents) ListTargetsByRule(input *ListTargetsByRuleInput) (*ListTargetsByRuleOutput, error) { + req, out := c.ListTargetsByRuleRequest(input) + return out, req.Send() +} + +// ListTargetsByRuleWithContext is the same as ListTargetsByRule with the addition of +// the ability to pass a context and additional request options. +// +// See ListTargetsByRule for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchEvents) ListTargetsByRuleWithContext(ctx aws.Context, input *ListTargetsByRuleInput, opts ...request.Option) (*ListTargetsByRuleOutput, error) { + req, out := c.ListTargetsByRuleRequest(input) req.SetContext(ctx) req.ApplyOptions(opts...) return out, req.Send() } -// This structure specifies the VPC subnets and security groups for the task, -// and whether a public IP address is to be used. This structure is relevant -// only for ECS tasks that use the awsvpc network mode. -type AwsVpcConfiguration struct { +const opPutEvents = "PutEvents" + +// PutEventsRequest generates a "aws/request.Request" representing the +// client's request for the PutEvents operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutEvents for more information on using the PutEvents +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the PutEventsRequest method. +// req, resp := client.PutEventsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutEvents +func (c *CloudWatchEvents) PutEventsRequest(input *PutEventsInput) (req *request.Request, output *PutEventsOutput) { + op := &request.Operation{ + Name: opPutEvents, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutEventsInput{} + } + + output = &PutEventsOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutEvents API operation for Amazon CloudWatch Events. +// +// Sends custom events to EventBridge so that they can be matched to rules. +// These events can be from your custom applications and services. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Events's +// API operation PutEvents for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalException "InternalException" +// This exception occurs due to unexpected causes. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutEvents +func (c *CloudWatchEvents) PutEvents(input *PutEventsInput) (*PutEventsOutput, error) { + req, out := c.PutEventsRequest(input) + return out, req.Send() +} + +// PutEventsWithContext is the same as PutEvents with the addition of +// the ability to pass a context and additional request options. +// +// See PutEvents for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchEvents) PutEventsWithContext(ctx aws.Context, input *PutEventsInput, opts ...request.Option) (*PutEventsOutput, error) { + req, out := c.PutEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutPartnerEvents = "PutPartnerEvents" + +// PutPartnerEventsRequest generates a "aws/request.Request" representing the +// client's request for the PutPartnerEvents operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutPartnerEvents for more information on using the PutPartnerEvents +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the PutPartnerEventsRequest method. +// req, resp := client.PutPartnerEventsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutPartnerEvents +func (c *CloudWatchEvents) PutPartnerEventsRequest(input *PutPartnerEventsInput) (req *request.Request, output *PutPartnerEventsOutput) { + op := &request.Operation{ + Name: opPutPartnerEvents, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutPartnerEventsInput{} + } + + output = &PutPartnerEventsOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutPartnerEvents API operation for Amazon CloudWatch Events. +// +// This is used by SaaS partners to write events to a customer's partner event +// bus. +// +// AWS customers do not use this operation. Instead, AWS customers can use PutEvents +// to write custom events from their own applications to an event bus. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Events's +// API operation PutPartnerEvents for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalException "InternalException" +// This exception occurs due to unexpected causes. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutPartnerEvents +func (c *CloudWatchEvents) PutPartnerEvents(input *PutPartnerEventsInput) (*PutPartnerEventsOutput, error) { + req, out := c.PutPartnerEventsRequest(input) + return out, req.Send() +} + +// PutPartnerEventsWithContext is the same as PutPartnerEvents with the addition of +// the ability to pass a context and additional request options. +// +// See PutPartnerEvents for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchEvents) PutPartnerEventsWithContext(ctx aws.Context, input *PutPartnerEventsInput, opts ...request.Option) (*PutPartnerEventsOutput, error) { + req, out := c.PutPartnerEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutPermission = "PutPermission" + +// PutPermissionRequest generates a "aws/request.Request" representing the +// client's request for the PutPermission operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutPermission for more information on using the PutPermission +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the PutPermissionRequest method. +// req, resp := client.PutPermissionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutPermission +func (c *CloudWatchEvents) PutPermissionRequest(input *PutPermissionInput) (req *request.Request, output *PutPermissionOutput) { + op := &request.Operation{ + Name: opPutPermission, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutPermissionInput{} + } + + output = &PutPermissionOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// PutPermission API operation for Amazon CloudWatch Events. +// +// Running PutPermission permits the specified AWS account or AWS organization +// to put events to the specified event bus. Rules in your account are triggered +// by these events arriving to an event bus in your account. +// +// For another account to send events to your account, that external account +// must have a rule with your account's event bus as a target. +// +// To enable multiple AWS accounts to put events to an event bus, run PutPermission +// once for each of these accounts. Or, if all the accounts are members of the +// same AWS organization, you can run PutPermission once specifying Principal +// as "*" and specifying the AWS organization ID in Condition, to grant permissions +// to all accounts in that organization. +// +// If you grant permissions using an organization, then accounts in that organization +// must specify a RoleArn with proper permissions when they use PutTarget to +// add your account's event bus as a target. For more information, see Sending +// and Receiving Events Between AWS Accounts (https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-cross-account-event-delivery.html) +// in the Amazon EventBridge User Guide. +// +// The permission policy on an event bus can't exceed 10 KB in size. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Events's +// API operation PutPermission for usage and error information. +// +// Returned Error Codes: +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. +// +// * ErrCodePolicyLengthExceededException "PolicyLengthExceededException" +// The event bus policy is too long. For more information, see the limits. +// +// * ErrCodeInternalException "InternalException" +// This exception occurs due to unexpected causes. +// +// * ErrCodeConcurrentModificationException "ConcurrentModificationException" +// There is concurrent modification on a resource. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutPermission +func (c *CloudWatchEvents) PutPermission(input *PutPermissionInput) (*PutPermissionOutput, error) { + req, out := c.PutPermissionRequest(input) + return out, req.Send() +} + +// PutPermissionWithContext is the same as PutPermission with the addition of +// the ability to pass a context and additional request options. +// +// See PutPermission for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchEvents) PutPermissionWithContext(ctx aws.Context, input *PutPermissionInput, opts ...request.Option) (*PutPermissionOutput, error) { + req, out := c.PutPermissionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutRule = "PutRule" + +// PutRuleRequest generates a "aws/request.Request" representing the +// client's request for the PutRule operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutRule for more information on using the PutRule +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the PutRuleRequest method. +// req, resp := client.PutRuleRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutRule +func (c *CloudWatchEvents) PutRuleRequest(input *PutRuleInput) (req *request.Request, output *PutRuleOutput) { + op := &request.Operation{ + Name: opPutRule, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutRuleInput{} + } + + output = &PutRuleOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutRule API operation for Amazon CloudWatch Events. +// +// Creates or updates the specified rule. Rules are enabled by default or based +// on value of the state. You can disable a rule using DisableRule. +// +// A single rule watches for events from a single event bus. Events generated +// by AWS services go to your account's default event bus. Events generated +// by SaaS partner services or applications go to the matching partner event +// bus. If you have custom applications or services, you can specify whether +// their events go to your default event bus or a custom event bus that you +// have created. For more information, see CreateEventBus. +// +// If you're updating an existing rule, the rule is replaced with what you specify +// in this PutRule command. If you omit arguments in PutRule, the old values +// for those arguments aren't kept. Instead, they're replaced with null values. +// +// When you create or update a rule, incoming events might not immediately start +// matching to new or updated rules. Allow a short period of time for changes +// to take effect. +// +// A rule must contain at least an EventPattern or ScheduleExpression. Rules +// with EventPatterns are triggered when a matching event is observed. Rules +// with ScheduleExpressions self-trigger based on the given schedule. A rule +// can have both an EventPattern and a ScheduleExpression, in which case the +// rule triggers on matching events as well as on a schedule. +// +// When you initially create a rule, you can optionally assign one or more tags +// to the rule. Tags can help you organize and categorize your resources. You +// can also use them to scope user permissions, by granting a user permission +// to access or change only rules with certain tag values. To use the PutRule +// operation and assign tags, you must have both the events:PutRule and events:TagResource +// permissions. +// +// If you are updating an existing rule, any tags you specify in the PutRule +// operation are ignored. To update the tags of an existing rule, use TagResource +// and UntagResource. +// +// Most services in AWS treat : or / as the same character in Amazon Resource +// Names (ARNs). However, EventBridge uses an exact match in event patterns +// and rules. Be sure to use the correct ARN characters when creating event +// patterns so that they match the ARN syntax in the event that you want to +// match. +// +// In EventBridge, you could create rules that lead to infinite loops, where +// a rule is fired repeatedly. For example, a rule might detect that ACLs have +// changed on an S3 bucket, and trigger software to change them to the desired +// state. If you don't write the rule carefully, the subsequent change to the +// ACLs fires the rule again, creating an infinite loop. +// +// To prevent this, write the rules so that the triggered actions don't refire +// the same rule. For example, your rule could fire only if ACLs are found to +// be in a bad state, instead of after any change. +// +// An infinite loop can quickly cause higher than expected charges. We recommend +// that you use budgeting, which alerts you when charges exceed your specified +// limit. For more information, see Managing Your Costs with Budgets (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/budgets-managing-costs.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Events's +// API operation PutRule for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidEventPatternException "InvalidEventPatternException" +// The event pattern isn't valid. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// You tried to create more resources than is allowed. +// +// * ErrCodeConcurrentModificationException "ConcurrentModificationException" +// There is concurrent modification on a resource. +// +// * ErrCodeManagedRuleException "ManagedRuleException" +// An AWS service created this rule on behalf of your account. That service +// manages it. If you see this error in response to DeleteRule or RemoveTargets, +// you can use the Force parameter in those calls to delete the rule or remove +// targets from the rule. You can't modify these managed rules by using DisableRule, +// EnableRule, PutTargets, PutRule, TagResource, or UntagResource. +// +// * ErrCodeInternalException "InternalException" +// This exception occurs due to unexpected causes. +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutRule +func (c *CloudWatchEvents) PutRule(input *PutRuleInput) (*PutRuleOutput, error) { + req, out := c.PutRuleRequest(input) + return out, req.Send() +} + +// PutRuleWithContext is the same as PutRule with the addition of +// the ability to pass a context and additional request options. +// +// See PutRule for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchEvents) PutRuleWithContext(ctx aws.Context, input *PutRuleInput, opts ...request.Option) (*PutRuleOutput, error) { + req, out := c.PutRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutTargets = "PutTargets" + +// PutTargetsRequest generates a "aws/request.Request" representing the +// client's request for the PutTargets operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutTargets for more information on using the PutTargets +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the PutTargetsRequest method. +// req, resp := client.PutTargetsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutTargets +func (c *CloudWatchEvents) PutTargetsRequest(input *PutTargetsInput) (req *request.Request, output *PutTargetsOutput) { + op := &request.Operation{ + Name: opPutTargets, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutTargetsInput{} + } + + output = &PutTargetsOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutTargets API operation for Amazon CloudWatch Events. +// +// Adds the specified targets to the specified rule, or updates the targets +// if they're already associated with the rule. +// +// Targets are the resources that are invoked when a rule is triggered. +// +// You can configure the following as targets in EventBridge: +// +// * EC2 instances +// +// * SSM Run Command +// +// * SSM Automation +// +// * AWS Lambda functions +// +// * Data streams in Amazon Kinesis Data Streams +// +// * Data delivery streams in Amazon Kinesis Data Firehose +// +// * Amazon ECS tasks +// +// * AWS Step Functions state machines +// +// * AWS Batch jobs +// +// * AWS CodeBuild projects +// +// * Pipelines in AWS CodePipeline +// +// * Amazon Inspector assessment templates +// +// * Amazon SNS topics +// +// * Amazon SQS queues, including FIFO queues +// +// * The default event bus of another AWS account +// +// Creating rules with built-in targets is supported only on the AWS Management +// Console. The built-in targets are EC2 CreateSnapshot API call, EC2 RebootInstances +// API call, EC2 StopInstances API call, and EC2 TerminateInstances API call. +// +// For some target types, PutTargets provides target-specific parameters. If +// the target is a Kinesis data stream, you can optionally specify which shard +// the event goes to by using the KinesisParameters argument. To invoke a command +// on multiple EC2 instances with one rule, you can use the RunCommandParameters +// field. +// +// To be able to make API calls against the resources that you own, Amazon EventBridge +// needs the appropriate permissions. For AWS Lambda and Amazon SNS resources, +// EventBridge relies on resource-based policies. For EC2 instances, Kinesis +// data streams, and AWS Step Functions state machines, EventBridge relies on +// IAM roles that you specify in the RoleARN argument in PutTargets. For more +// information, see Authentication and Access Control (https://docs.aws.amazon.com/eventbridge/latest/userguide/auth-and-access-control-eventbridge.html) +// in the Amazon EventBridge User Guide. +// +// If another AWS account is in the same Region and has granted you permission +// (using PutPermission), you can send events to that account. Set that account's +// event bus as a target of the rules in your account. To send the matched events +// to the other account, specify that account's event bus as the Arn value when +// you run PutTargets. If your account sends events to another account, your +// account is charged for each sent event. Each event sent to another account +// is charged as a custom event. The account receiving the event isn't charged. +// For more information, see Amazon EventBridge Pricing (https://aws.amazon.com/eventbridge/pricing/). +// +// If you're setting an event bus in another account as the target and that +// account granted permission to your account through an organization instead +// of directly by the account ID, you must specify a RoleArn with proper permissions +// in the Target structure. For more information, see Sending and Receiving +// Events Between AWS Accounts (https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-cross-account-event-delivery.html) +// in the Amazon EventBridge User Guide. +// +// For more information about enabling cross-account events, see PutPermission. +// +// Input, InputPath, and InputTransformer are mutually exclusive and optional +// parameters of a target. When a rule is triggered due to a matched event: +// +// * If none of the following arguments are specified for a target, the entire +// event is passed to the target in JSON format (unless the target is Amazon +// EC2 Run Command or Amazon ECS task, in which case nothing from the event +// is passed to the target). +// +// * If Input is specified in the form of valid JSON, then the matched event +// is overridden with this constant. +// +// * If InputPath is specified in the form of JSONPath (for example, $.detail), +// only the part of the event specified in the path is passed to the target +// (for example, only the detail part of the event is passed). +// +// * If InputTransformer is specified, one or more specified JSONPaths are +// extracted from the event and used as values in a template that you specify +// as the input to the target. +// +// When you specify InputPath or InputTransformer, you must use JSON dot notation, +// not bracket notation. +// +// When you add targets to a rule and the associated rule triggers soon after, +// new or updated targets might not be immediately invoked. Allow a short period +// of time for changes to take effect. +// +// This action can partially fail if too many requests are made at the same +// time. If that happens, FailedEntryCount is nonzero in the response, and each +// entry in FailedEntries provides the ID of the failed target and the error +// code. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Events's +// API operation PutTargets for usage and error information. +// +// Returned Error Codes: +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. +// +// * ErrCodeConcurrentModificationException "ConcurrentModificationException" +// There is concurrent modification on a resource. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// You tried to create more resources than is allowed. +// +// * ErrCodeManagedRuleException "ManagedRuleException" +// An AWS service created this rule on behalf of your account. That service +// manages it. If you see this error in response to DeleteRule or RemoveTargets, +// you can use the Force parameter in those calls to delete the rule or remove +// targets from the rule. You can't modify these managed rules by using DisableRule, +// EnableRule, PutTargets, PutRule, TagResource, or UntagResource. +// +// * ErrCodeInternalException "InternalException" +// This exception occurs due to unexpected causes. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutTargets +func (c *CloudWatchEvents) PutTargets(input *PutTargetsInput) (*PutTargetsOutput, error) { + req, out := c.PutTargetsRequest(input) + return out, req.Send() +} + +// PutTargetsWithContext is the same as PutTargets with the addition of +// the ability to pass a context and additional request options. +// +// See PutTargets for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchEvents) PutTargetsWithContext(ctx aws.Context, input *PutTargetsInput, opts ...request.Option) (*PutTargetsOutput, error) { + req, out := c.PutTargetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opRemovePermission = "RemovePermission" + +// RemovePermissionRequest generates a "aws/request.Request" representing the +// client's request for the RemovePermission operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See RemovePermission for more information on using the RemovePermission +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the RemovePermissionRequest method. +// req, resp := client.RemovePermissionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RemovePermission +func (c *CloudWatchEvents) RemovePermissionRequest(input *RemovePermissionInput) (req *request.Request, output *RemovePermissionOutput) { + op := &request.Operation{ + Name: opRemovePermission, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &RemovePermissionInput{} + } + + output = &RemovePermissionOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// RemovePermission API operation for Amazon CloudWatch Events. +// +// Revokes the permission of another AWS account to be able to put events to +// the specified event bus. Specify the account to revoke by the StatementId +// value that you associated with the account when you granted it permission +// with PutPermission. You can find the StatementId by using DescribeEventBus. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Events's +// API operation RemovePermission for usage and error information. +// +// Returned Error Codes: +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. +// +// * ErrCodeInternalException "InternalException" +// This exception occurs due to unexpected causes. +// +// * ErrCodeConcurrentModificationException "ConcurrentModificationException" +// There is concurrent modification on a resource. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RemovePermission +func (c *CloudWatchEvents) RemovePermission(input *RemovePermissionInput) (*RemovePermissionOutput, error) { + req, out := c.RemovePermissionRequest(input) + return out, req.Send() +} + +// RemovePermissionWithContext is the same as RemovePermission with the addition of +// the ability to pass a context and additional request options. +// +// See RemovePermission for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchEvents) RemovePermissionWithContext(ctx aws.Context, input *RemovePermissionInput, opts ...request.Option) (*RemovePermissionOutput, error) { + req, out := c.RemovePermissionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opRemoveTargets = "RemoveTargets" + +// RemoveTargetsRequest generates a "aws/request.Request" representing the +// client's request for the RemoveTargets operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See RemoveTargets for more information on using the RemoveTargets +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the RemoveTargetsRequest method. +// req, resp := client.RemoveTargetsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RemoveTargets +func (c *CloudWatchEvents) RemoveTargetsRequest(input *RemoveTargetsInput) (req *request.Request, output *RemoveTargetsOutput) { + op := &request.Operation{ + Name: opRemoveTargets, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &RemoveTargetsInput{} + } + + output = &RemoveTargetsOutput{} + req = c.newRequest(op, input, output) + return +} + +// RemoveTargets API operation for Amazon CloudWatch Events. +// +// Removes the specified targets from the specified rule. When the rule is triggered, +// those targets are no longer be invoked. +// +// When you remove a target, when the associated rule triggers, removed targets +// might continue to be invoked. Allow a short period of time for changes to +// take effect. +// +// This action can partially fail if too many requests are made at the same +// time. If that happens, FailedEntryCount is non-zero in the response and each +// entry in FailedEntries provides the ID of the failed target and the error +// code. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Events's +// API operation RemoveTargets for usage and error information. +// +// Returned Error Codes: +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. +// +// * ErrCodeConcurrentModificationException "ConcurrentModificationException" +// There is concurrent modification on a resource. +// +// * ErrCodeManagedRuleException "ManagedRuleException" +// An AWS service created this rule on behalf of your account. That service +// manages it. If you see this error in response to DeleteRule or RemoveTargets, +// you can use the Force parameter in those calls to delete the rule or remove +// targets from the rule. You can't modify these managed rules by using DisableRule, +// EnableRule, PutTargets, PutRule, TagResource, or UntagResource. +// +// * ErrCodeInternalException "InternalException" +// This exception occurs due to unexpected causes. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RemoveTargets +func (c *CloudWatchEvents) RemoveTargets(input *RemoveTargetsInput) (*RemoveTargetsOutput, error) { + req, out := c.RemoveTargetsRequest(input) + return out, req.Send() +} + +// RemoveTargetsWithContext is the same as RemoveTargets with the addition of +// the ability to pass a context and additional request options. +// +// See RemoveTargets for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchEvents) RemoveTargetsWithContext(ctx aws.Context, input *RemoveTargetsInput, opts ...request.Option) (*RemoveTargetsOutput, error) { + req, out := c.RemoveTargetsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opTagResource = "TagResource" + +// TagResourceRequest generates a "aws/request.Request" representing the +// client's request for the TagResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See TagResource for more information on using the TagResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the TagResourceRequest method. +// req, resp := client.TagResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/TagResource +func (c *CloudWatchEvents) TagResourceRequest(input *TagResourceInput) (req *request.Request, output *TagResourceOutput) { + op := &request.Operation{ + Name: opTagResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &TagResourceInput{} + } + + output = &TagResourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// TagResource API operation for Amazon CloudWatch Events. +// +// Assigns one or more tags (key-value pairs) to the specified EventBridge resource. +// Tags can help you organize and categorize your resources. You can also use +// them to scope user permissions by granting a user permission to access or +// change only resources with certain tag values. In EventBridge, rules can +// be tagged. +// +// Tags don't have any semantic meaning to AWS and are interpreted strictly +// as strings of characters. +// +// You can use the TagResource action with a rule that already has tags. If +// you specify a new tag key for the rule, this tag is appended to the list +// of tags associated with the rule. If you specify a tag key that is already +// associated with the rule, the new tag value that you specify replaces the +// previous value for that tag. +// +// You can associate as many as 50 tags with a resource. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Events's +// API operation TagResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. +// +// * ErrCodeConcurrentModificationException "ConcurrentModificationException" +// There is concurrent modification on a resource. +// +// * ErrCodeInternalException "InternalException" +// This exception occurs due to unexpected causes. +// +// * ErrCodeManagedRuleException "ManagedRuleException" +// An AWS service created this rule on behalf of your account. That service +// manages it. If you see this error in response to DeleteRule or RemoveTargets, +// you can use the Force parameter in those calls to delete the rule or remove +// targets from the rule. You can't modify these managed rules by using DisableRule, +// EnableRule, PutTargets, PutRule, TagResource, or UntagResource. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/TagResource +func (c *CloudWatchEvents) TagResource(input *TagResourceInput) (*TagResourceOutput, error) { + req, out := c.TagResourceRequest(input) + return out, req.Send() +} + +// TagResourceWithContext is the same as TagResource with the addition of +// the ability to pass a context and additional request options. +// +// See TagResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchEvents) TagResourceWithContext(ctx aws.Context, input *TagResourceInput, opts ...request.Option) (*TagResourceOutput, error) { + req, out := c.TagResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opTestEventPattern = "TestEventPattern" + +// TestEventPatternRequest generates a "aws/request.Request" representing the +// client's request for the TestEventPattern operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See TestEventPattern for more information on using the TestEventPattern +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the TestEventPatternRequest method. +// req, resp := client.TestEventPatternRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/TestEventPattern +func (c *CloudWatchEvents) TestEventPatternRequest(input *TestEventPatternInput) (req *request.Request, output *TestEventPatternOutput) { + op := &request.Operation{ + Name: opTestEventPattern, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &TestEventPatternInput{} + } + + output = &TestEventPatternOutput{} + req = c.newRequest(op, input, output) + return +} + +// TestEventPattern API operation for Amazon CloudWatch Events. +// +// Tests whether the specified event pattern matches the provided event. +// +// Most services in AWS treat : or / as the same character in Amazon Resource +// Names (ARNs). However, EventBridge uses an exact match in event patterns +// and rules. Be sure to use the correct ARN characters when creating event +// patterns so that they match the ARN syntax in the event that you want to +// match. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Events's +// API operation TestEventPattern for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidEventPatternException "InvalidEventPatternException" +// The event pattern isn't valid. +// +// * ErrCodeInternalException "InternalException" +// This exception occurs due to unexpected causes. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/TestEventPattern +func (c *CloudWatchEvents) TestEventPattern(input *TestEventPatternInput) (*TestEventPatternOutput, error) { + req, out := c.TestEventPatternRequest(input) + return out, req.Send() +} + +// TestEventPatternWithContext is the same as TestEventPattern with the addition of +// the ability to pass a context and additional request options. +// +// See TestEventPattern for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchEvents) TestEventPatternWithContext(ctx aws.Context, input *TestEventPatternInput, opts ...request.Option) (*TestEventPatternOutput, error) { + req, out := c.TestEventPatternRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUntagResource = "UntagResource" + +// UntagResourceRequest generates a "aws/request.Request" representing the +// client's request for the UntagResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UntagResource for more information on using the UntagResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the UntagResourceRequest method. +// req, resp := client.UntagResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/UntagResource +func (c *CloudWatchEvents) UntagResourceRequest(input *UntagResourceInput) (req *request.Request, output *UntagResourceOutput) { + op := &request.Operation{ + Name: opUntagResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UntagResourceInput{} + } + + output = &UntagResourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// UntagResource API operation for Amazon CloudWatch Events. +// +// Removes one or more tags from the specified EventBridge resource. In EventBridge, +// rules can be tagged. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Events's +// API operation UntagResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// An entity that you specified doesn't exist. +// +// * ErrCodeInternalException "InternalException" +// This exception occurs due to unexpected causes. +// +// * ErrCodeConcurrentModificationException "ConcurrentModificationException" +// There is concurrent modification on a resource. +// +// * ErrCodeManagedRuleException "ManagedRuleException" +// An AWS service created this rule on behalf of your account. That service +// manages it. If you see this error in response to DeleteRule or RemoveTargets, +// you can use the Force parameter in those calls to delete the rule or remove +// targets from the rule. You can't modify these managed rules by using DisableRule, +// EnableRule, PutTargets, PutRule, TagResource, or UntagResource. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/UntagResource +func (c *CloudWatchEvents) UntagResource(input *UntagResourceInput) (*UntagResourceOutput, error) { + req, out := c.UntagResourceRequest(input) + return out, req.Send() +} + +// UntagResourceWithContext is the same as UntagResource with the addition of +// the ability to pass a context and additional request options. +// +// See UntagResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchEvents) UntagResourceWithContext(ctx aws.Context, input *UntagResourceInput, opts ...request.Option) (*UntagResourceOutput, error) { + req, out := c.UntagResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +type ActivateEventSourceInput struct { + _ struct{} `type:"structure"` + + // The name of the partner event source to activate. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s ActivateEventSourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ActivateEventSourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ActivateEventSourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ActivateEventSourceInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *ActivateEventSourceInput) SetName(v string) *ActivateEventSourceInput { + s.Name = &v + return s +} + +type ActivateEventSourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s ActivateEventSourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ActivateEventSourceOutput) GoString() string { + return s.String() +} + +// This structure specifies the VPC subnets and security groups for the task +// and whether a public IP address is to be used. This structure is relevant +// only for ECS tasks that use the awsvpc network mode. +type AwsVpcConfiguration struct { + _ struct{} `type:"structure"` + + // Specifies whether the task's elastic network interface receives a public + // IP address. You can specify ENABLED only when LaunchType in EcsParameters + // is set to FARGATE. + AssignPublicIp *string `type:"string" enum:"AssignPublicIp"` + + // Specifies the security groups associated with the task. These security groups + // must all be in the same VPC. You can specify as many as five security groups. + // If you don't specify a security group, the default security group for the + // VPC is used. + SecurityGroups []*string `type:"list"` + + // Specifies the subnets associated with the task. These subnets must all be + // in the same VPC. You can specify as many as 16 subnets. + // + // Subnets is a required field + Subnets []*string `type:"list" required:"true"` +} + +// String returns the string representation +func (s AwsVpcConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AwsVpcConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AwsVpcConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AwsVpcConfiguration"} + if s.Subnets == nil { + invalidParams.Add(request.NewErrParamRequired("Subnets")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAssignPublicIp sets the AssignPublicIp field's value. +func (s *AwsVpcConfiguration) SetAssignPublicIp(v string) *AwsVpcConfiguration { + s.AssignPublicIp = &v + return s +} + +// SetSecurityGroups sets the SecurityGroups field's value. +func (s *AwsVpcConfiguration) SetSecurityGroups(v []*string) *AwsVpcConfiguration { + s.SecurityGroups = v + return s +} + +// SetSubnets sets the Subnets field's value. +func (s *AwsVpcConfiguration) SetSubnets(v []*string) *AwsVpcConfiguration { + s.Subnets = v + return s +} + +// The array properties for the submitted job, such as the size of the array. +// The array size can be between 2 and 10,000. If you specify array properties +// for a job, it becomes an array job. This parameter is used only if the target +// is an AWS Batch job. +type BatchArrayProperties struct { + _ struct{} `type:"structure"` + + // The size of the array, if this is an array batch job. Valid values are integers + // between 2 and 10,000. + Size *int64 `type:"integer"` +} + +// String returns the string representation +func (s BatchArrayProperties) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchArrayProperties) GoString() string { + return s.String() +} + +// SetSize sets the Size field's value. +func (s *BatchArrayProperties) SetSize(v int64) *BatchArrayProperties { + s.Size = &v + return s +} + +// The custom parameters to be used when the target is an AWS Batch job. +type BatchParameters struct { + _ struct{} `type:"structure"` + + // The array properties for the submitted job, such as the size of the array. + // The array size can be between 2 and 10,000. If you specify array properties + // for a job, it becomes an array job. This parameter is used only if the target + // is an AWS Batch job. + ArrayProperties *BatchArrayProperties `type:"structure"` + + // The ARN or name of the job definition to use if the event target is an AWS + // Batch job. This job definition must already exist. + // + // JobDefinition is a required field + JobDefinition *string `type:"string" required:"true"` + + // The name to use for this execution of the job, if the target is an AWS Batch + // job. + // + // JobName is a required field + JobName *string `type:"string" required:"true"` + + // The retry strategy to use for failed jobs if the target is an AWS Batch job. + // The retry strategy is the number of times to retry the failed job execution. + // Valid values are 1–10. When you specify a retry strategy here, it overrides + // the retry strategy defined in the job definition. + RetryStrategy *BatchRetryStrategy `type:"structure"` +} + +// String returns the string representation +func (s BatchParameters) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchParameters) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *BatchParameters) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "BatchParameters"} + if s.JobDefinition == nil { + invalidParams.Add(request.NewErrParamRequired("JobDefinition")) + } + if s.JobName == nil { + invalidParams.Add(request.NewErrParamRequired("JobName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetArrayProperties sets the ArrayProperties field's value. +func (s *BatchParameters) SetArrayProperties(v *BatchArrayProperties) *BatchParameters { + s.ArrayProperties = v + return s +} + +// SetJobDefinition sets the JobDefinition field's value. +func (s *BatchParameters) SetJobDefinition(v string) *BatchParameters { + s.JobDefinition = &v + return s +} + +// SetJobName sets the JobName field's value. +func (s *BatchParameters) SetJobName(v string) *BatchParameters { + s.JobName = &v + return s +} + +// SetRetryStrategy sets the RetryStrategy field's value. +func (s *BatchParameters) SetRetryStrategy(v *BatchRetryStrategy) *BatchParameters { + s.RetryStrategy = v + return s +} + +// The retry strategy to use for failed jobs if the target is an AWS Batch job. +// If you specify a retry strategy here, it overrides the retry strategy defined +// in the job definition. +type BatchRetryStrategy struct { + _ struct{} `type:"structure"` + + // The number of times to attempt to retry, if the job fails. Valid values are + // 1–10. + Attempts *int64 `type:"integer"` +} + +// String returns the string representation +func (s BatchRetryStrategy) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchRetryStrategy) GoString() string { + return s.String() +} + +// SetAttempts sets the Attempts field's value. +func (s *BatchRetryStrategy) SetAttempts(v int64) *BatchRetryStrategy { + s.Attempts = &v + return s +} + +// A JSON string that you can use to limit the event bus permissions that you're +// granting to only accounts that fulfill the condition. Currently, the only +// supported condition is membership in a certain AWS organization. The string +// must contain Type, Key, and Value fields. The Value field specifies the ID +// of the AWS organization. The following is an example value for Condition: +// +// '{"Type" : "StringEquals", "Key": "aws:PrincipalOrgID", "Value": "o-1234567890"}' +type Condition struct { + _ struct{} `type:"structure"` + + // The key for the condition. Currently, the only supported key is aws:PrincipalOrgID. + // + // Key is a required field + Key *string `type:"string" required:"true"` + + // The type of condition. Currently, the only supported value is StringEquals. + // + // Type is a required field + Type *string `type:"string" required:"true"` + + // The value for the key. Currently, this must be the ID of the organization. + // + // Value is a required field + Value *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s Condition) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Condition) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Condition) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Condition"} + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Type == nil { + invalidParams.Add(request.NewErrParamRequired("Type")) + } + if s.Value == nil { + invalidParams.Add(request.NewErrParamRequired("Value")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetKey sets the Key field's value. +func (s *Condition) SetKey(v string) *Condition { + s.Key = &v + return s +} + +// SetType sets the Type field's value. +func (s *Condition) SetType(v string) *Condition { + s.Type = &v + return s +} + +// SetValue sets the Value field's value. +func (s *Condition) SetValue(v string) *Condition { + s.Value = &v + return s +} + +type CreateEventBusInput struct { + _ struct{} `type:"structure"` + + // If you're creating a partner event bus, this specifies the partner event + // source that the new event bus will be matched with. + EventSourceName *string `min:"1" type:"string"` + + // The name of the new event bus. + // + // The names of custom event buses can't contain the / character. You can't + // use the name default for a custom event bus because this name is already + // used for your account's default event bus. + // + // If this is a partner event bus, the name must exactly match the name of the + // partner event source that this event bus is matched to. This name will include + // the / character. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s CreateEventBusInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateEventBusInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateEventBusInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateEventBusInput"} + if s.EventSourceName != nil && len(*s.EventSourceName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventSourceName", 1)) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEventSourceName sets the EventSourceName field's value. +func (s *CreateEventBusInput) SetEventSourceName(v string) *CreateEventBusInput { + s.EventSourceName = &v + return s +} + +// SetName sets the Name field's value. +func (s *CreateEventBusInput) SetName(v string) *CreateEventBusInput { + s.Name = &v + return s +} + +type CreateEventBusOutput struct { + _ struct{} `type:"structure"` + + // The ARN of the new event bus. + EventBusArn *string `type:"string"` +} + +// String returns the string representation +func (s CreateEventBusOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateEventBusOutput) GoString() string { + return s.String() +} + +// SetEventBusArn sets the EventBusArn field's value. +func (s *CreateEventBusOutput) SetEventBusArn(v string) *CreateEventBusOutput { + s.EventBusArn = &v + return s +} + +type CreatePartnerEventSourceInput struct { + _ struct{} `type:"structure"` + + // The AWS account ID of the customer who is permitted to create a matching + // partner event bus for this partner event source. + // + // Account is a required field + Account *string `min:"12" type:"string" required:"true"` + + // The name of the partner event source. This name must be unique and must be + // in the format partner_name/event_namespace/event_name . The AWS account that + // wants to use this partner event source must create a partner event bus with + // a name that matches the name of the partner event source. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s CreatePartnerEventSourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreatePartnerEventSourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreatePartnerEventSourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreatePartnerEventSourceInput"} + if s.Account == nil { + invalidParams.Add(request.NewErrParamRequired("Account")) + } + if s.Account != nil && len(*s.Account) < 12 { + invalidParams.Add(request.NewErrParamMinLen("Account", 12)) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAccount sets the Account field's value. +func (s *CreatePartnerEventSourceInput) SetAccount(v string) *CreatePartnerEventSourceInput { + s.Account = &v + return s +} + +// SetName sets the Name field's value. +func (s *CreatePartnerEventSourceInput) SetName(v string) *CreatePartnerEventSourceInput { + s.Name = &v + return s +} + +type CreatePartnerEventSourceOutput struct { + _ struct{} `type:"structure"` + + // The ARN of the partner event source. + EventSourceArn *string `type:"string"` +} + +// String returns the string representation +func (s CreatePartnerEventSourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreatePartnerEventSourceOutput) GoString() string { + return s.String() +} + +// SetEventSourceArn sets the EventSourceArn field's value. +func (s *CreatePartnerEventSourceOutput) SetEventSourceArn(v string) *CreatePartnerEventSourceOutput { + s.EventSourceArn = &v + return s +} + +type DeactivateEventSourceInput struct { + _ struct{} `type:"structure"` + + // The name of the partner event source to deactivate. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeactivateEventSourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeactivateEventSourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeactivateEventSourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeactivateEventSourceInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *DeactivateEventSourceInput) SetName(v string) *DeactivateEventSourceInput { + s.Name = &v + return s +} + +type DeactivateEventSourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeactivateEventSourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeactivateEventSourceOutput) GoString() string { + return s.String() +} + +type DeleteEventBusInput struct { + _ struct{} `type:"structure"` + + // The name of the event bus to delete. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteEventBusInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteEventBusInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteEventBusInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteEventBusInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *DeleteEventBusInput) SetName(v string) *DeleteEventBusInput { + s.Name = &v + return s +} + +type DeleteEventBusOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeleteEventBusOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteEventBusOutput) GoString() string { + return s.String() +} + +type DeletePartnerEventSourceInput struct { + _ struct{} `type:"structure"` + + // The AWS account ID of the AWS customer that the event source was created + // for. + // + // Account is a required field + Account *string `min:"12" type:"string" required:"true"` + + // The name of the event source to delete. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeletePartnerEventSourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeletePartnerEventSourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeletePartnerEventSourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeletePartnerEventSourceInput"} + if s.Account == nil { + invalidParams.Add(request.NewErrParamRequired("Account")) + } + if s.Account != nil && len(*s.Account) < 12 { + invalidParams.Add(request.NewErrParamMinLen("Account", 12)) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAccount sets the Account field's value. +func (s *DeletePartnerEventSourceInput) SetAccount(v string) *DeletePartnerEventSourceInput { + s.Account = &v + return s +} + +// SetName sets the Name field's value. +func (s *DeletePartnerEventSourceInput) SetName(v string) *DeletePartnerEventSourceInput { + s.Name = &v + return s +} + +type DeletePartnerEventSourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeletePartnerEventSourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeletePartnerEventSourceOutput) GoString() string { + return s.String() +} + +type DeleteRuleInput struct { + _ struct{} `type:"structure"` + + // The event bus associated with the rule. If you omit this, the default event + // bus is used. + EventBusName *string `min:"1" type:"string"` + + // If this is a managed rule, created by an AWS service on your behalf, you + // must specify Force as True to delete the rule. This parameter is ignored + // for rules that are not managed rules. You can check whether a rule is a managed + // rule by using DescribeRule or ListRules and checking the ManagedBy field + // of the response. + Force *bool `type:"boolean"` + + // The name of the rule. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteRuleInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRuleInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteRuleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteRuleInput"} + if s.EventBusName != nil && len(*s.EventBusName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventBusName", 1)) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEventBusName sets the EventBusName field's value. +func (s *DeleteRuleInput) SetEventBusName(v string) *DeleteRuleInput { + s.EventBusName = &v + return s +} + +// SetForce sets the Force field's value. +func (s *DeleteRuleInput) SetForce(v bool) *DeleteRuleInput { + s.Force = &v + return s +} + +// SetName sets the Name field's value. +func (s *DeleteRuleInput) SetName(v string) *DeleteRuleInput { + s.Name = &v + return s +} + +type DeleteRuleOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeleteRuleOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRuleOutput) GoString() string { + return s.String() +} + +type DescribeEventBusInput struct { + _ struct{} `type:"structure"` + + // The name of the event bus to show details for. If you omit this, the default + // event bus is displayed. + Name *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeEventBusInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeEventBusInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeEventBusInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeEventBusInput"} + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *DescribeEventBusInput) SetName(v string) *DescribeEventBusInput { + s.Name = &v + return s +} + +type DescribeEventBusOutput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the account permitted to write events to + // the current account. + Arn *string `type:"string"` + + // The name of the event bus. Currently, this is always default. + Name *string `type:"string"` + + // The policy that enables the external account to send events to your account. + Policy *string `type:"string"` +} + +// String returns the string representation +func (s DescribeEventBusOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeEventBusOutput) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *DescribeEventBusOutput) SetArn(v string) *DescribeEventBusOutput { + s.Arn = &v + return s +} + +// SetName sets the Name field's value. +func (s *DescribeEventBusOutput) SetName(v string) *DescribeEventBusOutput { + s.Name = &v + return s +} + +// SetPolicy sets the Policy field's value. +func (s *DescribeEventBusOutput) SetPolicy(v string) *DescribeEventBusOutput { + s.Policy = &v + return s +} + +type DescribeEventSourceInput struct { _ struct{} `type:"structure"` - // Specifies whether the task's elastic network interface receives a public - // IP address. You can specify ENABLED only when LaunchType in EcsParameters - // is set to FARGATE. - AssignPublicIp *string `type:"string" enum:"AssignPublicIp"` + // The name of the partner event source to display the details of. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` +} - // Specifies the security groups associated with the task. These security groups - // must all be in the same VPC. You can specify as many as five security groups. - // If you do not specify a security group, the default security group for the - // VPC is used. - SecurityGroups []*string `type:"list"` +// String returns the string representation +func (s DescribeEventSourceInput) String() string { + return awsutil.Prettify(s) +} - // Specifies the subnets associated with the task. These subnets must all be - // in the same VPC. You can specify as many as 16 subnets. +// GoString returns the string representation +func (s DescribeEventSourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeEventSourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeEventSourceInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *DescribeEventSourceInput) SetName(v string) *DescribeEventSourceInput { + s.Name = &v + return s +} + +type DescribeEventSourceOutput struct { + _ struct{} `type:"structure"` + + // The ARN of the partner event source. + Arn *string `type:"string"` + + // The name of the SaaS partner that created the event source. + CreatedBy *string `type:"string"` + + // The date and time that the event source was created. + CreationTime *time.Time `type:"timestamp"` + + // The date and time that the event source will expire if you don't create a + // matching event bus. + ExpirationTime *time.Time `type:"timestamp"` + + // The name of the partner event source. + Name *string `type:"string"` + + // The state of the event source. If it's ACTIVE, you have already created a + // matching event bus for this event source, and that event bus is active. If + // it's PENDING, either you haven't yet created a matching event bus, or that + // event bus is deactivated. If it's DELETED, you have created a matching event + // bus, but the event source has since been deleted. + State *string `type:"string" enum:"EventSourceState"` +} + +// String returns the string representation +func (s DescribeEventSourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeEventSourceOutput) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *DescribeEventSourceOutput) SetArn(v string) *DescribeEventSourceOutput { + s.Arn = &v + return s +} + +// SetCreatedBy sets the CreatedBy field's value. +func (s *DescribeEventSourceOutput) SetCreatedBy(v string) *DescribeEventSourceOutput { + s.CreatedBy = &v + return s +} + +// SetCreationTime sets the CreationTime field's value. +func (s *DescribeEventSourceOutput) SetCreationTime(v time.Time) *DescribeEventSourceOutput { + s.CreationTime = &v + return s +} + +// SetExpirationTime sets the ExpirationTime field's value. +func (s *DescribeEventSourceOutput) SetExpirationTime(v time.Time) *DescribeEventSourceOutput { + s.ExpirationTime = &v + return s +} + +// SetName sets the Name field's value. +func (s *DescribeEventSourceOutput) SetName(v string) *DescribeEventSourceOutput { + s.Name = &v + return s +} + +// SetState sets the State field's value. +func (s *DescribeEventSourceOutput) SetState(v string) *DescribeEventSourceOutput { + s.State = &v + return s +} + +type DescribePartnerEventSourceInput struct { + _ struct{} `type:"structure"` + + // The name of the event source to display. // - // Subnets is a required field - Subnets []*string `type:"list" required:"true"` + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` } // String returns the string representation -func (s AwsVpcConfiguration) String() string { +func (s DescribePartnerEventSourceInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s AwsVpcConfiguration) GoString() string { +func (s DescribePartnerEventSourceInput) GoString() string { return s.String() } // Validate inspects the fields of the type to determine if they are valid. -func (s *AwsVpcConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AwsVpcConfiguration"} - if s.Subnets == nil { - invalidParams.Add(request.NewErrParamRequired("Subnets")) +func (s *DescribePartnerEventSourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribePartnerEventSourceInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) } if invalidParams.Len() > 0 { @@ -1868,99 +3976,229 @@ func (s *AwsVpcConfiguration) Validate() error { return nil } -// SetAssignPublicIp sets the AssignPublicIp field's value. -func (s *AwsVpcConfiguration) SetAssignPublicIp(v string) *AwsVpcConfiguration { - s.AssignPublicIp = &v +// SetName sets the Name field's value. +func (s *DescribePartnerEventSourceInput) SetName(v string) *DescribePartnerEventSourceInput { + s.Name = &v return s } -// SetSecurityGroups sets the SecurityGroups field's value. -func (s *AwsVpcConfiguration) SetSecurityGroups(v []*string) *AwsVpcConfiguration { - s.SecurityGroups = v +type DescribePartnerEventSourceOutput struct { + _ struct{} `type:"structure"` + + // The ARN of the event source. + Arn *string `type:"string"` + + // The name of the event source. + Name *string `type:"string"` +} + +// String returns the string representation +func (s DescribePartnerEventSourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribePartnerEventSourceOutput) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *DescribePartnerEventSourceOutput) SetArn(v string) *DescribePartnerEventSourceOutput { + s.Arn = &v return s } -// SetSubnets sets the Subnets field's value. -func (s *AwsVpcConfiguration) SetSubnets(v []*string) *AwsVpcConfiguration { - s.Subnets = v +// SetName sets the Name field's value. +func (s *DescribePartnerEventSourceOutput) SetName(v string) *DescribePartnerEventSourceOutput { + s.Name = &v return s } -// The array properties for the submitted job, such as the size of the array. -// The array size can be between 2 and 10,000. If you specify array properties -// for a job, it becomes an array job. This parameter is used only if the target -// is an AWS Batch job. -type BatchArrayProperties struct { +type DescribeRuleInput struct { _ struct{} `type:"structure"` - // The size of the array, if this is an array batch job. Valid values are integers - // between 2 and 10,000. - Size *int64 `type:"integer"` + // The event bus associated with the rule. If you omit this, the default event + // bus is used. + EventBusName *string `min:"1" type:"string"` + + // The name of the rule. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeRuleInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeRuleInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeRuleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeRuleInput"} + if s.EventBusName != nil && len(*s.EventBusName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventBusName", 1)) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEventBusName sets the EventBusName field's value. +func (s *DescribeRuleInput) SetEventBusName(v string) *DescribeRuleInput { + s.EventBusName = &v + return s +} + +// SetName sets the Name field's value. +func (s *DescribeRuleInput) SetName(v string) *DescribeRuleInput { + s.Name = &v + return s +} + +type DescribeRuleOutput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the rule. + Arn *string `min:"1" type:"string"` + + // The description of the rule. + Description *string `type:"string"` + + // The event bus associated with the rule. + EventBusName *string `min:"1" type:"string"` + + // The event pattern. For more information, see Event Patterns (https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-and-event-patterns.html) + // in the Amazon EventBridge User Guide. + EventPattern *string `type:"string"` + + // If this is a managed rule, created by an AWS service on your behalf, this + // field displays the principal name of the AWS service that created the rule. + ManagedBy *string `min:"1" type:"string"` + + // The name of the rule. + Name *string `min:"1" type:"string"` + + // The Amazon Resource Name (ARN) of the IAM role associated with the rule. + RoleArn *string `min:"1" type:"string"` + + // The scheduling expression: for example, "cron(0 20 * * ? *)" or "rate(5 minutes)". + ScheduleExpression *string `type:"string"` + + // Specifies whether the rule is enabled or disabled. + State *string `type:"string" enum:"RuleState"` +} + +// String returns the string representation +func (s DescribeRuleOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeRuleOutput) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *DescribeRuleOutput) SetArn(v string) *DescribeRuleOutput { + s.Arn = &v + return s +} + +// SetDescription sets the Description field's value. +func (s *DescribeRuleOutput) SetDescription(v string) *DescribeRuleOutput { + s.Description = &v + return s +} + +// SetEventBusName sets the EventBusName field's value. +func (s *DescribeRuleOutput) SetEventBusName(v string) *DescribeRuleOutput { + s.EventBusName = &v + return s +} + +// SetEventPattern sets the EventPattern field's value. +func (s *DescribeRuleOutput) SetEventPattern(v string) *DescribeRuleOutput { + s.EventPattern = &v + return s +} + +// SetManagedBy sets the ManagedBy field's value. +func (s *DescribeRuleOutput) SetManagedBy(v string) *DescribeRuleOutput { + s.ManagedBy = &v + return s +} + +// SetName sets the Name field's value. +func (s *DescribeRuleOutput) SetName(v string) *DescribeRuleOutput { + s.Name = &v + return s } -// String returns the string representation -func (s BatchArrayProperties) String() string { - return awsutil.Prettify(s) +// SetRoleArn sets the RoleArn field's value. +func (s *DescribeRuleOutput) SetRoleArn(v string) *DescribeRuleOutput { + s.RoleArn = &v + return s } -// GoString returns the string representation -func (s BatchArrayProperties) GoString() string { - return s.String() +// SetScheduleExpression sets the ScheduleExpression field's value. +func (s *DescribeRuleOutput) SetScheduleExpression(v string) *DescribeRuleOutput { + s.ScheduleExpression = &v + return s } -// SetSize sets the Size field's value. -func (s *BatchArrayProperties) SetSize(v int64) *BatchArrayProperties { - s.Size = &v +// SetState sets the State field's value. +func (s *DescribeRuleOutput) SetState(v string) *DescribeRuleOutput { + s.State = &v return s } -// The custom parameters to be used when the target is an AWS Batch job. -type BatchParameters struct { +type DisableRuleInput struct { _ struct{} `type:"structure"` - // The array properties for the submitted job, such as the size of the array. - // The array size can be between 2 and 10,000. If you specify array properties - // for a job, it becomes an array job. This parameter is used only if the target - // is an AWS Batch job. - ArrayProperties *BatchArrayProperties `type:"structure"` - - // The ARN or name of the job definition to use if the event target is an AWS - // Batch job. This job definition must already exist. - // - // JobDefinition is a required field - JobDefinition *string `type:"string" required:"true"` + // The event bus associated with the rule. If you omit this, the default event + // bus is used. + EventBusName *string `min:"1" type:"string"` - // The name to use for this execution of the job, if the target is an AWS Batch - // job. + // The name of the rule. // - // JobName is a required field - JobName *string `type:"string" required:"true"` - - // The retry strategy to use for failed jobs, if the target is an AWS Batch - // job. The retry strategy is the number of times to retry the failed job execution. - // Valid values are 1–10. When you specify a retry strategy here, it overrides - // the retry strategy defined in the job definition. - RetryStrategy *BatchRetryStrategy `type:"structure"` + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` } // String returns the string representation -func (s BatchParameters) String() string { +func (s DisableRuleInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s BatchParameters) GoString() string { +func (s DisableRuleInput) GoString() string { return s.String() } // Validate inspects the fields of the type to determine if they are valid. -func (s *BatchParameters) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "BatchParameters"} - if s.JobDefinition == nil { - invalidParams.Add(request.NewErrParamRequired("JobDefinition")) +func (s *DisableRuleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DisableRuleInput"} + if s.EventBusName != nil && len(*s.EventBusName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventBusName", 1)) } - if s.JobName == nil { - invalidParams.Add(request.NewErrParamRequired("JobName")) + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) } if invalidParams.Len() > 0 { @@ -1969,105 +4207,100 @@ func (s *BatchParameters) Validate() error { return nil } -// SetArrayProperties sets the ArrayProperties field's value. -func (s *BatchParameters) SetArrayProperties(v *BatchArrayProperties) *BatchParameters { - s.ArrayProperties = v - return s -} - -// SetJobDefinition sets the JobDefinition field's value. -func (s *BatchParameters) SetJobDefinition(v string) *BatchParameters { - s.JobDefinition = &v - return s -} - -// SetJobName sets the JobName field's value. -func (s *BatchParameters) SetJobName(v string) *BatchParameters { - s.JobName = &v +// SetEventBusName sets the EventBusName field's value. +func (s *DisableRuleInput) SetEventBusName(v string) *DisableRuleInput { + s.EventBusName = &v return s } -// SetRetryStrategy sets the RetryStrategy field's value. -func (s *BatchParameters) SetRetryStrategy(v *BatchRetryStrategy) *BatchParameters { - s.RetryStrategy = v +// SetName sets the Name field's value. +func (s *DisableRuleInput) SetName(v string) *DisableRuleInput { + s.Name = &v return s } -// The retry strategy to use for failed jobs, if the target is an AWS Batch -// job. If you specify a retry strategy here, it overrides the retry strategy -// defined in the job definition. -type BatchRetryStrategy struct { +type DisableRuleOutput struct { _ struct{} `type:"structure"` - - // The number of times to attempt to retry, if the job fails. Valid values are - // 1–10. - Attempts *int64 `type:"integer"` } // String returns the string representation -func (s BatchRetryStrategy) String() string { +func (s DisableRuleOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s BatchRetryStrategy) GoString() string { +func (s DisableRuleOutput) GoString() string { return s.String() } -// SetAttempts sets the Attempts field's value. -func (s *BatchRetryStrategy) SetAttempts(v int64) *BatchRetryStrategy { - s.Attempts = &v - return s -} - -// A JSON string which you can use to limit the event bus permissions you are -// granting to only accounts that fulfill the condition. Currently, the only -// supported condition is membership in a certain AWS organization. The string -// must contain Type, Key, and Value fields. The Value field specifies the ID -// of the AWS organization. Following is an example value for Condition: -// -// '{"Type" : "StringEquals", "Key": "aws:PrincipalOrgID", "Value": "o-1234567890"}' -type Condition struct { +// The custom parameters to be used when the target is an Amazon ECS task. +type EcsParameters struct { _ struct{} `type:"structure"` - // Specifies the key for the condition. Currently the only supported key is - // aws:PrincipalOrgID. + // Specifies an ECS task group for the task. The maximum length is 255 characters. + Group *string `type:"string"` + + // Specifies the launch type on which your task is running. The launch type + // that you specify here must match one of the launch type (compatibilities) + // of the target task. The FARGATE value is supported only in the Regions where + // AWS Fargate with Amazon ECS is supported. For more information, see AWS Fargate + // on Amazon ECS (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS-Fargate.html) + // in the Amazon Elastic Container Service Developer Guide. + LaunchType *string `type:"string" enum:"LaunchType"` + + // Use this structure if the ECS task uses the awsvpc network mode. This structure + // specifies the VPC subnets and security groups associated with the task and + // whether a public IP address is to be used. This structure is required if + // LaunchType is FARGATE because the awsvpc mode is required for Fargate tasks. // - // Key is a required field - Key *string `type:"string" required:"true"` + // If you specify NetworkConfiguration when the target ECS task doesn't use + // the awsvpc network mode, the task fails. + NetworkConfiguration *NetworkConfiguration `type:"structure"` - // Specifies the type of condition. Currently the only supported value is StringEquals. + // Specifies the platform version for the task. Specify only the numeric portion + // of the platform version, such as 1.1.0. // - // Type is a required field - Type *string `type:"string" required:"true"` + // This structure is used only if LaunchType is FARGATE. For more information + // about valid platform versions, see AWS Fargate Platform Versions (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) + // in the Amazon Elastic Container Service Developer Guide. + PlatformVersion *string `type:"string"` + + // The number of tasks to create based on TaskDefinition. The default is 1. + TaskCount *int64 `min:"1" type:"integer"` - // Specifies the value for the key. Currently, this must be the ID of the organization. + // The ARN of the task definition to use if the event target is an Amazon ECS + // task. // - // Value is a required field - Value *string `type:"string" required:"true"` + // TaskDefinitionArn is a required field + TaskDefinitionArn *string `min:"1" type:"string" required:"true"` } // String returns the string representation -func (s Condition) String() string { +func (s EcsParameters) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s Condition) GoString() string { +func (s EcsParameters) GoString() string { return s.String() } // Validate inspects the fields of the type to determine if they are valid. -func (s *Condition) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Condition"} - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) +func (s *EcsParameters) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "EcsParameters"} + if s.TaskCount != nil && *s.TaskCount < 1 { + invalidParams.Add(request.NewErrParamMinValue("TaskCount", 1)) } - if s.Type == nil { - invalidParams.Add(request.NewErrParamRequired("Type")) + if s.TaskDefinitionArn == nil { + invalidParams.Add(request.NewErrParamRequired("TaskDefinitionArn")) } - if s.Value == nil { - invalidParams.Add(request.NewErrParamRequired("Value")) + if s.TaskDefinitionArn != nil && len(*s.TaskDefinitionArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("TaskDefinitionArn", 1)) + } + if s.NetworkConfiguration != nil { + if err := s.NetworkConfiguration.Validate(); err != nil { + invalidParams.AddNested("NetworkConfiguration", err.(request.ErrInvalidParams)) + } } if invalidParams.Len() > 0 { @@ -2076,33 +4309,48 @@ func (s *Condition) Validate() error { return nil } -// SetKey sets the Key field's value. -func (s *Condition) SetKey(v string) *Condition { - s.Key = &v +// SetGroup sets the Group field's value. +func (s *EcsParameters) SetGroup(v string) *EcsParameters { + s.Group = &v return s } -// SetType sets the Type field's value. -func (s *Condition) SetType(v string) *Condition { - s.Type = &v +// SetLaunchType sets the LaunchType field's value. +func (s *EcsParameters) SetLaunchType(v string) *EcsParameters { + s.LaunchType = &v return s } -// SetValue sets the Value field's value. -func (s *Condition) SetValue(v string) *Condition { - s.Value = &v +// SetNetworkConfiguration sets the NetworkConfiguration field's value. +func (s *EcsParameters) SetNetworkConfiguration(v *NetworkConfiguration) *EcsParameters { + s.NetworkConfiguration = v return s } -type DeleteRuleInput struct { +// SetPlatformVersion sets the PlatformVersion field's value. +func (s *EcsParameters) SetPlatformVersion(v string) *EcsParameters { + s.PlatformVersion = &v + return s +} + +// SetTaskCount sets the TaskCount field's value. +func (s *EcsParameters) SetTaskCount(v int64) *EcsParameters { + s.TaskCount = &v + return s +} + +// SetTaskDefinitionArn sets the TaskDefinitionArn field's value. +func (s *EcsParameters) SetTaskDefinitionArn(v string) *EcsParameters { + s.TaskDefinitionArn = &v + return s +} + +type EnableRuleInput struct { _ struct{} `type:"structure"` - // If this is a managed rule, created by an AWS service on your behalf, you - // must specify Force as True to delete the rule. This parameter is ignored - // for rules that are not managed rules. You can check whether a rule is a managed - // rule by using DescribeRule or ListRules and checking the ManagedBy field - // of the response. - Force *bool `type:"boolean"` + // The event bus associated with the rule. If you omit this, the default event + // bus is used. + EventBusName *string `min:"1" type:"string"` // The name of the rule. // @@ -2111,18 +4359,21 @@ type DeleteRuleInput struct { } // String returns the string representation -func (s DeleteRuleInput) String() string { +func (s EnableRuleInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DeleteRuleInput) GoString() string { +func (s EnableRuleInput) GoString() string { return s.String() } // Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteRuleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteRuleInput"} +func (s *EnableRuleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "EnableRuleInput"} + if s.EventBusName != nil && len(*s.EventBusName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventBusName", 1)) + } if s.Name == nil { invalidParams.Add(request.NewErrParamRequired("Name")) } @@ -2136,115 +4387,231 @@ func (s *DeleteRuleInput) Validate() error { return nil } -// SetForce sets the Force field's value. -func (s *DeleteRuleInput) SetForce(v bool) *DeleteRuleInput { - s.Force = &v +// SetEventBusName sets the EventBusName field's value. +func (s *EnableRuleInput) SetEventBusName(v string) *EnableRuleInput { + s.EventBusName = &v return s } // SetName sets the Name field's value. -func (s *DeleteRuleInput) SetName(v string) *DeleteRuleInput { +func (s *EnableRuleInput) SetName(v string) *EnableRuleInput { s.Name = &v return s } -type DeleteRuleOutput struct { +type EnableRuleOutput struct { _ struct{} `type:"structure"` } // String returns the string representation -func (s DeleteRuleOutput) String() string { +func (s EnableRuleOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DeleteRuleOutput) GoString() string { +func (s EnableRuleOutput) GoString() string { return s.String() } -type DescribeEventBusInput struct { +// An event bus receives events from a source and routes them to rules associated +// with that event bus. Your account's default event bus receives rules from +// AWS services. A custom event bus can receive rules from AWS services as well +// as your custom applications and services. A partner event bus receives events +// from an event source created by an SaaS partner. These events come from the +// partners services or applications. +type EventBus struct { _ struct{} `type:"structure"` + + // The ARN of the event bus. + Arn *string `type:"string"` + + // The name of the event bus. + Name *string `type:"string"` + + // The permissions policy of the event bus, describing which other AWS accounts + // can write events to this event bus. + Policy *string `type:"string"` } // String returns the string representation -func (s DescribeEventBusInput) String() string { +func (s EventBus) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DescribeEventBusInput) GoString() string { +func (s EventBus) GoString() string { return s.String() } -type DescribeEventBusOutput struct { +// SetArn sets the Arn field's value. +func (s *EventBus) SetArn(v string) *EventBus { + s.Arn = &v + return s +} + +// SetName sets the Name field's value. +func (s *EventBus) SetName(v string) *EventBus { + s.Name = &v + return s +} + +// SetPolicy sets the Policy field's value. +func (s *EventBus) SetPolicy(v string) *EventBus { + s.Policy = &v + return s +} + +// A partner event source is created by an SaaS partner. If a customer creates +// a partner event bus that matches this event source, that AWS account can +// receive events from the partner's applications or services. +type EventSource struct { _ struct{} `type:"structure"` - // The Amazon Resource Name (ARN) of the account permitted to write events to - // the current account. + // The ARN of the event source. Arn *string `type:"string"` - // The name of the event bus. Currently, this is always default. + // The name of the partner that created the event source. + CreatedBy *string `type:"string"` + + // The date and time when the event source was created. + CreationTime *time.Time `type:"timestamp"` + + // The date and time when the event source will expire if the AWS account doesn't + // create a matching event bus for it. + ExpirationTime *time.Time `type:"timestamp"` + + // The name of the event source. Name *string `type:"string"` - // The policy that enables the external account to send events to your account. - Policy *string `type:"string"` + // The state of the event source. If it's ACTIVE, you have already created a + // matching event bus for this event source, and that event bus is active. If + // it's PENDING, either you haven't yet created a matching event bus, or that + // event bus is deactivated. If it's DELETED, you have created a matching event + // bus, but the event source has since been deleted. + State *string `type:"string" enum:"EventSourceState"` } // String returns the string representation -func (s DescribeEventBusOutput) String() string { +func (s EventSource) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DescribeEventBusOutput) GoString() string { +func (s EventSource) GoString() string { return s.String() } // SetArn sets the Arn field's value. -func (s *DescribeEventBusOutput) SetArn(v string) *DescribeEventBusOutput { +func (s *EventSource) SetArn(v string) *EventSource { s.Arn = &v return s } +// SetCreatedBy sets the CreatedBy field's value. +func (s *EventSource) SetCreatedBy(v string) *EventSource { + s.CreatedBy = &v + return s +} + +// SetCreationTime sets the CreationTime field's value. +func (s *EventSource) SetCreationTime(v time.Time) *EventSource { + s.CreationTime = &v + return s +} + +// SetExpirationTime sets the ExpirationTime field's value. +func (s *EventSource) SetExpirationTime(v time.Time) *EventSource { + s.ExpirationTime = &v + return s +} + // SetName sets the Name field's value. -func (s *DescribeEventBusOutput) SetName(v string) *DescribeEventBusOutput { +func (s *EventSource) SetName(v string) *EventSource { s.Name = &v return s } -// SetPolicy sets the Policy field's value. -func (s *DescribeEventBusOutput) SetPolicy(v string) *DescribeEventBusOutput { - s.Policy = &v +// SetState sets the State field's value. +func (s *EventSource) SetState(v string) *EventSource { + s.State = &v return s } -type DescribeRuleInput struct { +// Contains the parameters needed for you to provide custom input to a target +// based on one or more pieces of data extracted from the event. +type InputTransformer struct { _ struct{} `type:"structure"` - // The name of the rule. + // Map of JSON paths to be extracted from the event. You can then insert these + // in the template in InputTemplate to produce the output to be sent to the + // target. // - // Name is a required field - Name *string `min:"1" type:"string" required:"true"` + // InputPathsMap is an array key-value pairs, where each value is a valid JSON + // path. You can have as many as 10 key-value pairs. You must use JSON dot notation, + // not bracket notation. + // + // The keys can't start with "AWS". + InputPathsMap map[string]*string `type:"map"` + + // Input template where you specify placeholders that will be filled with the + // values of the keys from InputPathsMap to customize the data sent to the target. + // Enclose each InputPathsMaps value in brackets: . The InputTemplate + // must be valid JSON. + // + // If InputTemplate is a JSON object (surrounded by curly braces), the following + // restrictions apply: + // + // * The placeholder can't be used as an object key + // + // * Object values can't include quote marks + // + // The following example shows the syntax for using InputPathsMap and InputTemplate. + // + // "InputTransformer": + // + // { + // + // "InputPathsMap": {"instance": "$.detail.instance","status": "$.detail.status"}, + // + // "InputTemplate": " is in state " + // + // } + // + // To have the InputTemplate include quote marks within a JSON string, escape + // each quote marks with a slash, as in the following example: + // + // "InputTransformer": + // + // { + // + // "InputPathsMap": {"instance": "$.detail.instance","status": "$.detail.status"}, + // + // "InputTemplate": " is in state \"\"" + // + // } + // + // InputTemplate is a required field + InputTemplate *string `min:"1" type:"string" required:"true"` } // String returns the string representation -func (s DescribeRuleInput) String() string { +func (s InputTransformer) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DescribeRuleInput) GoString() string { +func (s InputTransformer) GoString() string { return s.String() } // Validate inspects the fields of the type to determine if they are valid. -func (s *DescribeRuleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DescribeRuleInput"} - if s.Name == nil { - invalidParams.Add(request.NewErrParamRequired("Name")) +func (s *InputTransformer) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "InputTransformer"} + if s.InputTemplate == nil { + invalidParams.Add(request.NewErrParamRequired("InputTemplate")) } - if s.Name != nil && len(*s.Name) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + if s.InputTemplate != nil && len(*s.InputTemplate) < 1 { + invalidParams.Add(request.NewErrParamMinLen("InputTemplate", 1)) } if invalidParams.Len() > 0 { @@ -2253,127 +4620,99 @@ func (s *DescribeRuleInput) Validate() error { return nil } -// SetName sets the Name field's value. -func (s *DescribeRuleInput) SetName(v string) *DescribeRuleInput { - s.Name = &v +// SetInputPathsMap sets the InputPathsMap field's value. +func (s *InputTransformer) SetInputPathsMap(v map[string]*string) *InputTransformer { + s.InputPathsMap = v return s } -type DescribeRuleOutput struct { - _ struct{} `type:"structure"` - - // The Amazon Resource Name (ARN) of the rule. - Arn *string `min:"1" type:"string"` - - // The description of the rule. - Description *string `type:"string"` - - // The event pattern. For more information, see Events and Event Patterns (https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html) - // in the Amazon CloudWatch Events User Guide. - EventPattern *string `type:"string"` - - // If this is a managed rule, created by an AWS service on your behalf, this - // field displays the principal name of the AWS service that created the rule. - ManagedBy *string `min:"1" type:"string"` - - // The name of the rule. - Name *string `min:"1" type:"string"` - - // The Amazon Resource Name (ARN) of the IAM role associated with the rule. - RoleArn *string `min:"1" type:"string"` +// SetInputTemplate sets the InputTemplate field's value. +func (s *InputTransformer) SetInputTemplate(v string) *InputTransformer { + s.InputTemplate = &v + return s +} - // The scheduling expression. For example, "cron(0 20 * * ? *)", "rate(5 minutes)". - ScheduleExpression *string `type:"string"` +// This object enables you to specify a JSON path to extract from the event +// and use as the partition key for the Amazon Kinesis data stream so that you +// can control the shard that the event goes to. If you don't include this parameter, +// the default is to use the eventId as the partition key. +type KinesisParameters struct { + _ struct{} `type:"structure"` - // Specifies whether the rule is enabled or disabled. - State *string `type:"string" enum:"RuleState"` + // The JSON path to be extracted from the event and used as the partition key. + // For more information, see Amazon Kinesis Streams Key Concepts (https://docs.aws.amazon.com/streams/latest/dev/key-concepts.html#partition-key) + // in the Amazon Kinesis Streams Developer Guide. + // + // PartitionKeyPath is a required field + PartitionKeyPath *string `type:"string" required:"true"` } // String returns the string representation -func (s DescribeRuleOutput) String() string { +func (s KinesisParameters) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DescribeRuleOutput) GoString() string { +func (s KinesisParameters) GoString() string { return s.String() } -// SetArn sets the Arn field's value. -func (s *DescribeRuleOutput) SetArn(v string) *DescribeRuleOutput { - s.Arn = &v - return s -} - -// SetDescription sets the Description field's value. -func (s *DescribeRuleOutput) SetDescription(v string) *DescribeRuleOutput { - s.Description = &v - return s -} - -// SetEventPattern sets the EventPattern field's value. -func (s *DescribeRuleOutput) SetEventPattern(v string) *DescribeRuleOutput { - s.EventPattern = &v - return s -} - -// SetManagedBy sets the ManagedBy field's value. -func (s *DescribeRuleOutput) SetManagedBy(v string) *DescribeRuleOutput { - s.ManagedBy = &v - return s -} +// Validate inspects the fields of the type to determine if they are valid. +func (s *KinesisParameters) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "KinesisParameters"} + if s.PartitionKeyPath == nil { + invalidParams.Add(request.NewErrParamRequired("PartitionKeyPath")) + } -// SetName sets the Name field's value. -func (s *DescribeRuleOutput) SetName(v string) *DescribeRuleOutput { - s.Name = &v - return s + if invalidParams.Len() > 0 { + return invalidParams + } + return nil } -// SetRoleArn sets the RoleArn field's value. -func (s *DescribeRuleOutput) SetRoleArn(v string) *DescribeRuleOutput { - s.RoleArn = &v +// SetPartitionKeyPath sets the PartitionKeyPath field's value. +func (s *KinesisParameters) SetPartitionKeyPath(v string) *KinesisParameters { + s.PartitionKeyPath = &v return s } -// SetScheduleExpression sets the ScheduleExpression field's value. -func (s *DescribeRuleOutput) SetScheduleExpression(v string) *DescribeRuleOutput { - s.ScheduleExpression = &v - return s -} +type ListEventBusesInput struct { + _ struct{} `type:"structure"` -// SetState sets the State field's value. -func (s *DescribeRuleOutput) SetState(v string) *DescribeRuleOutput { - s.State = &v - return s -} + // Specifying this limits the number of results returned by this operation. + // The operation also returns a NextToken that you can use in a subsequent operation + // to retrieve the next set of results. + Limit *int64 `min:"1" type:"integer"` -type DisableRuleInput struct { - _ struct{} `type:"structure"` + // Specifying this limits the results to only those event buses with names that + // start with the specified prefix. + NamePrefix *string `min:"1" type:"string"` - // The name of the rule. - // - // Name is a required field - Name *string `min:"1" type:"string" required:"true"` + // The token returned by a previous call to retrieve the next set of results. + NextToken *string `min:"1" type:"string"` } // String returns the string representation -func (s DisableRuleInput) String() string { +func (s ListEventBusesInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DisableRuleInput) GoString() string { +func (s ListEventBusesInput) GoString() string { return s.String() } // Validate inspects the fields of the type to determine if they are valid. -func (s *DisableRuleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DisableRuleInput"} - if s.Name == nil { - invalidParams.Add(request.NewErrParamRequired("Name")) +func (s *ListEventBusesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListEventBusesInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) } - if s.Name != nil && len(*s.Name) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + if s.NamePrefix != nil && len(*s.NamePrefix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NamePrefix", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) } if invalidParams.Len() > 0 { @@ -2382,94 +4721,94 @@ func (s *DisableRuleInput) Validate() error { return nil } -// SetName sets the Name field's value. -func (s *DisableRuleInput) SetName(v string) *DisableRuleInput { - s.Name = &v +// SetLimit sets the Limit field's value. +func (s *ListEventBusesInput) SetLimit(v int64) *ListEventBusesInput { + s.Limit = &v return s } -type DisableRuleOutput struct { +// SetNamePrefix sets the NamePrefix field's value. +func (s *ListEventBusesInput) SetNamePrefix(v string) *ListEventBusesInput { + s.NamePrefix = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListEventBusesInput) SetNextToken(v string) *ListEventBusesInput { + s.NextToken = &v + return s +} + +type ListEventBusesOutput struct { _ struct{} `type:"structure"` + + // This list of event buses. + EventBuses []*EventBus `type:"list"` + + // A token you can use in a subsequent operation to retrieve the next set of + // results. + NextToken *string `min:"1" type:"string"` } // String returns the string representation -func (s DisableRuleOutput) String() string { +func (s ListEventBusesOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DisableRuleOutput) GoString() string { +func (s ListEventBusesOutput) GoString() string { return s.String() } -// The custom parameters to be used when the target is an Amazon ECS task. -type EcsParameters struct { - _ struct{} `type:"structure"` - - // Specifies an ECS task group for the task. The maximum length is 255 characters. - Group *string `type:"string"` - - // Specifies the launch type on which your task is running. The launch type - // that you specify here must match one of the launch type (compatibilities) - // of the target task. The FARGATE value is supported only in the Regions where - // AWS Fargate with Amazon ECS is supported. For more information, see AWS Fargate - // on Amazon ECS (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS-Fargate.html) - // in the Amazon Elastic Container Service Developer Guide. - LaunchType *string `type:"string" enum:"LaunchType"` +// SetEventBuses sets the EventBuses field's value. +func (s *ListEventBusesOutput) SetEventBuses(v []*EventBus) *ListEventBusesOutput { + s.EventBuses = v + return s +} - // Use this structure if the ECS task uses the awsvpc network mode. This structure - // specifies the VPC subnets and security groups associated with the task, and - // whether a public IP address is to be used. This structure is required if - // LaunchType is FARGATE because the awsvpc mode is required for Fargate tasks. - // - // If you specify NetworkConfiguration when the target ECS task does not use - // the awsvpc network mode, the task fails. - NetworkConfiguration *NetworkConfiguration `type:"structure"` +// SetNextToken sets the NextToken field's value. +func (s *ListEventBusesOutput) SetNextToken(v string) *ListEventBusesOutput { + s.NextToken = &v + return s +} - // Specifies the platform version for the task. Specify only the numeric portion - // of the platform version, such as 1.1.0. - // - // This structure is used only if LaunchType is FARGATE. For more information - // about valid platform versions, see AWS Fargate Platform Versions (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) - // in the Amazon Elastic Container Service Developer Guide. - PlatformVersion *string `type:"string"` +type ListEventSourcesInput struct { + _ struct{} `type:"structure"` - // The number of tasks to create based on TaskDefinition. The default is 1. - TaskCount *int64 `min:"1" type:"integer"` + // Specifying this limits the number of results returned by this operation. + // The operation also returns a NextToken that you can use in a subsequent operation + // to retrieve the next set of results. + Limit *int64 `min:"1" type:"integer"` - // The ARN of the task definition to use if the event target is an Amazon ECS - // task. - // - // TaskDefinitionArn is a required field - TaskDefinitionArn *string `min:"1" type:"string" required:"true"` + // Specifying this limits the results to only those partner event sources with + // names that start with the specified prefix. + NamePrefix *string `min:"1" type:"string"` + + // The token returned by a previous call to retrieve the next set of results. + NextToken *string `min:"1" type:"string"` } // String returns the string representation -func (s EcsParameters) String() string { +func (s ListEventSourcesInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s EcsParameters) GoString() string { +func (s ListEventSourcesInput) GoString() string { return s.String() } // Validate inspects the fields of the type to determine if they are valid. -func (s *EcsParameters) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "EcsParameters"} - if s.TaskCount != nil && *s.TaskCount < 1 { - invalidParams.Add(request.NewErrParamMinValue("TaskCount", 1)) - } - if s.TaskDefinitionArn == nil { - invalidParams.Add(request.NewErrParamRequired("TaskDefinitionArn")) +func (s *ListEventSourcesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListEventSourcesInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) } - if s.TaskDefinitionArn != nil && len(*s.TaskDefinitionArn) < 1 { - invalidParams.Add(request.NewErrParamMinLen("TaskDefinitionArn", 1)) + if s.NamePrefix != nil && len(*s.NamePrefix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NamePrefix", 1)) } - if s.NetworkConfiguration != nil { - if err := s.NetworkConfiguration.Validate(); err != nil { - invalidParams.AddNested("NetworkConfiguration", err.(request.ErrInvalidParams)) - } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) } if invalidParams.Len() > 0 { @@ -2478,69 +4817,99 @@ func (s *EcsParameters) Validate() error { return nil } -// SetGroup sets the Group field's value. -func (s *EcsParameters) SetGroup(v string) *EcsParameters { - s.Group = &v +// SetLimit sets the Limit field's value. +func (s *ListEventSourcesInput) SetLimit(v int64) *ListEventSourcesInput { + s.Limit = &v return s } -// SetLaunchType sets the LaunchType field's value. -func (s *EcsParameters) SetLaunchType(v string) *EcsParameters { - s.LaunchType = &v +// SetNamePrefix sets the NamePrefix field's value. +func (s *ListEventSourcesInput) SetNamePrefix(v string) *ListEventSourcesInput { + s.NamePrefix = &v return s } -// SetNetworkConfiguration sets the NetworkConfiguration field's value. -func (s *EcsParameters) SetNetworkConfiguration(v *NetworkConfiguration) *EcsParameters { - s.NetworkConfiguration = v +// SetNextToken sets the NextToken field's value. +func (s *ListEventSourcesInput) SetNextToken(v string) *ListEventSourcesInput { + s.NextToken = &v return s } -// SetPlatformVersion sets the PlatformVersion field's value. -func (s *EcsParameters) SetPlatformVersion(v string) *EcsParameters { - s.PlatformVersion = &v - return s +type ListEventSourcesOutput struct { + _ struct{} `type:"structure"` + + // The list of event sources. + EventSources []*EventSource `type:"list"` + + // A token you can use in a subsequent operation to retrieve the next set of + // results. + NextToken *string `min:"1" type:"string"` } -// SetTaskCount sets the TaskCount field's value. -func (s *EcsParameters) SetTaskCount(v int64) *EcsParameters { - s.TaskCount = &v +// String returns the string representation +func (s ListEventSourcesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListEventSourcesOutput) GoString() string { + return s.String() +} + +// SetEventSources sets the EventSources field's value. +func (s *ListEventSourcesOutput) SetEventSources(v []*EventSource) *ListEventSourcesOutput { + s.EventSources = v return s } -// SetTaskDefinitionArn sets the TaskDefinitionArn field's value. -func (s *EcsParameters) SetTaskDefinitionArn(v string) *EcsParameters { - s.TaskDefinitionArn = &v +// SetNextToken sets the NextToken field's value. +func (s *ListEventSourcesOutput) SetNextToken(v string) *ListEventSourcesOutput { + s.NextToken = &v return s } -type EnableRuleInput struct { +type ListPartnerEventSourceAccountsInput struct { _ struct{} `type:"structure"` - // The name of the rule. + // The name of the partner event source to display account information about. // - // Name is a required field - Name *string `min:"1" type:"string" required:"true"` + // EventSourceName is a required field + EventSourceName *string `min:"1" type:"string" required:"true"` + + // Specifying this limits the number of results returned by this operation. + // The operation also returns a NextToken that you can use in a subsequent operation + // to retrieve the next set of results. + Limit *int64 `min:"1" type:"integer"` + + // The token returned by a previous call to this operation. Specifying this + // retrieves the next set of results. + NextToken *string `min:"1" type:"string"` } // String returns the string representation -func (s EnableRuleInput) String() string { +func (s ListPartnerEventSourceAccountsInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s EnableRuleInput) GoString() string { +func (s ListPartnerEventSourceAccountsInput) GoString() string { return s.String() } // Validate inspects the fields of the type to determine if they are valid. -func (s *EnableRuleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "EnableRuleInput"} - if s.Name == nil { - invalidParams.Add(request.NewErrParamRequired("Name")) +func (s *ListPartnerEventSourceAccountsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListPartnerEventSourceAccountsInput"} + if s.EventSourceName == nil { + invalidParams.Add(request.NewErrParamRequired("EventSourceName")) } - if s.Name != nil && len(*s.Name) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + if s.EventSourceName != nil && len(*s.EventSourceName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventSourceName", 1)) + } + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) } if invalidParams.Len() > 0 { @@ -2549,101 +4918,100 @@ func (s *EnableRuleInput) Validate() error { return nil } -// SetName sets the Name field's value. -func (s *EnableRuleInput) SetName(v string) *EnableRuleInput { - s.Name = &v +// SetEventSourceName sets the EventSourceName field's value. +func (s *ListPartnerEventSourceAccountsInput) SetEventSourceName(v string) *ListPartnerEventSourceAccountsInput { + s.EventSourceName = &v return s } -type EnableRuleOutput struct { +// SetLimit sets the Limit field's value. +func (s *ListPartnerEventSourceAccountsInput) SetLimit(v int64) *ListPartnerEventSourceAccountsInput { + s.Limit = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListPartnerEventSourceAccountsInput) SetNextToken(v string) *ListPartnerEventSourceAccountsInput { + s.NextToken = &v + return s +} + +type ListPartnerEventSourceAccountsOutput struct { _ struct{} `type:"structure"` + + // A token you can use in a subsequent operation to retrieve the next set of + // results. + NextToken *string `min:"1" type:"string"` + + // The list of partner event sources returned by the operation. + PartnerEventSourceAccounts []*PartnerEventSourceAccount `type:"list"` } // String returns the string representation -func (s EnableRuleOutput) String() string { +func (s ListPartnerEventSourceAccountsOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s EnableRuleOutput) GoString() string { +func (s ListPartnerEventSourceAccountsOutput) GoString() string { return s.String() } -// Contains the parameters needed for you to provide custom input to a target -// based on one or more pieces of data extracted from the event. -type InputTransformer struct { +// SetNextToken sets the NextToken field's value. +func (s *ListPartnerEventSourceAccountsOutput) SetNextToken(v string) *ListPartnerEventSourceAccountsOutput { + s.NextToken = &v + return s +} + +// SetPartnerEventSourceAccounts sets the PartnerEventSourceAccounts field's value. +func (s *ListPartnerEventSourceAccountsOutput) SetPartnerEventSourceAccounts(v []*PartnerEventSourceAccount) *ListPartnerEventSourceAccountsOutput { + s.PartnerEventSourceAccounts = v + return s +} + +type ListPartnerEventSourcesInput struct { _ struct{} `type:"structure"` - // Map of JSON paths to be extracted from the event. You can then insert these - // in the template in InputTemplate to produce the output you want to be sent - // to the target. - // - // InputPathsMap is an array key-value pairs, where each value is a valid JSON - // path. You can have as many as 10 key-value pairs. You must use JSON dot notation, - // not bracket notation. - // - // The keys cannot start with "AWS." - InputPathsMap map[string]*string `type:"map"` + // pecifying this limits the number of results returned by this operation. The + // operation also returns a NextToken that you can use in a subsequent operation + // to retrieve the next set of results. + Limit *int64 `min:"1" type:"integer"` - // Input template where you specify placeholders that will be filled with the - // values of the keys from InputPathsMap to customize the data sent to the target. - // Enclose each InputPathsMaps value in brackets: The InputTemplate - // must be valid JSON. - // - // If InputTemplate is a JSON object (surrounded by curly braces), the following - // restrictions apply: - // - // * The placeholder cannot be used as an object key. - // - // * Object values cannot include quote marks. - // - // The following example shows the syntax for using InputPathsMap and InputTemplate. + // If you specify this, the results are limited to only those partner event + // sources that start with the string you specify. // - // "InputTransformer": - // - // { - // - // "InputPathsMap": {"instance": "$.detail.instance","status": "$.detail.status"}, - // - // "InputTemplate": " is in state " - // - // } - // - // To have the InputTemplate include quote marks within a JSON string, escape - // each quote marks with a slash, as in the following example: - // - // "InputTransformer": - // - // { - // - // "InputPathsMap": {"instance": "$.detail.instance","status": "$.detail.status"}, - // - // "InputTemplate": " is in state \"\"" - // - // } - // - // InputTemplate is a required field - InputTemplate *string `min:"1" type:"string" required:"true"` + // NamePrefix is a required field + NamePrefix *string `min:"1" type:"string" required:"true"` + + // The token returned by a previous call to this operation. Specifying this + // retrieves the next set of results. + NextToken *string `min:"1" type:"string"` } // String returns the string representation -func (s InputTransformer) String() string { +func (s ListPartnerEventSourcesInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s InputTransformer) GoString() string { +func (s ListPartnerEventSourcesInput) GoString() string { return s.String() } // Validate inspects the fields of the type to determine if they are valid. -func (s *InputTransformer) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InputTransformer"} - if s.InputTemplate == nil { - invalidParams.Add(request.NewErrParamRequired("InputTemplate")) +func (s *ListPartnerEventSourcesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListPartnerEventSourcesInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) } - if s.InputTemplate != nil && len(*s.InputTemplate) < 1 { - invalidParams.Add(request.NewErrParamMinLen("InputTemplate", 1)) + if s.NamePrefix == nil { + invalidParams.Add(request.NewErrParamRequired("NamePrefix")) + } + if s.NamePrefix != nil && len(*s.NamePrefix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NamePrefix", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) } if invalidParams.Len() > 0 { @@ -2652,65 +5020,64 @@ func (s *InputTransformer) Validate() error { return nil } -// SetInputPathsMap sets the InputPathsMap field's value. -func (s *InputTransformer) SetInputPathsMap(v map[string]*string) *InputTransformer { - s.InputPathsMap = v +// SetLimit sets the Limit field's value. +func (s *ListPartnerEventSourcesInput) SetLimit(v int64) *ListPartnerEventSourcesInput { + s.Limit = &v return s } -// SetInputTemplate sets the InputTemplate field's value. -func (s *InputTransformer) SetInputTemplate(v string) *InputTransformer { - s.InputTemplate = &v +// SetNamePrefix sets the NamePrefix field's value. +func (s *ListPartnerEventSourcesInput) SetNamePrefix(v string) *ListPartnerEventSourcesInput { + s.NamePrefix = &v return s } -// This object enables you to specify a JSON path to extract from the event -// and use as the partition key for the Amazon Kinesis data stream, so that -// you can control the shard to which the event goes. If you do not include -// this parameter, the default is to use the eventId as the partition key. -type KinesisParameters struct { +// SetNextToken sets the NextToken field's value. +func (s *ListPartnerEventSourcesInput) SetNextToken(v string) *ListPartnerEventSourcesInput { + s.NextToken = &v + return s +} + +type ListPartnerEventSourcesOutput struct { _ struct{} `type:"structure"` - // The JSON path to be extracted from the event and used as the partition key. - // For more information, see Amazon Kinesis Streams Key Concepts (https://docs.aws.amazon.com/streams/latest/dev/key-concepts.html#partition-key) - // in the Amazon Kinesis Streams Developer Guide. - // - // PartitionKeyPath is a required field - PartitionKeyPath *string `type:"string" required:"true"` + // A token you can use in a subsequent operation to retrieve the next set of + // results. + NextToken *string `min:"1" type:"string"` + + // The list of partner event sources returned by the operation. + PartnerEventSources []*PartnerEventSource `type:"list"` } // String returns the string representation -func (s KinesisParameters) String() string { +func (s ListPartnerEventSourcesOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s KinesisParameters) GoString() string { +func (s ListPartnerEventSourcesOutput) GoString() string { return s.String() } -// Validate inspects the fields of the type to determine if they are valid. -func (s *KinesisParameters) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "KinesisParameters"} - if s.PartitionKeyPath == nil { - invalidParams.Add(request.NewErrParamRequired("PartitionKeyPath")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil +// SetNextToken sets the NextToken field's value. +func (s *ListPartnerEventSourcesOutput) SetNextToken(v string) *ListPartnerEventSourcesOutput { + s.NextToken = &v + return s } -// SetPartitionKeyPath sets the PartitionKeyPath field's value. -func (s *KinesisParameters) SetPartitionKeyPath(v string) *KinesisParameters { - s.PartitionKeyPath = &v +// SetPartnerEventSources sets the PartnerEventSources field's value. +func (s *ListPartnerEventSourcesOutput) SetPartnerEventSources(v []*PartnerEventSource) *ListPartnerEventSourcesOutput { + s.PartnerEventSources = v return s } type ListRuleNamesByTargetInput struct { _ struct{} `type:"structure"` + // Limits the results to show only the rules associated with the specified event + // bus. + EventBusName *string `min:"1" type:"string"` + // The maximum number of results to return. Limit *int64 `min:"1" type:"integer"` @@ -2736,6 +5103,9 @@ func (s ListRuleNamesByTargetInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *ListRuleNamesByTargetInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "ListRuleNamesByTargetInput"} + if s.EventBusName != nil && len(*s.EventBusName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventBusName", 1)) + } if s.Limit != nil && *s.Limit < 1 { invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) } @@ -2755,6 +5125,12 @@ func (s *ListRuleNamesByTargetInput) Validate() error { return nil } +// SetEventBusName sets the EventBusName field's value. +func (s *ListRuleNamesByTargetInput) SetEventBusName(v string) *ListRuleNamesByTargetInput { + s.EventBusName = &v + return s +} + // SetLimit sets the Limit field's value. func (s *ListRuleNamesByTargetInput) SetLimit(v int64) *ListRuleNamesByTargetInput { s.Limit = &v @@ -2809,6 +5185,10 @@ func (s *ListRuleNamesByTargetOutput) SetRuleNames(v []*string) *ListRuleNamesBy type ListRulesInput struct { _ struct{} `type:"structure"` + // Limits the results to show only the rules associated with the specified event + // bus. + EventBusName *string `min:"1" type:"string"` + // The maximum number of results to return. Limit *int64 `min:"1" type:"integer"` @@ -2832,6 +5212,9 @@ func (s ListRulesInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *ListRulesInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "ListRulesInput"} + if s.EventBusName != nil && len(*s.EventBusName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventBusName", 1)) + } if s.Limit != nil && *s.Limit < 1 { invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) } @@ -2848,6 +5231,12 @@ func (s *ListRulesInput) Validate() error { return nil } +// SetEventBusName sets the EventBusName field's value. +func (s *ListRulesInput) SetEventBusName(v string) *ListRulesInput { + s.EventBusName = &v + return s +} + // SetLimit sets the Limit field's value. func (s *ListRulesInput) SetLimit(v int64) *ListRulesInput { s.Limit = &v @@ -2902,7 +5291,7 @@ func (s *ListRulesOutput) SetRules(v []*Rule) *ListRulesOutput { type ListTagsForResourceInput struct { _ struct{} `type:"structure"` - // The ARN of the CloudWatch Events rule for which you want to view tags. + // The ARN of the rule for which you want to view tags. // // ResourceARN is a required field ResourceARN *string `min:"1" type:"string" required:"true"` @@ -2943,7 +5332,7 @@ func (s *ListTagsForResourceInput) SetResourceARN(v string) *ListTagsForResource type ListTagsForResourceOutput struct { _ struct{} `type:"structure"` - // The list of tag keys and values associated with the rule you specified + // The list of tag keys and values associated with the rule that you specified. Tags []*Tag `type:"list"` } @@ -2966,6 +5355,10 @@ func (s *ListTagsForResourceOutput) SetTags(v []*Tag) *ListTagsForResourceOutput type ListTargetsByRuleInput struct { _ struct{} `type:"structure"` + // The event bus associated with the rule. If you omit this, the default event + // bus is used. + EventBusName *string `min:"1" type:"string"` + // The maximum number of results to return. Limit *int64 `min:"1" type:"integer"` @@ -2991,6 +5384,9 @@ func (s ListTargetsByRuleInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *ListTargetsByRuleInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "ListTargetsByRuleInput"} + if s.EventBusName != nil && len(*s.EventBusName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventBusName", 1)) + } if s.Limit != nil && *s.Limit < 1 { invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) } @@ -3010,6 +5406,12 @@ func (s *ListTargetsByRuleInput) Validate() error { return nil } +// SetEventBusName sets the EventBusName field's value. +func (s *ListTargetsByRuleInput) SetEventBusName(v string) *ListTargetsByRuleInput { + s.EventBusName = &v + return s +} + // SetLimit sets the Limit field's value. func (s *ListTargetsByRuleInput) SetLimit(v int64) *ListTargetsByRuleInput { s.Limit = &v @@ -3066,7 +5468,7 @@ type NetworkConfiguration struct { _ struct{} `type:"structure"` // Use this structure to specify the VPC subnets and security groups for the - // task, and whether a public IP address is to be used. This structure is relevant + // task and whether a public IP address is to be used. This structure is relevant // only for ECS tasks that use the awsvpc network mode. AwsvpcConfiguration *AwsVpcConfiguration `locationName:"awsvpcConfiguration" type:"structure"` } @@ -3102,6 +5504,97 @@ func (s *NetworkConfiguration) SetAwsvpcConfiguration(v *AwsVpcConfiguration) *N return s } +// A partner event source is created by an SaaS partner. If a customer creates +// a partner event bus that matches this event source, that AWS account can +// receive events from the partner's applications or services. +type PartnerEventSource struct { + _ struct{} `type:"structure"` + + // The ARN of the partner event source. + Arn *string `type:"string"` + + // The name of the partner event source. + Name *string `type:"string"` +} + +// String returns the string representation +func (s PartnerEventSource) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PartnerEventSource) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *PartnerEventSource) SetArn(v string) *PartnerEventSource { + s.Arn = &v + return s +} + +// SetName sets the Name field's value. +func (s *PartnerEventSource) SetName(v string) *PartnerEventSource { + s.Name = &v + return s +} + +// The AWS account that a partner event source has been offered to. +type PartnerEventSourceAccount struct { + _ struct{} `type:"structure"` + + // The AWS account ID that the partner event source was offered to. + Account *string `min:"12" type:"string"` + + // The date and time when the event source was created. + CreationTime *time.Time `type:"timestamp"` + + // The date and time when the event source will expire if the AWS account doesn't + // create a matching event bus for it. + ExpirationTime *time.Time `type:"timestamp"` + + // The state of the event source. If it's ACTIVE, you have already created a + // matching event bus for this event source, and that event bus is active. If + // it's PENDING, either you haven't yet created a matching event bus, or that + // event bus is deactivated. If it's DELETED, you have created a matching event + // bus, but the event source has since been deleted. + State *string `type:"string" enum:"EventSourceState"` +} + +// String returns the string representation +func (s PartnerEventSourceAccount) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PartnerEventSourceAccount) GoString() string { + return s.String() +} + +// SetAccount sets the Account field's value. +func (s *PartnerEventSourceAccount) SetAccount(v string) *PartnerEventSourceAccount { + s.Account = &v + return s +} + +// SetCreationTime sets the CreationTime field's value. +func (s *PartnerEventSourceAccount) SetCreationTime(v time.Time) *PartnerEventSourceAccount { + s.CreationTime = &v + return s +} + +// SetExpirationTime sets the ExpirationTime field's value. +func (s *PartnerEventSourceAccount) SetExpirationTime(v time.Time) *PartnerEventSourceAccount { + s.ExpirationTime = &v + return s +} + +// SetState sets the State field's value. +func (s *PartnerEventSourceAccount) SetState(v string) *PartnerEventSourceAccount { + s.State = &v + return s +} + type PutEventsInput struct { _ struct{} `type:"structure"` @@ -3132,6 +5625,16 @@ func (s *PutEventsInput) Validate() error { if s.Entries != nil && len(s.Entries) < 1 { invalidParams.Add(request.NewErrParamMinLen("Entries", 1)) } + if s.Entries != nil { + for i, v := range s.Entries { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Entries", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -3183,22 +5686,26 @@ func (s *PutEventsOutput) SetFailedEntryCount(v int64) *PutEventsOutput { type PutEventsRequestEntry struct { _ struct{} `type:"structure"` - // A valid JSON string. There is no other schema imposed. The JSON string may + // A valid JSON string. There is no other schema imposed. The JSON string can // contain fields and nested subobjects. Detail *string `type:"string"` - // Free-form string used to decide what fields to expect in the event detail. + // Free-form string used to decide which fields to expect in the event detail. DetailType *string `type:"string"` - // AWS resources, identified by Amazon Resource Name (ARN), which the event - // primarily concerns. Any number, including zero, may be present. + // The event bus that will receive the event. Only the rules that are associated + // with this event bus can match the event. + EventBusName *string `min:"1" type:"string"` + + // AWS resources, identified by Amazon Resource Name (ARN), that the event primarily + // concerns. Any number, including zero, can be present. Resources []*string `type:"list"` // The source of the event. This field is required. Source *string `type:"string"` - // The time stamp of the event, per RFC3339 (https://www.rfc-editor.org/rfc/rfc3339.txt). - // If no time stamp is provided, the time stamp of the PutEvents call is used. + // The timestamp of the event, per RFC3339 (https://www.rfc-editor.org/rfc/rfc3339.txt). + // If no timestamp is provided, the timestamp of the PutEvents call is used. Time *time.Time `type:"timestamp"` } @@ -3212,6 +5719,19 @@ func (s PutEventsRequestEntry) GoString() string { return s.String() } +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutEventsRequestEntry) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutEventsRequestEntry"} + if s.EventBusName != nil && len(*s.EventBusName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventBusName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + // SetDetail sets the Detail field's value. func (s *PutEventsRequestEntry) SetDetail(v string) *PutEventsRequestEntry { s.Detail = &v @@ -3224,6 +5744,12 @@ func (s *PutEventsRequestEntry) SetDetailType(v string) *PutEventsRequestEntry { return s } +// SetEventBusName sets the EventBusName field's value. +func (s *PutEventsRequestEntry) SetEventBusName(v string) *PutEventsRequestEntry { + s.EventBusName = &v + return s +} + // SetResources sets the Resources field's value. func (s *PutEventsRequestEntry) SetResources(v []*string) *PutEventsRequestEntry { s.Resources = v @@ -3284,10 +5810,189 @@ func (s *PutEventsResultEntry) SetEventId(v string) *PutEventsResultEntry { return s } +type PutPartnerEventsInput struct { + _ struct{} `type:"structure"` + + // The list of events to write to the event bus. + // + // Entries is a required field + Entries []*PutPartnerEventsRequestEntry `min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s PutPartnerEventsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutPartnerEventsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutPartnerEventsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutPartnerEventsInput"} + if s.Entries == nil { + invalidParams.Add(request.NewErrParamRequired("Entries")) + } + if s.Entries != nil && len(s.Entries) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Entries", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEntries sets the Entries field's value. +func (s *PutPartnerEventsInput) SetEntries(v []*PutPartnerEventsRequestEntry) *PutPartnerEventsInput { + s.Entries = v + return s +} + +type PutPartnerEventsOutput struct { + _ struct{} `type:"structure"` + + // The list of events from this operation that were successfully written to + // the partner event bus. + Entries []*PutPartnerEventsResultEntry `type:"list"` + + // The number of events from this operation that couldn't be written to the + // partner event bus. + FailedEntryCount *int64 `type:"integer"` +} + +// String returns the string representation +func (s PutPartnerEventsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutPartnerEventsOutput) GoString() string { + return s.String() +} + +// SetEntries sets the Entries field's value. +func (s *PutPartnerEventsOutput) SetEntries(v []*PutPartnerEventsResultEntry) *PutPartnerEventsOutput { + s.Entries = v + return s +} + +// SetFailedEntryCount sets the FailedEntryCount field's value. +func (s *PutPartnerEventsOutput) SetFailedEntryCount(v int64) *PutPartnerEventsOutput { + s.FailedEntryCount = &v + return s +} + +// The details about an event generated by an SaaS partner. +type PutPartnerEventsRequestEntry struct { + _ struct{} `type:"structure"` + + // A valid JSON string. There is no other schema imposed. The JSON string can + // contain fields and nested subobjects. + Detail *string `type:"string"` + + // A free-form string used to decide which fields to expect in the event detail. + DetailType *string `type:"string"` + + // AWS resources, identified by Amazon Resource Name (ARN), that the event primarily + // concerns. Any number, including zero, can be present. + Resources []*string `type:"list"` + + // The event source that is generating the evntry. + Source *string `type:"string"` + + // The date and time of the event. + Time *time.Time `type:"timestamp"` +} + +// String returns the string representation +func (s PutPartnerEventsRequestEntry) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutPartnerEventsRequestEntry) GoString() string { + return s.String() +} + +// SetDetail sets the Detail field's value. +func (s *PutPartnerEventsRequestEntry) SetDetail(v string) *PutPartnerEventsRequestEntry { + s.Detail = &v + return s +} + +// SetDetailType sets the DetailType field's value. +func (s *PutPartnerEventsRequestEntry) SetDetailType(v string) *PutPartnerEventsRequestEntry { + s.DetailType = &v + return s +} + +// SetResources sets the Resources field's value. +func (s *PutPartnerEventsRequestEntry) SetResources(v []*string) *PutPartnerEventsRequestEntry { + s.Resources = v + return s +} + +// SetSource sets the Source field's value. +func (s *PutPartnerEventsRequestEntry) SetSource(v string) *PutPartnerEventsRequestEntry { + s.Source = &v + return s +} + +// SetTime sets the Time field's value. +func (s *PutPartnerEventsRequestEntry) SetTime(v time.Time) *PutPartnerEventsRequestEntry { + s.Time = &v + return s +} + +// Represents an event that a partner tried to generate but failed. +type PutPartnerEventsResultEntry struct { + _ struct{} `type:"structure"` + + // The error code that indicates why the event submission failed. + ErrorCode *string `type:"string"` + + // The error message that explains why the event submission failed. + ErrorMessage *string `type:"string"` + + // The ID of the event. + EventId *string `type:"string"` +} + +// String returns the string representation +func (s PutPartnerEventsResultEntry) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutPartnerEventsResultEntry) GoString() string { + return s.String() +} + +// SetErrorCode sets the ErrorCode field's value. +func (s *PutPartnerEventsResultEntry) SetErrorCode(v string) *PutPartnerEventsResultEntry { + s.ErrorCode = &v + return s +} + +// SetErrorMessage sets the ErrorMessage field's value. +func (s *PutPartnerEventsResultEntry) SetErrorMessage(v string) *PutPartnerEventsResultEntry { + s.ErrorMessage = &v + return s +} + +// SetEventId sets the EventId field's value. +func (s *PutPartnerEventsResultEntry) SetEventId(v string) *PutPartnerEventsResultEntry { + s.EventId = &v + return s +} + type PutPermissionInput struct { _ struct{} `type:"structure"` - // The action that you are enabling the other account to perform. Currently, + // The action that you're enabling the other account to perform. Currently, // this must be events:PutEvents. // // Action is a required field @@ -3295,31 +6000,35 @@ type PutPermissionInput struct { // This parameter enables you to limit the permission to accounts that fulfill // a certain condition, such as being a member of a certain AWS organization. - // For more information about AWS Organizations, see What Is AWS Organizations + // For more information about AWS Organizations, see What Is AWS Organizations? // (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_introduction.html) // in the AWS Organizations User Guide. // - // If you specify Condition with an AWS organization ID, and specify "*" as - // the value for Principal, you grant permission to all the accounts in the - // named organization. + // If you specify Condition with an AWS organization ID and specify "*" as the + // value for Principal, you grant permission to all the accounts in the named + // organization. // - // The Condition is a JSON string which must contain Type, Key, and Value fields. + // The Condition is a JSON string that must contain Type, Key, and Value fields. Condition *Condition `type:"structure"` + // The event bus associated with the rule. If you omit this, the default event + // bus is used. + EventBusName *string `min:"1" type:"string"` + // The 12-digit AWS account ID that you are permitting to put events to your // default event bus. Specify "*" to permit any account to put events to your // default event bus. // // If you specify "*" without specifying Condition, avoid creating rules that - // may match undesirable events. To create more secure rules, make sure that + // might match undesirable events. To create more secure rules, make sure that // the event pattern for each rule contains an account field with a specific - // account ID from which to receive events. Rules with an account field do not - // match any events sent from other accounts. + // account ID to receive events from. Rules with an account field don't match + // any events sent from other accounts. // // Principal is a required field Principal *string `min:"1" type:"string" required:"true"` - // An identifier string for the external account that you are granting permissions + // An identifier string for the external account that you're granting permissions // to. If you later want to revoke the permission for this external account, // specify this StatementId when you run RemovePermission. // @@ -3346,6 +6055,9 @@ func (s *PutPermissionInput) Validate() error { if s.Action != nil && len(*s.Action) < 1 { invalidParams.Add(request.NewErrParamMinLen("Action", 1)) } + if s.EventBusName != nil && len(*s.EventBusName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventBusName", 1)) + } if s.Principal == nil { invalidParams.Add(request.NewErrParamRequired("Principal")) } @@ -3382,6 +6094,12 @@ func (s *PutPermissionInput) SetCondition(v *Condition) *PutPermissionInput { return s } +// SetEventBusName sets the EventBusName field's value. +func (s *PutPermissionInput) SetEventBusName(v string) *PutPermissionInput { + s.EventBusName = &v + return s +} + // SetPrincipal sets the Principal field's value. func (s *PutPermissionInput) SetPrincipal(v string) *PutPermissionInput { s.Principal = &v @@ -3414,11 +6132,15 @@ type PutRuleInput struct { // A description of the rule. Description *string `type:"string"` - // The event pattern. For more information, see Events and Event Patterns (https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html) - // in the Amazon CloudWatch Events User Guide. + // The event bus to associate with this rule. If you omit this, the default + // event bus is used. + EventBusName *string `min:"1" type:"string"` + + // The event pattern. For more information, see Event Patterns (https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-and-event-patterns.html) + // in the Amazon EventBridge User Guide. EventPattern *string `type:"string"` - // The name of the rule that you are creating or updating. + // The name of the rule that you're creating or updating. // // Name is a required field Name *string `min:"1" type:"string" required:"true"` @@ -3426,7 +6148,7 @@ type PutRuleInput struct { // The Amazon Resource Name (ARN) of the IAM role associated with the rule. RoleArn *string `min:"1" type:"string"` - // The scheduling expression. For example, "cron(0 20 * * ? *)" or "rate(5 minutes)". + // The scheduling expression: for example, "cron(0 20 * * ? *)" or "rate(5 minutes)". ScheduleExpression *string `type:"string"` // Indicates whether the rule is enabled or disabled. @@ -3449,6 +6171,9 @@ func (s PutRuleInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *PutRuleInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "PutRuleInput"} + if s.EventBusName != nil && len(*s.EventBusName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventBusName", 1)) + } if s.Name == nil { invalidParams.Add(request.NewErrParamRequired("Name")) } @@ -3481,6 +6206,12 @@ func (s *PutRuleInput) SetDescription(v string) *PutRuleInput { return s } +// SetEventBusName sets the EventBusName field's value. +func (s *PutRuleInput) SetEventBusName(v string) *PutRuleInput { + s.EventBusName = &v + return s +} + // SetEventPattern sets the EventPattern field's value. func (s *PutRuleInput) SetEventPattern(v string) *PutRuleInput { s.EventPattern = &v @@ -3543,6 +6274,10 @@ func (s *PutRuleOutput) SetRuleArn(v string) *PutRuleOutput { type PutTargetsInput struct { _ struct{} `type:"structure"` + // The name of the event bus associated with the rule. If you omit this, the + // default event bus is used. + EventBusName *string `min:"1" type:"string"` + // The name of the rule. // // Rule is a required field @@ -3567,6 +6302,9 @@ func (s PutTargetsInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *PutTargetsInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "PutTargetsInput"} + if s.EventBusName != nil && len(*s.EventBusName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventBusName", 1)) + } if s.Rule == nil { invalidParams.Add(request.NewErrParamRequired("Rule")) } @@ -3596,6 +6334,12 @@ func (s *PutTargetsInput) Validate() error { return nil } +// SetEventBusName sets the EventBusName field's value. +func (s *PutTargetsInput) SetEventBusName(v string) *PutTargetsInput { + s.EventBusName = &v + return s +} + // SetRule sets the Rule field's value. func (s *PutTargetsInput) SetRule(v string) *PutTargetsInput { s.Rule = &v @@ -3687,6 +6431,10 @@ func (s *PutTargetsResultEntry) SetTargetId(v string) *PutTargetsResultEntry { type RemovePermissionInput struct { _ struct{} `type:"structure"` + // The name of the event bus to revoke permissions for. If you omit this, the + // default event bus is used. + EventBusName *string `min:"1" type:"string"` + // The statement ID corresponding to the account that is no longer allowed to // put events to the default event bus. // @@ -3707,6 +6455,9 @@ func (s RemovePermissionInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *RemovePermissionInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "RemovePermissionInput"} + if s.EventBusName != nil && len(*s.EventBusName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventBusName", 1)) + } if s.StatementId == nil { invalidParams.Add(request.NewErrParamRequired("StatementId")) } @@ -3720,6 +6471,12 @@ func (s *RemovePermissionInput) Validate() error { return nil } +// SetEventBusName sets the EventBusName field's value. +func (s *RemovePermissionInput) SetEventBusName(v string) *RemovePermissionInput { + s.EventBusName = &v + return s +} + // SetStatementId sets the StatementId field's value. func (s *RemovePermissionInput) SetStatementId(v string) *RemovePermissionInput { s.StatementId = &v @@ -3743,11 +6500,14 @@ func (s RemovePermissionOutput) GoString() string { type RemoveTargetsInput struct { _ struct{} `type:"structure"` - // If this is a managed rule, created by an AWS service on your behalf, you - // must specify Force as True to remove targets. This parameter is ignored for - // rules that are not managed rules. You can check whether a rule is a managed - // rule by using DescribeRule or ListRules and checking the ManagedBy field - // of the response. + // The name of the event bus associated with the rule. + EventBusName *string `min:"1" type:"string"` + + // If this is a managed rule created by an AWS service on your behalf, you must + // specify Force as True to remove targets. This parameter is ignored for rules + // that aren't managed rules. You can check whether a rule is a managed rule + // by using DescribeRule or ListRules and checking the ManagedBy field of the + // response. Force *bool `type:"boolean"` // The IDs of the targets to remove from the rule. @@ -3774,6 +6534,9 @@ func (s RemoveTargetsInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *RemoveTargetsInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "RemoveTargetsInput"} + if s.EventBusName != nil && len(*s.EventBusName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EventBusName", 1)) + } if s.Ids == nil { invalidParams.Add(request.NewErrParamRequired("Ids")) } @@ -3793,6 +6556,12 @@ func (s *RemoveTargetsInput) Validate() error { return nil } +// SetEventBusName sets the EventBusName field's value. +func (s *RemoveTargetsInput) SetEventBusName(v string) *RemoveTargetsInput { + s.EventBusName = &v + return s +} + // SetForce sets the Force field's value. func (s *RemoveTargetsInput) SetForce(v bool) *RemoveTargetsInput { s.Force = &v @@ -3887,7 +6656,7 @@ func (s *RemoveTargetsResultEntry) SetTargetId(v string) *RemoveTargetsResultEnt return s } -// Contains information about a rule in Amazon CloudWatch Events. +// Contains information about a rule in Amazon EventBridge. type Rule struct { _ struct{} `type:"structure"` @@ -3897,13 +6666,15 @@ type Rule struct { // The description of the rule. Description *string `type:"string"` - // The event pattern of the rule. For more information, see Events and Event - // Patterns (https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html) - // in the Amazon CloudWatch Events User Guide. + // The event bus associated with the rule. + EventBusName *string `min:"1" type:"string"` + + // The event pattern of the rule. For more information, see Event Patterns (https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-and-event-patterns.html) + // in the Amazon EventBridge User Guide. EventPattern *string `type:"string"` - // If the rule was created on behalf of your account by an AWS service, this - // field displays the principal name of the service that created the rule. + // If an AWS service created the rule on behalf of your account, this field + // displays the principal name of the service that created the rule. ManagedBy *string `min:"1" type:"string"` // The name of the rule. @@ -3912,7 +6683,7 @@ type Rule struct { // The Amazon Resource Name (ARN) of the role that is used for target invocation. RoleArn *string `min:"1" type:"string"` - // The scheduling expression. For example, "cron(0 20 * * ? *)", "rate(5 minutes)". + // The scheduling expression: for example, "cron(0 20 * * ? *)" or "rate(5 minutes)". ScheduleExpression *string `type:"string"` // The state of the rule. @@ -3941,6 +6712,12 @@ func (s *Rule) SetDescription(v string) *Rule { return s } +// SetEventBusName sets the EventBusName field's value. +func (s *Rule) SetEventBusName(v string) *Rule { + s.EventBusName = &v + return s +} + // SetEventPattern sets the EventPattern field's value. func (s *Rule) SetEventPattern(v string) *Rule { s.EventPattern = &v @@ -4033,7 +6810,7 @@ func (s *RunCommandParameters) SetRunCommandTargets(v []*RunCommandTarget) *RunC // Information about the EC2 instances that are to be sent the command, specified // as key-value pairs. Each RunCommandTarget block can include only one key, -// but this key may specify multiple values. +// but this key can specify multiple values. type RunCommandTarget struct { _ struct{} `type:"structure"` @@ -4118,13 +6895,13 @@ func (s *SqsParameters) SetMessageGroupId(v string) *SqsParameters { return s } -// A key-value pair associated with an AWS resource. In CloudWatch Events, rules -// support tagging. +// A key-value pair associated with an AWS resource. In EventBridge, rules support +// tagging. type Tag struct { _ struct{} `type:"structure"` - // A string you can use to assign a value. The combination of tag keys and values - // can help you organize and categorize your resources. + // A string that you can use to assign a value. The combination of tag keys + // and values can help you organize and categorize your resources. // // Key is a required field Key *string `min:"1" type:"string" required:"true"` @@ -4179,7 +6956,7 @@ func (s *Tag) SetValue(v string) *Tag { type TagResourceInput struct { _ struct{} `type:"structure"` - // The ARN of the CloudWatch Events rule that you're adding tags to. + // The ARN of the rule that you're adding tags to. // // ResourceARN is a required field ResourceARN *string `min:"1" type:"string" required:"true"` @@ -4258,12 +7035,12 @@ func (s TagResourceOutput) GoString() string { // Targets are the resources to be invoked when a rule is triggered. For a complete // list of services and resources that can be set as a target, see PutTargets. // -// If you are setting the event bus of another account as the target, and that +// If you're setting the event bus of another account as the target and that // account granted permission to your account through an organization instead -// of directly by the account ID, then you must specify a RoleArn with proper -// permissions in the Target structure. For more information, see Sending and -// Receiving Events Between AWS Accounts (https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEvents-CrossAccountEventDelivery.html) -// in the Amazon CloudWatch Events User Guide. +// of directly by the account ID, you must specify a RoleArn with proper permissions +// in the Target structure. For more information, see Sending and Receiving +// Events Between AWS Accounts (https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-cross-account-event-delivery.html) +// in the Amazon EventBridge User Guide. type Target struct { _ struct{} `type:"structure"` @@ -4277,7 +7054,7 @@ type Target struct { // in the AWS Batch User Guide. BatchParameters *BatchParameters `type:"structure"` - // Contains the Amazon ECS task definition and task count to be used, if the + // Contains the Amazon ECS task definition and task count to be used if the // event target is an Amazon ECS task. For more information about Amazon ECS // tasks, see Task Definitions (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_defintions.html) // in the Amazon EC2 Container Service Developer Guide. @@ -4303,9 +7080,9 @@ type Target struct { // then use that data to send customized input to the target. InputTransformer *InputTransformer `type:"structure"` - // The custom parameter you can use to control the shard assignment, when the - // target is a Kinesis data stream. If you do not include this parameter, the - // default is to use the eventId as the partition key. + // The custom parameter that you can use to control the shard assignment when + // the target is a Kinesis data stream. If you don't include this parameter, + // the default is to use the eventId as the partition key. KinesisParameters *KinesisParameters `type:"structure"` // The Amazon Resource Name (ARN) of the IAM role to be used for this target @@ -4457,8 +7234,8 @@ type TestEventPatternInput struct { // Event is a required field Event *string `type:"string" required:"true"` - // The event pattern. For more information, see Events and Event Patterns (https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html) - // in the Amazon CloudWatch Events User Guide. + // The event pattern. For more information, see Event Patterns (https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-and-event-patterns.html) + // in the Amazon EventBridge User Guide. // // EventPattern is a required field EventPattern *string `type:"string" required:"true"` @@ -4528,7 +7305,7 @@ func (s *TestEventPatternOutput) SetResult(v bool) *TestEventPatternOutput { type UntagResourceInput struct { _ struct{} `type:"structure"` - // The ARN of the CloudWatch Events rule from which you are removing tags. + // The ARN of the rule that you're removing tags from. // // ResourceARN is a required field ResourceARN *string `min:"1" type:"string" required:"true"` @@ -4602,6 +7379,17 @@ const ( AssignPublicIpDisabled = "DISABLED" ) +const ( + // EventSourceStatePending is a EventSourceState enum value + EventSourceStatePending = "PENDING" + + // EventSourceStateActive is a EventSourceState enum value + EventSourceStateActive = "ACTIVE" + + // EventSourceStateDeleted is a EventSourceState enum value + EventSourceStateDeleted = "DELETED" +) + const ( // LaunchTypeEc2 is a LaunchType enum value LaunchTypeEc2 = "EC2" diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/doc.go b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/doc.go index da232b4853ae..e6efe0fa2595 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/doc.go @@ -3,25 +3,25 @@ // Package cloudwatchevents provides the client and types for making API // requests to Amazon CloudWatch Events. // -// Amazon CloudWatch Events helps you to respond to state changes in your AWS -// resources. When your resources change state, they automatically send events -// into an event stream. You can create rules that match selected events in -// the stream and route them to targets to take action. You can also use rules -// to take action on a predetermined schedule. For example, you can configure -// rules to: +// Amazon EventBridge helps you to respond to state changes in your AWS resources. +// When your resources change state, they automatically send events into an +// event stream. You can create rules that match selected events in the stream +// and route them to targets to take action. You can also use rules to take +// action on a predetermined schedule. For example, you can configure rules +// to: // // * Automatically invoke an AWS Lambda function to update DNS entries when -// an event notifies you that Amazon EC2 instance enters the running state. +// an event notifies you that Amazon EC2 instance enters the running state // // * Direct specific API records from AWS CloudTrail to an Amazon Kinesis // data stream for detailed analysis of potential security or availability -// risks. +// risks // // * Periodically invoke a built-in target to create a snapshot of an Amazon -// EBS volume. +// EBS volume // -// For more information about the features of Amazon CloudWatch Events, see -// the Amazon CloudWatch Events User Guide (https://docs.aws.amazon.com/AmazonCloudWatch/latest/events). +// For more information about the features of Amazon EventBridge, see the Amazon +// EventBridge User Guide (https://docs.aws.amazon.com/eventbridge/latest/userguide/). // // See https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07 for more information on this service. // diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/errors.go b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/errors.go index bab0f862f5eb..24efbdc16438 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/errors.go @@ -7,7 +7,7 @@ const ( // ErrCodeConcurrentModificationException for service response error code // "ConcurrentModificationException". // - // There is concurrent modification on a rule or target. + // There is concurrent modification on a resource. ErrCodeConcurrentModificationException = "ConcurrentModificationException" // ErrCodeInternalException for service response error code @@ -19,24 +19,29 @@ const ( // ErrCodeInvalidEventPatternException for service response error code // "InvalidEventPatternException". // - // The event pattern is not valid. + // The event pattern isn't valid. ErrCodeInvalidEventPatternException = "InvalidEventPatternException" + // ErrCodeInvalidStateException for service response error code + // "InvalidStateException". + // + // The specified state isn't a valid state for an event source. + ErrCodeInvalidStateException = "InvalidStateException" + // ErrCodeLimitExceededException for service response error code // "LimitExceededException". // - // You tried to create more rules or add more targets to a rule than is allowed. + // You tried to create more resources than is allowed. ErrCodeLimitExceededException = "LimitExceededException" // ErrCodeManagedRuleException for service response error code // "ManagedRuleException". // - // This rule was created by an AWS service on behalf of your account. It is - // managed by that service. If you see this error in response to DeleteRule - // or RemoveTargets, you can use the Force parameter in those calls to delete - // the rule or remove targets from the rule. You cannot modify these managed - // rules by using DisableRule, EnableRule, PutTargets, PutRule, TagResource, - // or UntagResource. + // An AWS service created this rule on behalf of your account. That service + // manages it. If you see this error in response to DeleteRule or RemoveTargets, + // you can use the Force parameter in those calls to delete the rule or remove + // targets from the rule. You can't modify these managed rules by using DisableRule, + // EnableRule, PutTargets, PutRule, TagResource, or UntagResource. ErrCodeManagedRuleException = "ManagedRuleException" // ErrCodePolicyLengthExceededException for service response error code @@ -45,9 +50,15 @@ const ( // The event bus policy is too long. For more information, see the limits. ErrCodePolicyLengthExceededException = "PolicyLengthExceededException" + // ErrCodeResourceAlreadyExistsException for service response error code + // "ResourceAlreadyExistsException". + // + // The resource that you're trying to create already exists. + ErrCodeResourceAlreadyExistsException = "ResourceAlreadyExistsException" + // ErrCodeResourceNotFoundException for service response error code // "ResourceNotFoundException". // - // An entity that you specified does not exist. + // An entity that you specified doesn't exist. ErrCodeResourceNotFoundException = "ResourceNotFoundException" ) diff --git a/vendor/github.com/aws/aws-sdk-go/service/glacier/api.go b/vendor/github.com/aws/aws-sdk-go/service/glacier/api.go index a0e132c3f6b3..4e54a116d59b 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/glacier/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/glacier/api.go @@ -70,11 +70,11 @@ func (c *Glacier) AbortMultipartUploadRequest(input *AbortMultipartUploadInput) // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and underlying REST API, see Working with Archives -// in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html) -// and Abort Multipart Upload (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-abort-upload.html) +// in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html) +// and Abort Multipart Upload (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-abort-upload.html) // in the Amazon Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -171,9 +171,9 @@ func (c *Glacier) AbortVaultLockRequest(input *AbortVaultLockInput) (req *reques // A vault lock is put into the InProgress state by calling InitiateVaultLock. // A vault lock is put into the Locked state by calling CompleteVaultLock. You // can get the state of a vault lock by calling GetVaultLock. For more information -// about the vault locking process, see Amazon Glacier Vault Lock (http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock.html). +// about the vault locking process, see Amazon Glacier Vault Lock (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock.html). // For more information about vault lock policies, see Amazon Glacier Access -// Control with Vault Lock Policies (http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock-policy.html). +// Control with Vault Lock Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock-policy.html). // // This operation is idempotent. You can successfully invoke this operation // multiple times, if the vault lock is in the InProgress state or if there @@ -269,7 +269,7 @@ func (c *Glacier) AddTagsToVaultRequest(input *AddTagsToVaultInput) (req *reques // cause the tag limit for the vault to be exceeded, the operation throws the // LimitExceededException error. If a tag already exists on the vault under // a specified key, the existing key value will be overwritten. For more information -// about tags, see Tagging Amazon Glacier Resources (http://docs.aws.amazon.com/amazonglacier/latest/dev/tagging.html). +// about tags, see Tagging Amazon S3 Glacier Resources (https://docs.aws.amazon.com/amazonglacier/latest/dev/tagging.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -358,28 +358,28 @@ func (c *Glacier) CompleteMultipartUploadRequest(input *CompleteMultipartUploadI // CompleteMultipartUpload API operation for Amazon Glacier. // -// You call this operation to inform Amazon Glacier that all the archive parts -// have been uploaded and that Amazon Glacier can now assemble the archive from -// the uploaded parts. After assembling and saving the archive to the vault, -// Amazon Glacier returns the URI path of the newly created archive resource. -// Using the URI path, you can then access the archive. After you upload an -// archive, you should save the archive ID returned to retrieve the archive -// at a later point. You can also get the vault inventory to obtain a list of -// archive IDs in a vault. For more information, see InitiateJob. +// You call this operation to inform Amazon S3 Glacier (Glacier) that all the +// archive parts have been uploaded and that Glacier can now assemble the archive +// from the uploaded parts. After assembling and saving the archive to the vault, +// Glacier returns the URI path of the newly created archive resource. Using +// the URI path, you can then access the archive. After you upload an archive, +// you should save the archive ID returned to retrieve the archive at a later +// point. You can also get the vault inventory to obtain a list of archive IDs +// in a vault. For more information, see InitiateJob. // // In the request, you must include the computed SHA256 tree hash of the entire // archive you have uploaded. For information about computing a SHA256 tree -// hash, see Computing Checksums (http://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html). -// On the server side, Amazon Glacier also constructs the SHA256 tree hash of -// the assembled archive. If the values match, Amazon Glacier saves the archive -// to the vault; otherwise, it returns an error, and the operation fails. The -// ListParts operation returns a list of parts uploaded for a specific multipart -// upload. It includes checksum information for each uploaded part that can -// be used to debug a bad checksum issue. -// -// Additionally, Amazon Glacier also checks for any missing content ranges when -// assembling the archive, if missing content ranges are found, Amazon Glacier -// returns an error and the operation fails. +// hash, see Computing Checksums (https://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html). +// On the server side, Glacier also constructs the SHA256 tree hash of the assembled +// archive. If the values match, Glacier saves the archive to the vault; otherwise, +// it returns an error, and the operation fails. The ListParts operation returns +// a list of parts uploaded for a specific multipart upload. It includes checksum +// information for each uploaded part that can be used to debug a bad checksum +// issue. +// +// Additionally, Glacier also checks for any missing content ranges when assembling +// the archive, if missing content ranges are found, Glacier returns an error +// and the operation fails. // // Complete Multipart Upload is an idempotent operation. After your first successful // complete multipart upload, if you call the operation again within a short @@ -396,11 +396,11 @@ func (c *Glacier) CompleteMultipartUploadRequest(input *CompleteMultipartUploadI // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and underlying REST API, see Uploading Large Archives -// in Parts (Multipart Upload) (http://docs.aws.amazon.com/amazonglacier/latest/dev/uploading-archive-mpu.html) -// and Complete Multipart Upload (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-complete-upload.html) +// in Parts (Multipart Upload) (https://docs.aws.amazon.com/amazonglacier/latest/dev/uploading-archive-mpu.html) +// and Complete Multipart Upload (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-complete-upload.html) // in the Amazon Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -493,7 +493,7 @@ func (c *Glacier) CompleteVaultLockRequest(input *CompleteVaultLockInput) (req * // lock policy to become unchangeable. A vault lock is put into the InProgress // state by calling InitiateVaultLock. You can obtain the state of the vault // lock by calling GetVaultLock. For more information about the vault locking -// process, Amazon Glacier Vault Lock (http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock.html). +// process, Amazon Glacier Vault Lock (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock.html). // // This operation is idempotent. This request is always successful if the vault // lock is in the Locked state and the provided lock ID matches the lock ID @@ -591,7 +591,7 @@ func (c *Glacier) CreateVaultRequest(input *CreateVaultInput) (req *request.Requ // This operation creates a new vault with the specified name. The name of the // vault must be unique within a region for an AWS account. You can create up // to 1,000 vaults per account. If you need to create more vaults, contact Amazon -// Glacier. +// S3 Glacier. // // You must use the following guidelines when naming a vault. // @@ -606,11 +606,11 @@ func (c *Glacier) CreateVaultRequest(input *CreateVaultInput) (req *request.Requ // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and underlying REST API, see Creating a Vault -// in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/creating-vaults.html) -// and Create Vault (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-put.html) +// in Amazon Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/creating-vaults.html) +// and Create Vault (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-put.html) // in the Amazon Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -702,11 +702,11 @@ func (c *Glacier) DeleteArchiveRequest(input *DeleteArchiveInput) (req *request. // for this archive ID may or may not succeed according to the following scenarios: // // * If the archive retrieval job is actively preparing the data for download -// when Amazon Glacier receives the delete archive request, the archival +// when Amazon S3 Glacier receives the delete archive request, the archival // retrieval operation might fail. // // * If the archive retrieval job has successfully prepared the archive for -// download when Amazon Glacier receives the delete archive request, you +// download when Amazon S3 Glacier receives the delete archive request, you // will be able to download the output. // // This operation is idempotent. Attempting to delete an already-deleted archive @@ -716,11 +716,11 @@ func (c *Glacier) DeleteArchiveRequest(input *DeleteArchiveInput) (req *request. // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and underlying REST API, see Deleting an Archive -// in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/deleting-an-archive.html) -// and Delete Archive (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-delete.html) +// in Amazon Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/deleting-an-archive.html) +// and Delete Archive (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-delete.html) // in the Amazon Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -808,16 +808,16 @@ func (c *Glacier) DeleteVaultRequest(input *DeleteVaultInput) (req *request.Requ // DeleteVault API operation for Amazon Glacier. // -// This operation deletes a vault. Amazon Glacier will delete a vault only if -// there are no archives in the vault as of the last inventory and there have -// been no writes to the vault since the last inventory. If either of these +// This operation deletes a vault. Amazon S3 Glacier will delete a vault only +// if there are no archives in the vault as of the last inventory and there +// have been no writes to the vault since the last inventory. If either of these // conditions is not satisfied, the vault deletion fails (that is, the vault -// is not removed) and Amazon Glacier returns an error. You can use DescribeVault +// is not removed) and Amazon S3 Glacier returns an error. You can use DescribeVault // to return the number of archives in a vault, and you can use Initiate a Job -// (POST jobs) (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-initiate-job-post.html) +// (POST jobs) (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-initiate-job-post.html) // to initiate a new inventory retrieval for a vault. The inventory contains // the archive IDs you use to delete archives using Delete Archive (DELETE archive) -// (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-delete.html). +// (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-delete.html). // // This operation is idempotent. // @@ -825,12 +825,12 @@ func (c *Glacier) DeleteVaultRequest(input *DeleteVaultInput) (req *request.Requ // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and underlying REST API, see Deleting a Vault -// in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/deleting-vaults.html) -// and Delete Vault (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-delete.html) -// in the Amazon Glacier Developer Guide. +// in Amazon Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/deleting-vaults.html) +// and Delete Vault (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-delete.html) +// in the Amazon S3 Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -919,14 +919,14 @@ func (c *Glacier) DeleteVaultAccessPolicyRequest(input *DeleteVaultAccessPolicyI // // This operation deletes the access policy associated with the specified vault. // The operation is eventually consistent; that is, it might take some time -// for Amazon Glacier to completely remove the access policy, and you might +// for Amazon S3 Glacier to completely remove the access policy, and you might // still see the effect of the policy for a short time after you send the delete // request. // // This operation is idempotent. You can invoke delete multiple times, even // if there is no policy associated with the vault. For more information about // vault access policies, see Amazon Glacier Access Control with Vault Access -// Policies (http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html). +// Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -1015,19 +1015,19 @@ func (c *Glacier) DeleteVaultNotificationsRequest(input *DeleteVaultNotification // // This operation deletes the notification configuration set for a vault. The // operation is eventually consistent; that is, it might take some time for -// Amazon Glacier to completely disable the notifications and you might still +// Amazon S3 Glacier to completely disable the notifications and you might still // receive some notifications for a short time after you send the delete request. // // An AWS account has full permission to perform all operations (actions). However, // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and underlying REST API, see Configuring Vault -// Notifications in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications.html) -// and Delete Vault Notification Configuration (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-notifications-delete.html) -// in the Amazon Glacier Developer Guide. +// Notifications in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications.html) +// and Delete Vault Notification Configuration (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-notifications-delete.html) +// in the Amazon S3 Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -1115,25 +1115,26 @@ func (c *Glacier) DescribeJobRequest(input *DescribeJobInput) (req *request.Requ // // This operation returns information about a job you previously initiated, // including the job initiation date, the user who initiated the job, the job -// status code/message and the Amazon SNS topic to notify after Amazon Glacier -// completes the job. For more information about initiating a job, see InitiateJob. +// status code/message and the Amazon SNS topic to notify after Amazon S3 Glacier +// (Glacier) completes the job. For more information about initiating a job, +// see InitiateJob. // // This operation enables you to check the status of your job. However, it is // strongly recommended that you set up an Amazon SNS topic and specify it in -// your initiate job request so that Amazon Glacier can notify the topic after -// it completes the job. -// -// A job ID will not expire for at least 24 hours after Amazon Glacier completes +// your initiate job request so that Glacier can notify the topic after it completes // the job. // +// A job ID will not expire for at least 24 hours after Glacier completes the +// job. +// // An AWS account has full permission to perform all operations (actions). However, // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For more information about using this operation, see the documentation for -// the underlying REST API Describe Job (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-describe-job-get.html) +// the underlying REST API Describe Job (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-describe-job-get.html) // in the Amazon Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -1227,18 +1228,18 @@ func (c *Glacier) DescribeVaultRequest(input *DescribeVaultInput) (req *request. // This means that if you add or remove an archive from a vault, and then immediately // use Describe Vault, the change in contents will not be immediately reflected. // If you want to retrieve the latest inventory of the vault, use InitiateJob. -// Amazon Glacier generates vault inventories approximately daily. For more -// information, see Downloading a Vault Inventory in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-inventory.html). +// Amazon S3 Glacier generates vault inventories approximately daily. For more +// information, see Downloading a Vault Inventory in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-inventory.html). // // An AWS account has full permission to perform all operations (actions). However, // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and underlying REST API, see Retrieving Vault -// Metadata in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/retrieving-vault-info.html) -// and Describe Vault (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-get.html) +// Metadata in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/retrieving-vault-info.html) +// and Describe Vault (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-get.html) // in the Amazon Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -1327,7 +1328,7 @@ func (c *Glacier) GetDataRetrievalPolicyRequest(input *GetDataRetrievalPolicyInp // // This operation returns the current data retrieval policy for the account // and region specified in the GET request. For more information about data -// retrieval policies, see Amazon Glacier Data Retrieval Policies (http://docs.aws.amazon.com/amazonglacier/latest/dev/data-retrieval-policy.html). +// retrieval policies, see Amazon Glacier Data Retrieval Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/data-retrieval-policy.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -1415,14 +1416,14 @@ func (c *Glacier) GetJobOutputRequest(input *GetJobOutputInput) (req *request.Re // // You can download all the job output or download a portion of the output by // specifying a byte range. In the case of an archive retrieval job, depending -// on the byte range you specify, Amazon Glacier returns the checksum for the -// portion of the data. You can compute the checksum on the client and verify -// that the values match to ensure the portion you downloaded is the correct -// data. -// -// A job ID will not expire for at least 24 hours after Amazon Glacier completes -// the job. That a byte range. For both archive and inventory retrieval jobs, -// you should verify the downloaded size against the size returned in the headers +// on the byte range you specify, Amazon S3 Glacier (Glacier) returns the checksum +// for the portion of the data. You can compute the checksum on the client and +// verify that the values match to ensure the portion you downloaded is the +// correct data. +// +// A job ID will not expire for at least 24 hours after Glacier completes the +// job. That a byte range. For both archive and inventory retrieval jobs, you +// should verify the downloaded size against the size returned in the headers // from the Get Job Output response. // // For archive retrieval jobs, you should also verify that the size is what @@ -1430,29 +1431,29 @@ func (c *Glacier) GetJobOutputRequest(input *GetJobOutputInput) (req *request.Re // is based on the range of bytes you specified. For example, if you specify // a range of bytes=0-1048575, you should verify your download size is 1,048,576 // bytes. If you download an entire archive, the expected size is the size of -// the archive when you uploaded it to Amazon Glacier The expected size is also -// returned in the headers from the Get Job Output response. +// the archive when you uploaded it to Amazon S3 Glacier The expected size is +// also returned in the headers from the Get Job Output response. // // In the case of an archive retrieval job, depending on the byte range you -// specify, Amazon Glacier returns the checksum for the portion of the data. -// To ensure the portion you downloaded is the correct data, compute the checksum -// on the client, verify that the values match, and verify that the size is -// what you expected. +// specify, Glacier returns the checksum for the portion of the data. To ensure +// the portion you downloaded is the correct data, compute the checksum on the +// client, verify that the values match, and verify that the size is what you +// expected. // -// A job ID does not expire for at least 24 hours after Amazon Glacier completes -// the job. That is, you can download the job output within the 24 hours period +// A job ID does not expire for at least 24 hours after Glacier completes the +// job. That is, you can download the job output within the 24 hours period // after Amazon Glacier completes the job. // // An AWS account has full permission to perform all operations (actions). However, // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and the underlying REST API, see Downloading a -// Vault Inventory (http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-inventory.html), -// Downloading an Archive (http://docs.aws.amazon.com/amazonglacier/latest/dev/downloading-an-archive.html), -// and Get Job Output (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-job-output-get.html) +// Vault Inventory (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-inventory.html), +// Downloading an Archive (https://docs.aws.amazon.com/amazonglacier/latest/dev/downloading-an-archive.html), +// and Get Job Output (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-job-output-get.html) // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -1540,10 +1541,10 @@ func (c *Glacier) GetVaultAccessPolicyRequest(input *GetVaultAccessPolicyInput) // // This operation retrieves the access-policy subresource set on the vault; // for more information on setting this subresource, see Set Vault Access Policy -// (PUT access-policy) (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-SetVaultAccessPolicy.html). +// (PUT access-policy) (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-SetVaultAccessPolicy.html). // If there is no access policy set on the vault, the operation returns a 404 // Not found error. For more information about vault access policies, see Amazon -// Glacier Access Control with Vault Access Policies (http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html). +// Glacier Access Control with Vault Access Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -1644,11 +1645,11 @@ func (c *Glacier) GetVaultLockRequest(input *GetVaultLockInput) (req *request.Re // A vault lock is put into the InProgress state by calling InitiateVaultLock. // A vault lock is put into the Locked state by calling CompleteVaultLock. You // can abort the vault locking process by calling AbortVaultLock. For more information -// about the vault locking process, Amazon Glacier Vault Lock (http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock.html). +// about the vault locking process, Amazon Glacier Vault Lock (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock.html). // // If there is no vault lock policy set on the vault, the operation returns // a 404 Not found error. For more information about vault lock policies, Amazon -// Glacier Access Control with Vault Lock Policies (http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock-policy.html). +// Glacier Access Control with Vault Lock Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock-policy.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -1740,18 +1741,18 @@ func (c *Glacier) GetVaultNotificationsRequest(input *GetVaultNotificationsInput // For information about setting a notification configuration on a vault, see // SetVaultNotifications. If a notification configuration for a vault is not // set, the operation returns a 404 Not Found error. For more information about -// vault notifications, see Configuring Vault Notifications in Amazon Glacier -// (http://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications.html). +// vault notifications, see Configuring Vault Notifications in Amazon S3 Glacier +// (https://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications.html). // // An AWS account has full permission to perform all operations (actions). However, // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and underlying REST API, see Configuring Vault -// Notifications in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications.html) -// and Get Vault Notification Configuration (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-notifications-get.html) +// Notifications in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications.html) +// and Get Vault Notification Configuration (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-notifications-get.html) // in the Amazon Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -1841,7 +1842,7 @@ func (c *Glacier) InitiateJobRequest(input *InitiateJobInput) (req *request.Requ // This operation initiates a job of the specified type, which can be a select, // an archival retrieval, or a vault retrieval. For more information about using // this operation, see the documentation for the underlying REST API Initiate -// a Job (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-initiate-job-post.html). +// a Job (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-initiate-job-post.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -1936,9 +1937,10 @@ func (c *Glacier) InitiateMultipartUploadRequest(input *InitiateMultipartUploadI // InitiateMultipartUpload API operation for Amazon Glacier. // -// This operation initiates a multipart upload. Amazon Glacier creates a multipart -// upload resource and returns its ID in the response. The multipart upload -// ID is used in subsequent requests to upload parts of an archive (see UploadMultipartPart). +// This operation initiates a multipart upload. Amazon S3 Glacier creates a +// multipart upload resource and returns its ID in the response. The multipart +// upload ID is used in subsequent requests to upload parts of an archive (see +// UploadMultipartPart). // // When you initiate a multipart upload, you specify the part size in number // of bytes. The part size must be a megabyte (1024 KB) multiplied by a power @@ -1953,23 +1955,23 @@ func (c *Glacier) InitiateMultipartUploadRequest(input *InitiateMultipartUploadI // parts of 4 MB each and one part of 0.2 MB. // // You don't need to know the size of the archive when you start a multipart -// upload because Amazon Glacier does not require you to specify the overall +// upload because Amazon S3 Glacier does not require you to specify the overall // archive size. // -// After you complete the multipart upload, Amazon Glacier removes the multipart -// upload resource referenced by the ID. Amazon Glacier also removes the multipart -// upload resource if you cancel the multipart upload or it may be removed if -// there is no activity for a period of 24 hours. +// After you complete the multipart upload, Amazon S3 Glacier (Glacier) removes +// the multipart upload resource referenced by the ID. Glacier also removes +// the multipart upload resource if you cancel the multipart upload or it may +// be removed if there is no activity for a period of 24 hours. // // An AWS account has full permission to perform all operations (actions). However, // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and underlying REST API, see Uploading Large Archives -// in Parts (Multipart Upload) (http://docs.aws.amazon.com/amazonglacier/latest/dev/uploading-archive-mpu.html) -// and Initiate Multipart Upload (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-initiate-upload.html) +// in Parts (Multipart Upload) (https://docs.aws.amazon.com/amazonglacier/latest/dev/uploading-archive-mpu.html) +// and Initiate Multipart Upload (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-initiate-upload.html) // in the Amazon Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -2066,7 +2068,7 @@ func (c *Glacier) InitiateVaultLockRequest(input *InitiateVaultLockInput) (req * // // You can set one vault lock policy for each vault and this policy can be up // to 20 KB in size. For more information about vault lock policies, see Amazon -// Glacier Access Control with Vault Lock Policies (http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock-policy.html). +// Glacier Access Control with Vault Lock Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock-policy.html). // // You must complete the vault locking process within 24 hours after the vault // lock enters the InProgress state. After the 24 hour window ends, the lock @@ -2079,7 +2081,7 @@ func (c *Glacier) InitiateVaultLockRequest(input *InitiateVaultLockInput) (req * // // You can abort the vault locking process by calling AbortVaultLock. You can // get the state of the vault lock by calling GetVaultLock. For more information -// about the vault locking process, Amazon Glacier Vault Lock (http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock.html). +// about the vault locking process, Amazon Glacier Vault Lock (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock.html). // // If this operation is called when the vault lock is in the InProgress state, // the operation returns an AccessDeniedException error. When the vault lock @@ -2211,7 +2213,7 @@ func (c *Glacier) ListJobsRequest(input *ListJobsInput) (req *request.Request, o // (false). // // For more information about using this operation, see the documentation for -// the underlying REST API List Jobs (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-jobs-get.html). +// the underlying REST API List Jobs (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-jobs-get.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -2377,11 +2379,11 @@ func (c *Glacier) ListMultipartUploadsRequest(input *ListMultipartUploadsInput) // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and the underlying REST API, see Working with -// Archives in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html) -// and List Multipart Uploads (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-list-uploads.html) +// Archives in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html) +// and List Multipart Uploads (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-list-uploads.html) // in the Amazon Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -2542,11 +2544,11 @@ func (c *Glacier) ListPartsRequest(input *ListPartsInput) (req *request.Request, // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and the underlying REST API, see Working with -// Archives in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html) -// and List Parts (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-list-parts.html) +// Archives in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html) +// and List Parts (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-list-parts.html) // in the Amazon Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -2768,7 +2770,7 @@ func (c *Glacier) ListTagsForVaultRequest(input *ListTagsForVaultInput) (req *re // // This operation lists all the tags attached to a vault. The operation returns // an empty map if there are no tags. For more information about tags, see Tagging -// Amazon Glacier Resources (http://docs.aws.amazon.com/amazonglacier/latest/dev/tagging.html). +// Amazon S3 Glacier Resources (https://docs.aws.amazon.com/amazonglacier/latest/dev/tagging.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -2875,11 +2877,11 @@ func (c *Glacier) ListVaultsRequest(input *ListVaultsInput) (req *request.Reques // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and underlying REST API, see Retrieving Vault -// Metadata in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/retrieving-vault-info.html) -// and List Vaults (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-vaults-get.html) +// Metadata in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/retrieving-vault-info.html) +// and List Vaults (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vaults-get.html) // in the Amazon Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -3103,8 +3105,8 @@ func (c *Glacier) RemoveTagsFromVaultRequest(input *RemoveTagsFromVaultInput) (r // RemoveTagsFromVault API operation for Amazon Glacier. // // This operation removes one or more tags from the set of tags attached to -// a vault. For more information about tags, see Tagging Amazon Glacier Resources -// (http://docs.aws.amazon.com/amazonglacier/latest/dev/tagging.html). This +// a vault. For more information about tags, see Tagging Amazon S3 Glacier Resources +// (https://docs.aws.amazon.com/amazonglacier/latest/dev/tagging.html). This // operation is idempotent. The operation will be successful, even if there // are no tags attached to the vault. // @@ -3199,7 +3201,7 @@ func (c *Glacier) SetDataRetrievalPolicyRequest(input *SetDataRetrievalPolicyInp // // The set policy operation does not affect retrieval jobs that were in progress // before the policy was enacted. For more information about data retrieval -// policies, see Amazon Glacier Data Retrieval Policies (http://docs.aws.amazon.com/amazonglacier/latest/dev/data-retrieval-policy.html). +// policies, see Amazon Glacier Data Retrieval Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/data-retrieval-policy.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -3288,7 +3290,7 @@ func (c *Glacier) SetVaultAccessPolicyRequest(input *SetVaultAccessPolicyInput) // to a vault and is also called a vault subresource. You can set one access // policy per vault and the policy can be up to 20 KB in size. For more information // about vault access policies, see Amazon Glacier Access Control with Vault -// Access Policies (http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html). +// Access Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -3381,7 +3383,7 @@ func (c *Glacier) SetVaultNotificationsRequest(input *SetVaultNotificationsInput // To configure vault notifications, send a PUT request to the notification-configuration // subresource of the vault. The request should include a JSON document that // provides an Amazon SNS topic and specific events for which you want Amazon -// Glacier to send notifications to the topic. +// S3 Glacier to send notifications to the topic. // // Amazon SNS topics must grant permission to the vault to be allowed to publish // notifications to the topic. You can configure a vault to publish a notification @@ -3401,11 +3403,11 @@ func (c *Glacier) SetVaultNotificationsRequest(input *SetVaultNotificationsInput // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and underlying REST API, see Configuring Vault -// Notifications in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications.html) -// and Set Vault Notification Configuration (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-notifications-put.html) +// Notifications in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications.html) +// and Set Vault Notification Configuration (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-notifications-put.html) // in the Amazon Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -3493,10 +3495,10 @@ func (c *Glacier) UploadArchiveRequest(input *UploadArchiveInput) (req *request. // UploadArchive API operation for Amazon Glacier. // // This operation adds an archive to a vault. This is a synchronous operation, -// and for a successful upload, your data is durably persisted. Amazon Glacier +// and for a successful upload, your data is durably persisted. Amazon S3 Glacier // returns the archive ID in the x-amz-archive-id header of the response. // -// You must use the archive ID to access your data in Amazon Glacier. After +// You must use the archive ID to access your data in Amazon S3 Glacier. After // you upload an archive, you should save the archive ID returned so that you // can retrieve or delete the archive later. Besides saving the archive ID, // you can also index it and give it a friendly name to allow for better searching. @@ -3506,7 +3508,7 @@ func (c *Glacier) UploadArchiveRequest(input *UploadArchiveInput) (req *request. // a list of archive IDs in a vault. For more information, see InitiateJob. // // You must provide a SHA256 tree hash of the data you are uploading. For information -// about computing a SHA256 tree hash, see Computing Checksums (http://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html). +// about computing a SHA256 tree hash, see Computing Checksums (https://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html). // // You can optionally specify an archive description of up to 1,024 printable // ASCII characters. You can get the archive description when you either retrieve @@ -3522,11 +3524,11 @@ func (c *Glacier) UploadArchiveRequest(input *UploadArchiveInput) (req *request. // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and underlying REST API, see Uploading an Archive -// in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/uploading-an-archive.html) -// and Upload Archive (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-post.html) +// in Amazon Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/uploading-an-archive.html) +// and Upload Archive (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-post.html) // in the Amazon Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -3548,8 +3550,8 @@ func (c *Glacier) UploadArchiveRequest(input *UploadArchiveInput) (req *request. // Returned if a required header or parameter is missing from the request. // // * ErrCodeRequestTimeoutException "RequestTimeoutException" -// Returned if, when uploading an archive, Amazon Glacier times out while receiving -// the upload. +// Returned if, when uploading an archive, Amazon S3 Glacier times out while +// receiving the upload. // // * ErrCodeServiceUnavailableException "ServiceUnavailableException" // Returned if the service cannot complete the request. @@ -3626,10 +3628,10 @@ func (c *Glacier) UploadMultipartPartRequest(input *UploadMultipartPartInput) (r // // * SHA256 tree hash does not matchTo ensure that part data is not corrupted // in transmission, you compute a SHA256 tree hash of the part and include -// it in your request. Upon receiving the part data, Amazon Glacier also +// it in your request. Upon receiving the part data, Amazon S3 Glacier also // computes a SHA256 tree hash. If these hash values don't match, the operation // fails. For information about computing a SHA256 tree hash, see Computing -// Checksums (http://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html). +// Checksums (https://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html). // // * Part size does not matchThe size of each part except the last must match // the size specified in the corresponding InitiateMultipartUpload request. @@ -3654,11 +3656,11 @@ func (c *Glacier) UploadMultipartPartRequest(input *UploadMultipartPartInput) (r // AWS Identity and Access Management (IAM) users don't have any permissions // by default. You must grant them explicit permission to perform specific actions. // For more information, see Access Control Using AWS Identity and Access Management -// (IAM) (http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). +// (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html). // // For conceptual information and underlying REST API, see Uploading Large Archives -// in Parts (Multipart Upload) (http://docs.aws.amazon.com/amazonglacier/latest/dev/uploading-archive-mpu.html) -// and Upload Part (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-upload-part.html) +// in Parts (Multipart Upload) (https://docs.aws.amazon.com/amazonglacier/latest/dev/uploading-archive-mpu.html) +// and Upload Part (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-upload-part.html) // in the Amazon Glacier Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -3680,8 +3682,8 @@ func (c *Glacier) UploadMultipartPartRequest(input *UploadMultipartPartInput) (r // Returned if a required header or parameter is missing from the request. // // * ErrCodeRequestTimeoutException "RequestTimeoutException" -// Returned if, when uploading an archive, Amazon Glacier times out while receiving -// the upload. +// Returned if, when uploading an archive, Amazon S3 Glacier times out while +// receiving the upload. // // * ErrCodeServiceUnavailableException "ServiceUnavailableException" // Returned if the service cannot complete the request. @@ -3710,14 +3712,15 @@ func (c *Glacier) UploadMultipartPartWithContext(ctx aws.Context, input *UploadM // Provides options to abort a multipart upload identified by the upload ID. // // For information about the underlying REST API, see Abort Multipart Upload -// (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-abort-upload.html). -// For conceptual information, see Working with Archives in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html). +// (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-abort-upload.html). +// For conceptual information, see Working with Archives in Amazon S3 Glacier +// (https://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html). type AbortMultipartUploadInput struct { _ struct{} `type:"structure"` // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -3889,7 +3892,7 @@ type AddTagsToVaultInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -3970,17 +3973,18 @@ func (s AddTagsToVaultOutput) GoString() string { return s.String() } -// Contains the Amazon Glacier response to your request. +// Contains the Amazon S3 Glacier response to your request. // -// For information about the underlying REST API, see Upload Archive (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-post.html). -// For conceptual information, see Working with Archives in Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html). +// For information about the underlying REST API, see Upload Archive (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-post.html). +// For conceptual information, see Working with Archives in Amazon S3 Glacier +// (https://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html). type ArchiveCreationOutput struct { _ struct{} `type:"structure"` // The ID of the archive. This value is also included as part of the location. ArchiveId *string `location:"header" locationName:"x-amz-archive-id" type:"string"` - // The checksum of the archive computed by Amazon Glacier. + // The checksum of the archive computed by Amazon S3 Glacier. Checksum *string `location:"header" locationName:"x-amz-sha256-tree-hash" type:"string"` // The relative URI path of the newly added archive resource. @@ -4153,16 +4157,16 @@ func (s *CSVOutput) SetRecordDelimiter(v string) *CSVOutput { } // Provides options to complete a multipart upload operation. This informs Amazon -// Glacier that all the archive parts have been uploaded and Amazon Glacier -// can now assemble the archive from the uploaded parts. After assembling and -// saving the archive to the vault, Amazon Glacier returns the URI path of the +// Glacier that all the archive parts have been uploaded and Amazon S3 Glacier +// (Glacier) can now assemble the archive from the uploaded parts. After assembling +// and saving the archive to the vault, Glacier returns the URI path of the // newly created archive resource. type CompleteMultipartUploadInput struct { _ struct{} `type:"structure"` // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -4176,7 +4180,8 @@ type CompleteMultipartUploadInput struct { // The SHA256 tree hash of the entire archive. It is the tree hash of SHA256 // tree hash of the individual parts. If the value you specify in the request // does not match the SHA256 tree hash of the final assembled archive as computed - // by Amazon Glacier, Amazon Glacier returns an error and the request fails. + // by Amazon S3 Glacier (Glacier), Glacier returns an error and the request + // fails. Checksum *string `location:"header" locationName:"x-amz-sha256-tree-hash" type:"string"` // The upload ID of the multipart upload. @@ -4360,7 +4365,7 @@ type CreateVaultInput struct { // The AccountId value is the AWS account ID. This value must match the AWS // account ID associated with the credentials used to sign the request. You // can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you specify your account ID, do // not include any hyphens ('-') in the ID. // @@ -4417,7 +4422,7 @@ func (s *CreateVaultInput) SetVaultName(v string) *CreateVaultInput { return s } -// Contains the Amazon Glacier response to your request. +// Contains the Amazon S3 Glacier response to your request. type CreateVaultOutput struct { _ struct{} `type:"structure"` @@ -4505,13 +4510,13 @@ func (s *DataRetrievalRule) SetStrategy(v string) *DataRetrievalRule { return s } -// Provides options for deleting an archive from an Amazon Glacier vault. +// Provides options for deleting an archive from an Amazon S3 Glacier vault. type DeleteArchiveInput struct { _ struct{} `type:"structure"` // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -4605,7 +4610,7 @@ type DeleteVaultAccessPolicyInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -4676,13 +4681,13 @@ func (s DeleteVaultAccessPolicyOutput) GoString() string { return s.String() } -// Provides options for deleting a vault from Amazon Glacier. +// Provides options for deleting a vault from Amazon S3 Glacier. type DeleteVaultInput struct { _ struct{} `type:"structure"` // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -4746,7 +4751,7 @@ type DeleteVaultNotificationsInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -4837,7 +4842,7 @@ type DescribeJobInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -4917,7 +4922,7 @@ type DescribeVaultInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -4974,7 +4979,7 @@ func (s *DescribeVaultInput) SetVaultName(v string) *DescribeVaultInput { return s } -// Contains the Amazon Glacier response to your request. +// Contains the Amazon S3 Glacier response to your request. type DescribeVaultOutput struct { _ struct{} `type:"structure"` @@ -4982,8 +4987,8 @@ type DescribeVaultOutput struct { // value should be a string in the ISO 8601 date format, for example 2012-03-20T17:03:43.221Z. CreationDate *string `type:"string"` - // The Universal Coordinated Time (UTC) date when Amazon Glacier completed the - // last vault inventory. This value should be a string in the ISO 8601 date + // The Universal Coordinated Time (UTC) date when Amazon S3 Glacier completed + // the last vault inventory. This value should be a string in the ISO 8601 date // format, for example 2012-03-20T17:03:43.221Z. LastInventoryDate *string `type:"string"` @@ -5144,7 +5149,7 @@ func (s *GetDataRetrievalPolicyInput) SetAccountId(v string) *GetDataRetrievalPo return s } -// Contains the Amazon Glacier response to the GetDataRetrievalPolicy request. +// Contains the Amazon S3 Glacier response to the GetDataRetrievalPolicy request. type GetDataRetrievalPolicyOutput struct { _ struct{} `type:"structure"` @@ -5168,13 +5173,13 @@ func (s *GetDataRetrievalPolicyOutput) SetPolicy(v *DataRetrievalPolicy) *GetDat return s } -// Provides options for downloading output of an Amazon Glacier job. +// Provides options for downloading output of an Amazon S3 Glacier job. type GetJobOutputInput struct { _ struct{} `type:"structure"` // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -5212,8 +5217,8 @@ type GetJobOutputInput struct { // checksum values. Compute the tree hash of these values to find the checksum // of the entire output. Using the DescribeJob API, obtain job information of // the job that provided you the output. The response includes the checksum - // of the entire archive stored in Amazon Glacier. You compare this value with - // the checksum you computed to ensure you have downloaded the entire archive + // of the entire archive stored in Amazon S3 Glacier. You compare this value + // with the checksum you computed to ensure you have downloaded the entire archive // content with no errors. Range *string `location:"header" locationName:"Range" type:"string"` @@ -5285,7 +5290,7 @@ func (s *GetJobOutputInput) SetVaultName(v string) *GetJobOutputInput { return s } -// Contains the Amazon Glacier response to your request. +// Contains the Amazon S3 Glacier response to your request. type GetJobOutputOutput struct { _ struct{} `type:"structure" payload:"Body"` @@ -5316,9 +5321,10 @@ type GetJobOutputOutput struct { // as a response header. Checksum *string `location:"header" locationName:"x-amz-sha256-tree-hash" type:"string"` - // The range of bytes returned by Amazon Glacier. If only partial output is - // downloaded, the response provides the range of bytes Amazon Glacier returned. - // For example, bytes 0-1048575/8388608 returns the first 1 MB from 8 MB. + // The range of bytes returned by Amazon S3 Glacier. If only partial output + // is downloaded, the response provides the range of bytes Amazon S3 Glacier + // returned. For example, bytes 0-1048575/8388608 returns the first 1 MB from + // 8 MB. ContentRange *string `location:"header" locationName:"Content-Range" type:"string"` // The Content-Type depends on whether the job output is an archive or a vault @@ -5391,7 +5397,7 @@ type GetVaultAccessPolicyInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -5478,7 +5484,7 @@ type GetVaultLockInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -5535,7 +5541,7 @@ func (s *GetVaultLockInput) SetVaultName(v string) *GetVaultLockInput { return s } -// Contains the Amazon Glacier response to your request. +// Contains the Amazon S3 Glacier response to your request. type GetVaultLockOutput struct { _ struct{} `type:"structure"` @@ -5595,7 +5601,7 @@ type GetVaultNotificationsInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -5652,7 +5658,7 @@ func (s *GetVaultNotificationsInput) SetVaultName(v string) *GetVaultNotificatio return s } -// Contains the Amazon Glacier response to your request. +// Contains the Amazon S3 Glacier response to your request. type GetVaultNotificationsOutput struct { _ struct{} `type:"structure" payload:"VaultNotificationConfig"` @@ -5799,13 +5805,13 @@ func (s *Grantee) SetURI(v string) *Grantee { return s } -// Provides options for initiating an Amazon Glacier job. +// Provides options for initiating an Amazon S3 Glacier job. type InitiateJobInput struct { _ struct{} `type:"structure" payload:"JobParameters"` // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -5876,7 +5882,7 @@ func (s *InitiateJobInput) SetVaultName(v string) *InitiateJobInput { return s } -// Contains the Amazon Glacier response to your request. +// Contains the Amazon S3 Glacier response to your request. type InitiateJobOutput struct { _ struct{} `type:"structure"` @@ -5918,13 +5924,14 @@ func (s *InitiateJobOutput) SetLocation(v string) *InitiateJobOutput { return s } -// Provides options for initiating a multipart upload to an Amazon Glacier vault. +// Provides options for initiating a multipart upload to an Amazon S3 Glacier +// vault. type InitiateMultipartUploadInput struct { _ struct{} `type:"structure"` // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -6005,11 +6012,11 @@ func (s *InitiateMultipartUploadInput) SetVaultName(v string) *InitiateMultipart return s } -// The Amazon Glacier response to your request. +// The Amazon S3 Glacier response to your request. type InitiateMultipartUploadOutput struct { _ struct{} `type:"structure"` - // The relative URI path of the multipart upload ID Amazon Glacier created. + // The relative URI path of the multipart upload ID Amazon S3 Glacier created. Location *string `location:"header" locationName:"Location" type:"string"` // The ID of the multipart upload. This value is also included as part of the @@ -6112,7 +6119,7 @@ func (s *InitiateVaultLockInput) SetVaultName(v string) *InitiateVaultLockInput return s } -// Contains the Amazon Glacier response to your request. +// Contains the Amazon S3 Glacier response to your request. type InitiateVaultLockOutput struct { _ struct{} `type:"structure"` @@ -6182,7 +6189,7 @@ type InventoryRetrievalJobDescription struct { // An opaque string that represents where to continue pagination of the vault // inventory retrieval results. You use the marker in a new InitiateJob request // to obtain additional inventory items. If there are no more inventory items, - // this value is null. For more information, see Range Inventory Retrieval (http://docs.aws.amazon.com/amazonglacier/latest/dev/api-initiate-job-post.html#api-initiate-job-post-vault-inventory-list-filtering). + // this value is null. For more information, see Range Inventory Retrieval (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-initiate-job-post.html#api-initiate-job-post-vault-inventory-list-filtering). Marker *string `type:"string"` // The start of the date range in Universal Coordinated Time (UTC) for vault @@ -6290,7 +6297,7 @@ func (s *InventoryRetrievalJobInput) SetStartDate(v string) *InventoryRetrievalJ return s } -// Contains the description of an Amazon Glacier job. +// Contains the description of an Amazon S3 Glacier job. type JobDescription struct { _ struct{} `type:"structure"` @@ -6334,7 +6341,7 @@ type JobDescription struct { // The job description provided when initiating the job. JobDescription *string `type:"string"` - // An opaque string that identifies an Amazon Glacier job. + // An opaque string that identifies an Amazon S3 Glacier job. JobId *string `type:"string"` // Contains the job output location. @@ -6569,9 +6576,10 @@ type JobParameters struct { // request. RetrievalByteRange *string `type:"string"` - // The Amazon SNS topic ARN to which Amazon Glacier sends a notification when - // the job is completed and the output is ready for you to download. The specified - // topic publishes the notification to its subscribers. The SNS topic must exist. + // The Amazon SNS topic ARN to which Amazon S3 Glacier sends a notification + // when the job is completed and the output is ready for you to download. The + // specified topic publishes the notification to its subscribers. The SNS topic + // must exist. SNSTopic *string `type:"string"` // Contains the parameters that define a job. @@ -6672,13 +6680,13 @@ func (s *JobParameters) SetType(v string) *JobParameters { return s } -// Provides options for retrieving a job list for an Amazon Glacier vault. +// Provides options for retrieving a job list for an Amazon S3 Glacier vault. type ListJobsInput struct { _ struct{} `type:"structure"` // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -6777,7 +6785,7 @@ func (s *ListJobsInput) SetVaultName(v string) *ListJobsInput { return s } -// Contains the Amazon Glacier response to your request. +// Contains the Amazon S3 Glacier response to your request. type ListJobsOutput struct { _ struct{} `type:"structure"` @@ -6820,7 +6828,7 @@ type ListMultipartUploadsInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -6900,7 +6908,7 @@ func (s *ListMultipartUploadsInput) SetVaultName(v string) *ListMultipartUploads return s } -// Contains the Amazon Glacier response to your request. +// Contains the Amazon S3 Glacier response to your request. type ListMultipartUploadsOutput struct { _ struct{} `type:"structure"` @@ -6942,7 +6950,7 @@ type ListPartsInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -7040,7 +7048,7 @@ func (s *ListPartsInput) SetVaultName(v string) *ListPartsInput { return s } -// Contains the Amazon Glacier response to your request. +// Contains the Amazon S3 Glacier response to your request. type ListPartsOutput struct { _ struct{} `type:"structure"` @@ -7129,9 +7137,9 @@ type ListProvisionedCapacityInput struct { // The AWS account ID of the account that owns the vault. You can either specify // an AWS account ID or optionally a single '-' (hyphen), in which case Amazon - // Glacier uses the AWS account ID associated with the credentials used to sign - // the request. If you use an account ID, don't include any hyphens ('-') in - // the ID. + // S3 Glacier uses the AWS account ID associated with the credentials used to + // sign the request. If you use an account ID, don't include any hyphens ('-') + // in the ID. // // AccountId is a required field AccountId *string `location:"uri" locationName:"accountId" type:"string" required:"true"` @@ -7198,7 +7206,7 @@ type ListTagsForVaultInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -7255,7 +7263,7 @@ func (s *ListTagsForVaultInput) SetVaultName(v string) *ListTagsForVaultInput { return s } -// Contains the Amazon Glacier response to your request. +// Contains the Amazon S3 Glacier response to your request. type ListTagsForVaultOutput struct { _ struct{} `type:"structure"` @@ -7348,7 +7356,7 @@ func (s *ListVaultsInput) SetMarker(v string) *ListVaultsInput { return s } -// Contains the Amazon Glacier response to your request. +// Contains the Amazon S3 Glacier response to your request. type ListVaultsOutput struct { _ struct{} `type:"structure"` @@ -7453,8 +7461,8 @@ type PartListElement struct { // The byte range of a part, inclusive of the upper value of the range. RangeInBytes *string `type:"string"` - // The SHA256 tree hash value that Amazon Glacier calculated for the part. This - // field is never null. + // The SHA256 tree hash value that Amazon S3 Glacier calculated for the part. + // This field is never null. SHA256TreeHash *string `type:"string"` } @@ -7529,9 +7537,9 @@ type PurchaseProvisionedCapacityInput struct { // The AWS account ID of the account that owns the vault. You can either specify // an AWS account ID or optionally a single '-' (hyphen), in which case Amazon - // Glacier uses the AWS account ID associated with the credentials used to sign - // the request. If you use an account ID, don't include any hyphens ('-') in - // the ID. + // S3 Glacier uses the AWS account ID associated with the credentials used to + // sign the request. If you use an account ID, don't include any hyphens ('-') + // in the ID. // // AccountId is a required field AccountId *string `location:"uri" locationName:"accountId" type:"string" required:"true"` @@ -7598,7 +7606,7 @@ type RemoveTagsFromVaultInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -7914,7 +7922,7 @@ type SetVaultAccessPolicyInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -8001,7 +8009,7 @@ type SetVaultNotificationsInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -8087,7 +8095,7 @@ type UploadArchiveInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -8240,7 +8248,7 @@ type UploadMultipartPartInput struct { // The AccountId value is the AWS account ID of the account that owns the vault. // You can either specify an AWS account ID or optionally a single '-' (hyphen), - // in which case Amazon Glacier uses the AWS account ID associated with the + // in which case Amazon S3 Glacier uses the AWS account ID associated with the // credentials used to sign the request. If you use an account ID, do not include // any hyphens ('-') in the ID. // @@ -8254,7 +8262,7 @@ type UploadMultipartPartInput struct { Checksum *string `location:"header" locationName:"x-amz-sha256-tree-hash" type:"string"` // Identifies the range of bytes in the assembled archive that will be uploaded - // in this part. Amazon Glacier uses this information to assemble the archive + // in this part. Amazon S3 Glacier uses this information to assemble the archive // in the proper sequence. The format of this header follows RFC 2616. An example // header is Content-Range:bytes 0-4194303/*. Range *string `location:"header" locationName:"Content-Range" type:"string"` @@ -8344,11 +8352,11 @@ func (s *UploadMultipartPartInput) SetVaultName(v string) *UploadMultipartPartIn return s } -// Contains the Amazon Glacier response to your request. +// Contains the Amazon S3 Glacier response to your request. type UploadMultipartPartOutput struct { _ struct{} `type:"structure"` - // The SHA256 tree hash that Amazon Glacier computed for the uploaded part. + // The SHA256 tree hash that Amazon S3 Glacier computed for the uploaded part. Checksum *string `location:"header" locationName:"x-amz-sha256-tree-hash" type:"string"` } @@ -8420,7 +8428,7 @@ func (s *VaultLockPolicy) SetPolicy(v string) *VaultLockPolicy { type VaultNotificationConfig struct { _ struct{} `type:"structure"` - // A list of one or more events for which Amazon Glacier will send a notification + // A list of one or more events for which Amazon S3 Glacier will send a notification // to the specified Amazon SNS topic. Events []*string `type:"list"` diff --git a/vendor/github.com/aws/aws-sdk-go/service/glacier/doc.go b/vendor/github.com/aws/aws-sdk-go/service/glacier/doc.go index 80c74d848910..980905224668 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/glacier/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/service/glacier/doc.go @@ -3,33 +3,33 @@ // Package glacier provides the client and types for making API // requests to Amazon Glacier. // -// Amazon Glacier is a storage solution for "cold data." -// -// Amazon Glacier is an extremely low-cost storage service that provides secure, -// durable, and easy-to-use storage for data backup and archival. With Amazon -// Glacier, customers can store their data cost effectively for months, years, -// or decades. Amazon Glacier also enables customers to offload the administrative -// burdens of operating and scaling storage to AWS, so they don't have to worry -// about capacity planning, hardware provisioning, data replication, hardware -// failure and recovery, or time-consuming hardware migrations. -// -// Amazon Glacier is a great storage choice when low storage cost is paramount -// and your data is rarely retrieved. If your application requires fast or frequent +// Amazon S3 Glacier (Glacier) is a storage solution for "cold data." +// +// Glacier is an extremely low-cost storage service that provides secure, durable, +// and easy-to-use storage for data backup and archival. With Glacier, customers +// can store their data cost effectively for months, years, or decades. Glacier +// also enables customers to offload the administrative burdens of operating +// and scaling storage to AWS, so they don't have to worry about capacity planning, +// hardware provisioning, data replication, hardware failure and recovery, or +// time-consuming hardware migrations. +// +// Glacier is a great storage choice when low storage cost is paramount and +// your data is rarely retrieved. If your application requires fast or frequent // access to your data, consider using Amazon S3. For more information, see // Amazon Simple Storage Service (Amazon S3) (http://aws.amazon.com/s3/). // // You can store any kind of data in any format. There is no maximum limit on -// the total amount of data you can store in Amazon Glacier. +// the total amount of data you can store in Glacier. // -// If you are a first-time user of Amazon Glacier, we recommend that you begin -// by reading the following sections in the Amazon Glacier Developer Guide: +// If you are a first-time user of Glacier, we recommend that you begin by reading +// the following sections in the Amazon S3 Glacier Developer Guide: // -// * What is Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/introduction.html) +// * What is Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/introduction.html) // - This section of the Developer Guide describes the underlying data model, // the operations it supports, and the AWS SDKs that you can use to interact // with the service. // -// * Getting Started with Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/amazon-glacier-getting-started.html) +// * Getting Started with Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/amazon-glacier-getting-started.html) // - The Getting Started section walks you through the process of creating // a vault, uploading archives, creating jobs to download archives, retrieving // the job output, and deleting archives. diff --git a/vendor/github.com/aws/aws-sdk-go/service/glacier/errors.go b/vendor/github.com/aws/aws-sdk-go/service/glacier/errors.go index c47e3bb305ce..b3e0922d7470 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/glacier/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/glacier/errors.go @@ -40,8 +40,8 @@ const ( // ErrCodeRequestTimeoutException for service response error code // "RequestTimeoutException". // - // Returned if, when uploading an archive, Amazon Glacier times out while receiving - // the upload. + // Returned if, when uploading an archive, Amazon S3 Glacier times out while + // receiving the upload. ErrCodeRequestTimeoutException = "RequestTimeoutException" // ErrCodeResourceNotFoundException for service response error code diff --git a/vendor/github.com/aws/aws-sdk-go/service/kafka/api.go b/vendor/github.com/aws/aws-sdk-go/service/kafka/api.go index 28b8752e5dd6..bef73a71c736 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/kafka/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/kafka/api.go @@ -2683,7 +2683,7 @@ type CreateClusterInput struct { // KafkaVersion is a required field KafkaVersion *string `locationName:"kafkaVersion" min:"1" type:"string" required:"true"` - // The number of broker nodes in the cluster. + // The number of Kafka broker nodes in the Amazon MSK cluster. // // NumberOfBrokerNodes is a required field NumberOfBrokerNodes *int64 `locationName:"numberOfBrokerNodes" min:"1" type:"integer" required:"true"` diff --git a/vendor/github.com/aws/aws-sdk-go/service/quicksight/api.go b/vendor/github.com/aws/aws-sdk-go/service/quicksight/api.go index a477a25c1f41..9722c6d884de 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/quicksight/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/quicksight/api.go @@ -605,7 +605,14 @@ func (c *QuickSight) DeleteUserByPrincipalIdRequest(input *DeleteUserByPrincipal // DeleteUserByPrincipalId API operation for Amazon QuickSight. // -// Deletes a user after locating the user by its principal ID. +// Deletes a user identified by its principal ID. +// +// The permission resource is arn:aws:quicksight:us-east-1::user/default/ . +// +// CLI Sample: +// +// aws quicksight delete-user-by-principal-id --aws-account-id=111122223333 +// --namespace=default --principal-id=ABCDEFJA26JLI7EUUOEHS // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -2779,6 +2786,20 @@ type GetDashboardEmbedUrlInput struct { // Remove the undo/redo button on embedded dashboard. The default is FALSE, // which enables the undo/redo button. UndoRedoDisabled *bool `location:"querystring" locationName:"undo-redo-disabled" type:"boolean"` + + // The Amazon QuickSight user's ARN, for use with QUICKSIGHT identity type. + // You can use this for any of the following: + // + // * Amazon QuickSight users in your account (readers, authors, or admins) + // + // * AD users + // + // * Invited non-federated users + // + // * Federated IAM users + // + // * Federated IAM role-based sessions + UserArn *string `location:"querystring" locationName:"user-arn" type:"string"` } // String returns the string representation @@ -2855,6 +2876,12 @@ func (s *GetDashboardEmbedUrlInput) SetUndoRedoDisabled(v bool) *GetDashboardEmb return s } +// SetUserArn sets the UserArn field's value. +func (s *GetDashboardEmbedUrlInput) SetUserArn(v string) *GetDashboardEmbedUrlInput { + s.UserArn = &v + return s +} + type GetDashboardEmbedUrlOutput struct { _ struct{} `type:"structure"` @@ -3573,10 +3600,12 @@ type RegisterUserInput struct { // Namespace is a required field Namespace *string `location:"uri" locationName:"Namespace" type:"string" required:"true"` - // The name of the session with the assumed IAM role. By using this parameter, - // you can register multiple users with the same IAM role, provided that each - // has a different session name. For more information on assuming IAM roles, - // see assume-role (https://docs.aws.amazon.com/cli/latest/reference/sts/assume-role.html) + // You need to use this parameter only when you register one or more users using + // an assumed IAM role. You don't need to provide the session name for other + // scenarios, for example when you are registering an IAM user or an Amazon + // QuickSight user. You can register multiple users using the same IAM role + // if each user has a different session name. For more information on assuming + // IAM roles, see assume-role (https://docs.aws.amazon.com/cli/latest/reference/sts/assume-role.html) // in the AWS CLI Reference. SessionName *string `min:"2" type:"string"` diff --git a/vendor/github.com/aws/aws-sdk-go/service/servicecatalog/api.go b/vendor/github.com/aws/aws-sdk-go/service/servicecatalog/api.go index 5604ecde64d9..3083863c8fd2 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/servicecatalog/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/servicecatalog/api.go @@ -3310,6 +3310,86 @@ func (c *ServiceCatalog) DescribeServiceActionWithContext(ctx aws.Context, input return out, req.Send() } +const opDescribeServiceActionExecutionParameters = "DescribeServiceActionExecutionParameters" + +// DescribeServiceActionExecutionParametersRequest generates a "aws/request.Request" representing the +// client's request for the DescribeServiceActionExecutionParameters operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeServiceActionExecutionParameters for more information on using the DescribeServiceActionExecutionParameters +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DescribeServiceActionExecutionParametersRequest method. +// req, resp := client.DescribeServiceActionExecutionParametersRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribeServiceActionExecutionParameters +func (c *ServiceCatalog) DescribeServiceActionExecutionParametersRequest(input *DescribeServiceActionExecutionParametersInput) (req *request.Request, output *DescribeServiceActionExecutionParametersOutput) { + op := &request.Operation{ + Name: opDescribeServiceActionExecutionParameters, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeServiceActionExecutionParametersInput{} + } + + output = &DescribeServiceActionExecutionParametersOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeServiceActionExecutionParameters API operation for AWS Service Catalog. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS Service Catalog's +// API operation DescribeServiceActionExecutionParameters for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInvalidParametersException "InvalidParametersException" +// One or more parameters provided to the operation are not valid. +// +// * ErrCodeResourceNotFoundException "ResourceNotFoundException" +// The specified resource was not found. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribeServiceActionExecutionParameters +func (c *ServiceCatalog) DescribeServiceActionExecutionParameters(input *DescribeServiceActionExecutionParametersInput) (*DescribeServiceActionExecutionParametersOutput, error) { + req, out := c.DescribeServiceActionExecutionParametersRequest(input) + return out, req.Send() +} + +// DescribeServiceActionExecutionParametersWithContext is the same as DescribeServiceActionExecutionParameters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeServiceActionExecutionParameters for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *ServiceCatalog) DescribeServiceActionExecutionParametersWithContext(ctx aws.Context, input *DescribeServiceActionExecutionParametersInput, opts ...request.Option) (*DescribeServiceActionExecutionParametersOutput, error) { + req, out := c.DescribeServiceActionExecutionParametersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opDescribeTagOption = "DescribeTagOption" // DescribeTagOptionRequest generates a "aws/request.Request" representing the @@ -12164,6 +12244,90 @@ func (s *DescribeRecordOutput) SetRecordOutputs(v []*RecordOutput) *DescribeReco return s } +type DescribeServiceActionExecutionParametersInput struct { + _ struct{} `type:"structure"` + + AcceptLanguage *string `type:"string"` + + // ProvisionedProductId is a required field + ProvisionedProductId *string `min:"1" type:"string" required:"true"` + + // ServiceActionId is a required field + ServiceActionId *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeServiceActionExecutionParametersInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeServiceActionExecutionParametersInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeServiceActionExecutionParametersInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeServiceActionExecutionParametersInput"} + if s.ProvisionedProductId == nil { + invalidParams.Add(request.NewErrParamRequired("ProvisionedProductId")) + } + if s.ProvisionedProductId != nil && len(*s.ProvisionedProductId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ProvisionedProductId", 1)) + } + if s.ServiceActionId == nil { + invalidParams.Add(request.NewErrParamRequired("ServiceActionId")) + } + if s.ServiceActionId != nil && len(*s.ServiceActionId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ServiceActionId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAcceptLanguage sets the AcceptLanguage field's value. +func (s *DescribeServiceActionExecutionParametersInput) SetAcceptLanguage(v string) *DescribeServiceActionExecutionParametersInput { + s.AcceptLanguage = &v + return s +} + +// SetProvisionedProductId sets the ProvisionedProductId field's value. +func (s *DescribeServiceActionExecutionParametersInput) SetProvisionedProductId(v string) *DescribeServiceActionExecutionParametersInput { + s.ProvisionedProductId = &v + return s +} + +// SetServiceActionId sets the ServiceActionId field's value. +func (s *DescribeServiceActionExecutionParametersInput) SetServiceActionId(v string) *DescribeServiceActionExecutionParametersInput { + s.ServiceActionId = &v + return s +} + +type DescribeServiceActionExecutionParametersOutput struct { + _ struct{} `type:"structure"` + + ServiceActionParameters []*ExecutionParameter `type:"list"` +} + +// String returns the string representation +func (s DescribeServiceActionExecutionParametersOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeServiceActionExecutionParametersOutput) GoString() string { + return s.String() +} + +// SetServiceActionParameters sets the ServiceActionParameters field's value. +func (s *DescribeServiceActionExecutionParametersOutput) SetServiceActionParameters(v []*ExecutionParameter) *DescribeServiceActionExecutionParametersOutput { + s.ServiceActionParameters = v + return s +} + type DescribeServiceActionInput struct { _ struct{} `type:"structure"` @@ -12891,6 +13055,8 @@ type ExecuteProvisionedProductServiceActionInput struct { // An idempotency token that uniquely identifies the execute request. ExecuteToken *string `min:"1" type:"string" idempotencyToken:"true"` + Parameters map[string][]*string `min:"1" type:"map"` + // The identifier of the provisioned product. // // ProvisionedProductId is a required field @@ -12918,6 +13084,9 @@ func (s *ExecuteProvisionedProductServiceActionInput) Validate() error { if s.ExecuteToken != nil && len(*s.ExecuteToken) < 1 { invalidParams.Add(request.NewErrParamMinLen("ExecuteToken", 1)) } + if s.Parameters != nil && len(s.Parameters) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Parameters", 1)) + } if s.ProvisionedProductId == nil { invalidParams.Add(request.NewErrParamRequired("ProvisionedProductId")) } @@ -12949,6 +13118,12 @@ func (s *ExecuteProvisionedProductServiceActionInput) SetExecuteToken(v string) return s } +// SetParameters sets the Parameters field's value. +func (s *ExecuteProvisionedProductServiceActionInput) SetParameters(v map[string][]*string) *ExecuteProvisionedProductServiceActionInput { + s.Parameters = v + return s +} + // SetProvisionedProductId sets the ProvisionedProductId field's value. func (s *ExecuteProvisionedProductServiceActionInput) SetProvisionedProductId(v string) *ExecuteProvisionedProductServiceActionInput { s.ProvisionedProductId = &v @@ -12985,6 +13160,44 @@ func (s *ExecuteProvisionedProductServiceActionOutput) SetRecordDetail(v *Record return s } +type ExecutionParameter struct { + _ struct{} `type:"structure"` + + DefaultValues []*string `type:"list"` + + Name *string `min:"1" type:"string"` + + Type *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s ExecutionParameter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ExecutionParameter) GoString() string { + return s.String() +} + +// SetDefaultValues sets the DefaultValues field's value. +func (s *ExecutionParameter) SetDefaultValues(v []*string) *ExecutionParameter { + s.DefaultValues = v + return s +} + +// SetName sets the Name field's value. +func (s *ExecutionParameter) SetName(v string) *ExecutionParameter { + s.Name = &v + return s +} + +// SetType sets the Type field's value. +func (s *ExecutionParameter) SetType(v string) *ExecutionParameter { + s.Type = &v + return s +} + // An object containing information about the error, along with identifying // information about the self-service action and its associations. type FailedServiceActionAssociation struct { diff --git a/vendor/modules.txt b/vendor/modules.txt index 9eee71d30727..a44fdb1c37ad 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -21,7 +21,7 @@ github.com/apparentlymart/go-cidr/cidr github.com/apparentlymart/go-textseg/textseg # github.com/armon/go-radix v1.0.0 github.com/armon/go-radix -# github.com/aws/aws-sdk-go v1.20.17 +# github.com/aws/aws-sdk-go v1.20.19 github.com/aws/aws-sdk-go/aws github.com/aws/aws-sdk-go/aws/arn github.com/aws/aws-sdk-go/aws/awserr From 5b704e426704eb16b19b6b5606bd87bff7dbf040 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Thu, 11 Jul 2019 15:48:08 -0400 Subject: [PATCH 0192/1054] Update .github/CONTRIBUTING.md Co-Authored-By: Wilken Rivera --- .github/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 2000ab8f085e..b71b802005c2 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -308,7 +308,7 @@ if err != nil { } ``` -More likely though, if the resource requires multiple attributes and they are not already in the resource ID, `Importer` `State` will require a custom function implementation beyond using `schema.ImportStatePassthrough`, seen below. The ID passed into `terraform import` should be parsed so `d.Set()` can be called the required attributes to make the `Read` function properly operate. The resource ID should also match the ID set during the resource `Create` function via `d.SetId()`. +More likely though, if the resource requires multiple attributes and they are not already in the resource ID, `Importer` `State` will require a custom function implementation beyond using `schema.ImportStatePassthrough`, seen below. The ID passed into `terraform import` should be parsed so `d.Set()` can be called with the required attributes to make the `Read` function operate properly. The resource ID should match the ID set during the resource `Create` function via `d.SetId()`. ```go // Illustrative example of parsing the import ID during terraform import From 6a59557e3feb5359a2a3717071940b4b5da7fb39 Mon Sep 17 00:00:00 2001 From: tf-release-bot Date: Thu, 11 Jul 2019 20:11:43 +0000 Subject: [PATCH 0193/1054] v2.19.0 --- CHANGELOG.md | 58 ++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa6ecf8867de..8a2fbbb65d79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,41 +1,41 @@ -## 2.19.0 (Unreleased) +## 2.19.0 (July 11, 2019) FEATURES: -* **New Data Source:** `aws_msk_configuration` [GH-9088] -* **New Resource:** `aws_athena_workgroup` [GH-9290] -* **New Resource:** `aws_datapipeline_pipeline` [GH-9267] -* **New Resource:** `aws_directory_service_log_subscription` [GH-9261] +* **New Data Source:** `aws_msk_configuration` ([#9088](https://github.com/terraform-providers/terraform-provider-aws/issues/9088)) +* **New Resource:** `aws_athena_workgroup` ([#9290](https://github.com/terraform-providers/terraform-provider-aws/issues/9290)) +* **New Resource:** `aws_datapipeline_pipeline` ([#9267](https://github.com/terraform-providers/terraform-provider-aws/issues/9267)) +* **New Resource:** `aws_directory_service_log_subscription` ([#9261](https://github.com/terraform-providers/terraform-provider-aws/issues/9261)) ENHANCEMENTS: -* resource/aws_acmpca_certificate_authority: Support validation for `ROOT` certificate authority type [GH-9292] -* resource/aws_appmesh_virtual_node: Add `aws_cloud_map` configuration block under `spec` and `service_discovery` [GH-9271] -* resource/aws_appmesh_virtual_router: Add `tags` argument [GH-9249] -* resource/aws_appmesh_virtual_service: Add `tags` argument [GH-9252] -* resource/aws_codebuild_project: Add `environment` configuration block `registry_credential` configuration block (support Secrets Manager registry credentials) [GH-9168] -* resource/aws_codebuild_project: Add `logs_config` configuration block (support CloudWatch and S3 logging configuration) [GH-7534] -* resource/aws_ebs_snapshot: Support customizable create/delete timeouts and increase defaults to 10 minutes [GH-9157] -* resource/aws_lightsail_instance: Add validation for `name` argument [GH-8667] -* resource/aws_lightsail_instance: Add `tags` argument [GH-9273] -* resource/aws_organizations_account: Add `tags` argument [GH-9202] -* resource/aws_service_discovery_service: Add `namespace_id` argument (Support HTTP namespaces) [GH-7341] -* resource/aws_ssm_document: Support resource import [GH-9313] -* resource/aws_waf_rule_group: Support resource import [GH-9254] -* resource/aws_wafregional_byte_match_set: Support resource import [GH-9258] -* resource/aws_wafregional_rule: Support resource import [GH-9239] -* resource/aws_wafregional_rule_group: Support resource import [GH-9240] -* resource/aws_wafregional_web_acl: Support resource import [GH-9248] +* resource/aws_acmpca_certificate_authority: Support validation for `ROOT` certificate authority type ([#9292](https://github.com/terraform-providers/terraform-provider-aws/issues/9292)) +* resource/aws_appmesh_virtual_node: Add `aws_cloud_map` configuration block under `spec` and `service_discovery` ([#9271](https://github.com/terraform-providers/terraform-provider-aws/issues/9271)) +* resource/aws_appmesh_virtual_router: Add `tags` argument ([#9249](https://github.com/terraform-providers/terraform-provider-aws/issues/9249)) +* resource/aws_appmesh_virtual_service: Add `tags` argument ([#9252](https://github.com/terraform-providers/terraform-provider-aws/issues/9252)) +* resource/aws_codebuild_project: Add `environment` configuration block `registry_credential` configuration block (support Secrets Manager registry credentials) ([#9168](https://github.com/terraform-providers/terraform-provider-aws/issues/9168)) +* resource/aws_codebuild_project: Add `logs_config` configuration block (support CloudWatch and S3 logging configuration) ([#7534](https://github.com/terraform-providers/terraform-provider-aws/issues/7534)) +* resource/aws_ebs_snapshot: Support customizable create/delete timeouts and increase defaults to 10 minutes ([#9157](https://github.com/terraform-providers/terraform-provider-aws/issues/9157)) +* resource/aws_lightsail_instance: Add validation for `name` argument ([#8667](https://github.com/terraform-providers/terraform-provider-aws/issues/8667)) +* resource/aws_lightsail_instance: Add `tags` argument ([#9273](https://github.com/terraform-providers/terraform-provider-aws/issues/9273)) +* resource/aws_organizations_account: Add `tags` argument ([#9202](https://github.com/terraform-providers/terraform-provider-aws/issues/9202)) +* resource/aws_service_discovery_service: Add `namespace_id` argument (Support HTTP namespaces) ([#7341](https://github.com/terraform-providers/terraform-provider-aws/issues/7341)) +* resource/aws_ssm_document: Support resource import ([#9313](https://github.com/terraform-providers/terraform-provider-aws/issues/9313)) +* resource/aws_waf_rule_group: Support resource import ([#9254](https://github.com/terraform-providers/terraform-provider-aws/issues/9254)) +* resource/aws_wafregional_byte_match_set: Support resource import ([#9258](https://github.com/terraform-providers/terraform-provider-aws/issues/9258)) +* resource/aws_wafregional_rule: Support resource import ([#9239](https://github.com/terraform-providers/terraform-provider-aws/issues/9239)) +* resource/aws_wafregional_rule_group: Support resource import ([#9240](https://github.com/terraform-providers/terraform-provider-aws/issues/9240)) +* resource/aws_wafregional_web_acl: Support resource import ([#9248](https://github.com/terraform-providers/terraform-provider-aws/issues/9248)) BUG FIXES: -* resource/aws_backup_selection: Retry creation for IAM eventual consistency error [GH-9298] -* resource/aws_db_event_subscription: Prevent `Unable to find RDS Event Subscription` error during deletion and refresh [GH-9274] -* resource/aws_iam_policy_attachment: Bypass `NoSuchEntity` error when detaching groups, roles, and users (support group, role (when `force_detach_policies` is enabled), and user renames (when `force_destroy` is enabled)) [GH-9278] -* resource/aws_s3_bucket: Properly handle the creation of tags defined in `lifecycle_rule` when no prefix argument is specified [GH-7162] -* resource/aws_ssm_document: Ensure `content` attribute is always refreshed [GH-9313] -* resource/aws_transfer_user: Final retry after timeout waiting for deletion of transfer user [GH-9241] -* service/organizations: Automatically retry API calls on `ConcurrentModificationException` error [GH-9195] +* resource/aws_backup_selection: Retry creation for IAM eventual consistency error ([#9298](https://github.com/terraform-providers/terraform-provider-aws/issues/9298)) +* resource/aws_db_event_subscription: Prevent `Unable to find RDS Event Subscription` error during deletion and refresh ([#9274](https://github.com/terraform-providers/terraform-provider-aws/issues/9274)) +* resource/aws_iam_policy_attachment: Bypass `NoSuchEntity` error when detaching groups, roles, and users (support group, role (when `force_detach_policies` is enabled), and user renames (when `force_destroy` is enabled)) ([#9278](https://github.com/terraform-providers/terraform-provider-aws/issues/9278)) +* resource/aws_s3_bucket: Properly handle the creation of tags defined in `lifecycle_rule` when no prefix argument is specified ([#7162](https://github.com/terraform-providers/terraform-provider-aws/issues/7162)) +* resource/aws_ssm_document: Ensure `content` attribute is always refreshed ([#9313](https://github.com/terraform-providers/terraform-provider-aws/issues/9313)) +* resource/aws_transfer_user: Final retry after timeout waiting for deletion of transfer user ([#9241](https://github.com/terraform-providers/terraform-provider-aws/issues/9241)) +* service/organizations: Automatically retry API calls on `ConcurrentModificationException` error ([#9195](https://github.com/terraform-providers/terraform-provider-aws/issues/9195)) ## 2.18.0 (July 05, 2019) From 39f112864c4105d1bf378268cd79800f50c37997 Mon Sep 17 00:00:00 2001 From: tf-release-bot Date: Thu, 11 Jul 2019 20:25:05 +0000 Subject: [PATCH 0194/1054] Cleanup after v2.19.0 release --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a2fbbb65d79..f2a5534a61ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +## 2.20.0 (Unreleased) ## 2.19.0 (July 11, 2019) FEATURES: From 07e1882afb221ae3b95875d6be00f46d87ff0d11 Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 11 Jul 2019 21:56:53 +0100 Subject: [PATCH 0195/1054] Added Data Resource for WAF Web ACL --- aws/data_source_aws_waf_web_acl.go | 64 ++++++++++++++++++ aws/data_source_aws_waf_web_acl_test.go | 84 ++++++++++++++++++++++++ aws/provider.go | 1 + website/aws.erb | 3 + website/docs/d/waf_web_acl.html.markdown | 30 +++++++++ 5 files changed, 182 insertions(+) create mode 100644 aws/data_source_aws_waf_web_acl.go create mode 100644 aws/data_source_aws_waf_web_acl_test.go create mode 100644 website/docs/d/waf_web_acl.html.markdown diff --git a/aws/data_source_aws_waf_web_acl.go b/aws/data_source_aws_waf_web_acl.go new file mode 100644 index 000000000000..a56f2a681584 --- /dev/null +++ b/aws/data_source_aws_waf_web_acl.go @@ -0,0 +1,64 @@ +package aws + +import ( + "fmt" + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/waf" + "github.com/hashicorp/terraform/helper/schema" +) + +func dataSourceAwsWafWebAcl() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAwsWafWebAclRead, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataSourceAwsWafWebAclRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).wafconn + name := d.Get("name").(string) + + acls := make([]*waf.WebACLSummary, 0) + // ListRulesInput does not have a name parameter for filtering + input := &waf.ListWebACLsInput{} + for { + output, err := conn.ListWebACLs(input) + if err != nil { + return fmt.Errorf("error reading web ACLs: %s", err) + } + for _, acl := range output.WebACLs { + if aws.StringValue(acl.Name) == name { + acls = append(acls, acl) + } + } + + if output.NextMarker == nil { + break + } + input.NextMarker = output.NextMarker + } + + if len(acls) == 0 { + return fmt.Errorf("web ACLs not found for name: %s", name) + } + + if len(acls) > 1 { + return fmt.Errorf("multiple web ACLs found for name: %s", name) + } + + acl := acls[0] + + d.SetId(aws.StringValue(acl.WebACLId)) + + return nil +} diff --git a/aws/data_source_aws_waf_web_acl_test.go b/aws/data_source_aws_waf_web_acl_test.go new file mode 100644 index 000000000000..0fa0f978cc7e --- /dev/null +++ b/aws/data_source_aws_waf_web_acl_test.go @@ -0,0 +1,84 @@ +package aws + +import ( + "fmt" + "regexp" + "testing" + + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccDataSourceAwsWafWebAcl_Basic(t *testing.T) { + name := "tf-acc-test" + resourceName := "aws_waf_web_acl.web_acl" + datasourceName := "data.aws_waf_web_acl.web_acl" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsWafWebAclConfig_NonExistent, + ExpectError: regexp.MustCompile(`web ACLs not found`), + }, + { + Config: testAccDataSourceAwsWafWebAclConfig_Name(name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(datasourceName, "id", resourceName, "id"), + resource.TestCheckResourceAttrPair(datasourceName, "name", resourceName, "name"), + ), + }, + }, + }) +} + +func testAccDataSourceAwsWafWebAclConfig_Name(name string) string { + return fmt.Sprintf(` +resource "aws_waf_rule" "wafrule" { + name = "%s" + metric_name = "WafruleTest" + predicates { + data_id = "${aws_waf_ipset.test.id}" + negated = false + type = "IPMatch" + } +} +resource "aws_waf_ipset" "test" { + name = "%s" + ip_set_descriptors { + type = "IPV4" + value = "10.0.0.0/8" + } +} + +resource "aws_waf_web_acl" "web_acl" { + name = "%s" + metric_name = "tfWebACL" + + default_action { + type = "ALLOW" + } + + rules { + action { + type = "BLOCK" + } + + priority = 1 + rule_id = "${aws_waf_rule.wafrule.id}" + type = "REGULAR" + } +} + +data "aws_waf_web_acl" "web_acl" { + name = "${aws_waf_web_acl.web_acl.name}" +} + +`, name, name, name) +} + +const testAccDataSourceAwsWafWebAclConfig_NonExistent = ` +data "aws_waf_web_acl" "web_acl" { + name = "tf-acc-test-does-not-exist" +} +` diff --git a/aws/provider.go b/aws/provider.go index 4d7c6f312ca6..9c4ece24c8f1 100644 --- a/aws/provider.go +++ b/aws/provider.go @@ -272,6 +272,7 @@ func Provider() terraform.ResourceProvider { "aws_vpc_endpoint_service": dataSourceAwsVpcEndpointService(), "aws_vpc_peering_connection": dataSourceAwsVpcPeeringConnection(), "aws_vpn_gateway": dataSourceAwsVpnGateway(), + "aws_waf_web_acl": dataSourceAwsWafWebAcl(), "aws_workspaces_bundle": dataSourceAwsWorkspaceBundle(), // Adding the Aliases for the ALB -> LB Rename diff --git a/website/aws.erb b/website/aws.erb index 9f9b5088f4b3..ca0e361370b9 100644 --- a/website/aws.erb +++ b/website/aws.erb @@ -451,6 +451,9 @@
  • aws_vpn_gateway
  • +
  • + aws_waf_web_acl +
  • aws_workspaces_bundle
  • diff --git a/website/docs/d/waf_web_acl.html.markdown b/website/docs/d/waf_web_acl.html.markdown new file mode 100644 index 000000000000..8e7109b28f5e --- /dev/null +++ b/website/docs/d/waf_web_acl.html.markdown @@ -0,0 +1,30 @@ +--- +layout: "aws" +page_title: "AWS: aws_waf_web_acl" +sidebar_current: "docs-aws-datasource-waf-web-acl" +description: |- + Retrieves a WAF Web ACL id. +--- + +# Data Source: aws_waf_rule + +`aws_waf_rule` Retrieves a WAF Web ACL Resource Id. + +## Example Usage + +```hcl +data "aws_waf_web_acl" "example" { + name = "tfWAFRule" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the WAF Web ACL. + +## Attributes Reference +In addition to all arguments above, the following attributes are exported: + +* `id` - The ID of the WAF WebACL. \ No newline at end of file From 84cb117ba0b346de2192c182394a11f068bec62d Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 11 Jul 2019 22:46:20 +0100 Subject: [PATCH 0196/1054] added data source for WAFRegional Web ACL --- aws/data_source_aws_waf_web_acl.go | 64 ++++++++++++++++++++ aws/data_source_aws_waf_web_acl_test.go | 78 +++++++++++++++++++++++++ aws/provider.go | 1 + website/aws.erb | 3 + website/docs/d/wafregional_web_acl.html | 30 ++++++++++ 5 files changed, 176 insertions(+) create mode 100644 aws/data_source_aws_waf_web_acl.go create mode 100644 aws/data_source_aws_waf_web_acl_test.go create mode 100644 website/docs/d/wafregional_web_acl.html diff --git a/aws/data_source_aws_waf_web_acl.go b/aws/data_source_aws_waf_web_acl.go new file mode 100644 index 000000000000..552e2ea8c365 --- /dev/null +++ b/aws/data_source_aws_waf_web_acl.go @@ -0,0 +1,64 @@ +package aws + +import ( + "fmt" + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/waf" + "github.com/hashicorp/terraform/helper/schema" +) + +func dataSourceAwsWafRegionalWebAcl() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAwsWafRegionalWebAclRead, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "id": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func dataSourceAwsWafRegionalWebAclRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).wafregionalconn + name := d.Get("name").(string) + + acls := make([]*waf.WebACLSummary, 0) + // ListRulesInput does not have a name parameter for filtering + input := &waf.ListWebACLsInput{} + for { + output, err := conn.ListWebACLs(input) + if err != nil { + return fmt.Errorf("error reading web ACLs: %s", err) + } + for _, acl := range output.WebACLs { + if aws.StringValue(acl.Name) == name { + acls = append(acls, acl) + } + } + + if output.NextMarker == nil { + break + } + input.NextMarker = output.NextMarker + } + + if len(acls) == 0 { + return fmt.Errorf("web ACLs not found for name: %s", name) + } + + if len(acls) > 1 { + return fmt.Errorf("multiple web ACLs found for name: %s", name) + } + + acl := acls[0] + + d.SetId(aws.StringValue(acl.WebACLId)) + + return nil +} diff --git a/aws/data_source_aws_waf_web_acl_test.go b/aws/data_source_aws_waf_web_acl_test.go new file mode 100644 index 000000000000..8d2e5d690ef6 --- /dev/null +++ b/aws/data_source_aws_waf_web_acl_test.go @@ -0,0 +1,78 @@ +package aws + +import ( + "fmt" + "regexp" + "testing" + + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccDataSourceAwsWafRegionalWebAcl_Basic(t *testing.T) { + name := "tf-acc-test" + resourceName := "aws_wafregional_web_acl.web_acl" + datasourceName := "data.aws_wafregional_web_acl.web_acl" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsWafRegionalWebAclConfig_NonExistent, + ExpectError: regexp.MustCompile(`web ACLs not found`), + }, + { + Config: testAccDataSourceAwsWafRegionalWebAclConfig_Name(name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(datasourceName, "id", resourceName, "id"), + resource.TestCheckResourceAttrPair(datasourceName, "name", resourceName, "name"), + ), + }, + }, + }) +} + +func testAccDataSourceAwsWafRegionalWebAclConfig_Name(name string) string { + return fmt.Sprintf(` +resource "aws_wafregional_rule" "wafrule" { + name = "%s" + metric_name = "WafruleTest" + predicate { + data_id = "${aws_wafregional_ipset.test.id}" + negated = false + type = "IPMatch" + } +} +resource "aws_wafregional_ipset" "test" { + name = "%s" + ip_set_descriptor { + type = "IPV4" + value = "10.0.0.0/8" + } +} +resource "aws_wafregional_web_acl" "web_acl" { + name = "%s" + metric_name = "tfWebACL" + default_action { + type = "ALLOW" + } + rule { + action { + type = "BLOCK" + } + priority = 1 + rule_id = "${aws_wafregional_rule.wafrule.id}" + type = "REGULAR" + } +} +data "aws_wafregional_web_acl" "web_acl" { + name = "${aws_wafregional_web_acl.web_acl.name}" +} +`, name, name, name) +} + +const testAccDataSourceAwsWafRegionalWebAclConfig_NonExistent = ` +data "aws_wafregional_web_acl" "web_acl" { + name = "tf-acc-test-does-not-exist" +} +` diff --git a/aws/provider.go b/aws/provider.go index 4d7c6f312ca6..7f1a1a6af68e 100644 --- a/aws/provider.go +++ b/aws/provider.go @@ -272,6 +272,7 @@ func Provider() terraform.ResourceProvider { "aws_vpc_endpoint_service": dataSourceAwsVpcEndpointService(), "aws_vpc_peering_connection": dataSourceAwsVpcPeeringConnection(), "aws_vpn_gateway": dataSourceAwsVpnGateway(), + "aws_wafregional_web_acl": dataSourceAwsWafRegionalWebAcl(), "aws_workspaces_bundle": dataSourceAwsWorkspaceBundle(), // Adding the Aliases for the ALB -> LB Rename diff --git a/website/aws.erb b/website/aws.erb index 9f9b5088f4b3..282463058df9 100644 --- a/website/aws.erb +++ b/website/aws.erb @@ -451,6 +451,9 @@
  • aws_vpn_gateway
  • +
  • + aws_wafregional_web_acl +
  • aws_workspaces_bundle
  • diff --git a/website/docs/d/wafregional_web_acl.html b/website/docs/d/wafregional_web_acl.html new file mode 100644 index 000000000000..d3acc6344164 --- /dev/null +++ b/website/docs/d/wafregional_web_acl.html @@ -0,0 +1,30 @@ +--- +layout: "aws" +page_title: "AWS: aws_wafregional_web_acl" +sidebar_current: "docs-aws-datasource-wafregional-web-acl" +description: |- +Retrieves a WAF Regional Web ACL id. +--- + +# Data Source: aws_wafregional_web_acl + +`aws_wafregional_web_acl` Retrieves a WAF Regional Web ACL Resource Id. + +## Example Usage + +```hcl +data "aws_wafregional_web_acl" "example" { +name = "tfWAFRule" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the WAF Web ACL. + +## Attributes Reference +In addition to all arguments above, the following attributes are exported: + +* `id` - The ID of the WAF Regional WebACL. \ No newline at end of file From 2cfff0542f424c08290ea2de38cdcadfe036a1d8 Mon Sep 17 00:00:00 2001 From: kterada0509 Date: Tue, 5 Mar 2019 17:06:22 +0900 Subject: [PATCH 0197/1054] Fix to use GetMaintenanceWindowTask --- ...esource_aws_ssm_maintenance_window_task.go | 71 +++++++++---------- 1 file changed, 32 insertions(+), 39 deletions(-) diff --git a/aws/resource_aws_ssm_maintenance_window_task.go b/aws/resource_aws_ssm_maintenance_window_task.go index 39aad047b7af..005ea9e50868 100644 --- a/aws/resource_aws_ssm_maintenance_window_task.go +++ b/aws/resource_aws_ssm_maintenance_window_task.go @@ -242,53 +242,46 @@ func resourceAwsSsmMaintenanceWindowTaskCreate(d *schema.ResourceData, meta inte func resourceAwsSsmMaintenanceWindowTaskRead(d *schema.ResourceData, meta interface{}) error { ssmconn := meta.(*AWSClient).ssmconn + windowID := d.Get("window_id").(string) - params := &ssm.DescribeMaintenanceWindowTasksInput{ - WindowId: aws.String(d.Get("window_id").(string)), + params := &ssm.GetMaintenanceWindowTaskInput{ + WindowId: aws.String(windowID), + WindowTaskId: aws.String(d.Id()), + } + resp, err := ssmconn.GetMaintenanceWindowTask(params) + if isAWSErr(err, ssm.ErrCodeDoesNotExistException, "") { + log.Printf("[WARN] Maintenance Window (%s) Task (%s) not found, removing from state", windowID, d.Id()) + d.SetId("") + return nil } - - resp, err := ssmconn.DescribeMaintenanceWindowTasks(params) if err != nil { - return err + return fmt.Errorf("Error getting Maintenance Window (%s) Task (%s): %s", windowID, d.Id(), err) } - found := false - for _, t := range resp.Tasks { - if *t.WindowTaskId == d.Id() { - found = true - - d.Set("window_id", t.WindowId) - d.Set("max_concurrency", t.MaxConcurrency) - d.Set("max_errors", t.MaxErrors) - d.Set("task_type", t.Type) - d.Set("service_role_arn", t.ServiceRoleArn) - d.Set("task_arn", t.TaskArn) - d.Set("priority", t.Priority) - d.Set("name", t.Name) - d.Set("description", t.Description) - - if t.LoggingInfo != nil { - if err := d.Set("logging_info", flattenAwsSsmMaintenanceWindowLoggingInfo(t.LoggingInfo)); err != nil { - return fmt.Errorf("Error setting logging_info error: %#v", err) - } - } - - if t.TaskParameters != nil { - if err := d.Set("task_parameters", flattenAwsSsmTaskParameters(t.TaskParameters)); err != nil { - return fmt.Errorf("Error setting task_parameters error: %#v", err) - } - } - - if err := d.Set("targets", flattenAwsSsmTargets(t.Targets)); err != nil { - return fmt.Errorf("Error setting targets error: %#v", err) - } + d.Set("window_id", resp.WindowId) + d.Set("max_concurrency", resp.MaxConcurrency) + d.Set("max_errors", resp.MaxErrors) + d.Set("task_type", resp.TaskType) + d.Set("service_role_arn", resp.ServiceRoleArn) + d.Set("task_arn", resp.TaskArn) + d.Set("priority", resp.Priority) + d.Set("name", resp.Name) + d.Set("description", resp.Description) + + if resp.LoggingInfo != nil { + if err := d.Set("logging_info", flattenAwsSsmMaintenanceWindowLoggingInfo(resp.LoggingInfo)); err != nil { + return fmt.Errorf("Error setting logging_info error: %#v", err) } } - if !found { - log.Printf("[INFO] Maintenance Window Target not found. Removing from state") - d.SetId("") - return nil + if resp.TaskParameters != nil { + if err := d.Set("task_parameters", flattenAwsSsmTaskParameters(resp.TaskParameters)); err != nil { + return fmt.Errorf("Error setting task_parameters error: %#v", err) + } + } + + if err := d.Set("targets", flattenAwsSsmTargets(resp.Targets)); err != nil { + return fmt.Errorf("Error setting targets error: %#v", err) } return nil From 925989f30d65478c56217824a7799a49d25732ea Mon Sep 17 00:00:00 2001 From: kterada0509 Date: Tue, 5 Mar 2019 17:09:31 +0900 Subject: [PATCH 0198/1054] Add Update Step for aws_ssm_maintenance_window_task --- ...esource_aws_ssm_maintenance_window_task.go | 67 +++++++++++++++---- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/aws/resource_aws_ssm_maintenance_window_task.go b/aws/resource_aws_ssm_maintenance_window_task.go index 005ea9e50868..305579edb577 100644 --- a/aws/resource_aws_ssm_maintenance_window_task.go +++ b/aws/resource_aws_ssm_maintenance_window_task.go @@ -15,6 +15,7 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { return &schema.Resource{ Create: resourceAwsSsmMaintenanceWindowTaskCreate, Read: resourceAwsSsmMaintenanceWindowTaskRead, + Update: resourceAwsSsmMaintenanceWindowTaskUpdate, Delete: resourceAwsSsmMaintenanceWindowTaskDelete, Schema: map[string]*schema.Schema{ @@ -27,13 +28,11 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { "max_concurrency": { Type: schema.TypeString, Required: true, - ForceNew: true, }, "max_errors": { Type: schema.TypeString, Required: true, - ForceNew: true, }, "task_type": { @@ -45,30 +44,25 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { "task_arn": { Type: schema.TypeString, Required: true, - ForceNew: true, }, "service_role_arn": { Type: schema.TypeString, Required: true, - ForceNew: true, }, "targets": { Type: schema.TypeList, Required: true, - ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "key": { Type: schema.TypeString, Required: true, - ForceNew: true, }, "values": { Type: schema.TypeList, Required: true, - ForceNew: true, Elem: &schema.Schema{Type: schema.TypeString}, }, }, @@ -78,28 +72,24 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { "name": { Type: schema.TypeString, Optional: true, - ForceNew: true, ValidateFunc: validateAwsSSMMaintenanceWindowTaskName, }, "description": { Type: schema.TypeString, Optional: true, - ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 128), }, "priority": { Type: schema.TypeInt, Optional: true, - ForceNew: true, }, "logging_info": { Type: schema.TypeList, MaxItems: 1, Optional: true, - ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "s3_bucket_name": { @@ -121,18 +111,15 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { "task_parameters": { Type: schema.TypeList, Optional: true, - ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, Required: true, - ForceNew: true, }, "values": { Type: schema.TypeList, Required: true, - ForceNew: true, Elem: &schema.Schema{Type: schema.TypeString}, }, }, @@ -287,6 +274,55 @@ func resourceAwsSsmMaintenanceWindowTaskRead(d *schema.ResourceData, meta interf return nil } +func resourceAwsSsmMaintenanceWindowTaskUpdate(d *schema.ResourceData, meta interface{}) error { + ssmconn := meta.(*AWSClient).ssmconn + windowID := d.Get("window_id").(string) + + params := &ssm.UpdateMaintenanceWindowTaskInput{ + WindowId: aws.String(windowID), + WindowTaskId: aws.String(d.Id()), + MaxConcurrency: aws.String(d.Get("max_concurrency").(string)), + MaxErrors: aws.String(d.Get("max_errors").(string)), + ServiceRoleArn: aws.String(d.Get("service_role_arn").(string)), + TaskArn: aws.String(d.Get("task_arn").(string)), + Targets: expandAwsSsmTargets(d.Get("targets").([]interface{})), + Replace: aws.Bool(true), + } + + if v, ok := d.GetOk("name"); ok { + params.Name = aws.String(v.(string)) + } + + if v, ok := d.GetOk("description"); ok { + params.Description = aws.String(v.(string)) + } + + if v, ok := d.GetOk("priority"); ok { + params.Priority = aws.Int64(int64(v.(int))) + } + + if v, ok := d.GetOk("logging_info"); ok { + params.LoggingInfo = expandAwsSsmMaintenanceWindowLoggingInfo(v.([]interface{})) + } + + if v, ok := d.GetOk("task_parameters"); ok { + params.TaskParameters = expandAwsSsmTaskParameters(v.([]interface{})) + } + + _, err := ssmconn.UpdateMaintenanceWindowTask(params) + if isAWSErr(err, ssm.ErrCodeDoesNotExistException, "") { + log.Printf("[WARN] Maintenance Window (%s) Task (%s) not found, removing from state", windowID, d.Id()) + d.SetId("") + return nil + } + + if err != nil { + return fmt.Errorf("Error updating Maintenance Window (%s) Task (%s): %s", windowID, d.Id(), err) + } + + return resourceAwsSsmMaintenanceWindowTaskRead(d, meta) +} + func resourceAwsSsmMaintenanceWindowTaskDelete(d *schema.ResourceData, meta interface{}) error { ssmconn := meta.(*AWSClient).ssmconn @@ -298,6 +334,9 @@ func resourceAwsSsmMaintenanceWindowTaskDelete(d *schema.ResourceData, meta inte } _, err := ssmconn.DeregisterTaskFromMaintenanceWindow(params) + if isAWSErr(err, ssm.ErrCodeDoesNotExistException, "") { + return nil + } if err != nil { return fmt.Errorf("error deregistering SSM Maintenance Window Task (%s): %s", d.Id(), err) } From 1300ab931412635b404bacf4e6c310e84e594ce7 Mon Sep 17 00:00:00 2001 From: kterada0509 Date: Tue, 5 Mar 2019 21:54:53 +0900 Subject: [PATCH 0199/1054] Add support import resource --- ...esource_aws_ssm_maintenance_window_task.go | 19 ++++++++++ ...ce_aws_ssm_maintenance_window_task_test.go | 36 ++++++++++++++++--- .../ssm_maintenance_window_task.html.markdown | 8 +++++ 3 files changed, 58 insertions(+), 5 deletions(-) diff --git a/aws/resource_aws_ssm_maintenance_window_task.go b/aws/resource_aws_ssm_maintenance_window_task.go index 305579edb577..184c11cc9b05 100644 --- a/aws/resource_aws_ssm_maintenance_window_task.go +++ b/aws/resource_aws_ssm_maintenance_window_task.go @@ -3,6 +3,7 @@ package aws import ( "fmt" "log" + "strings" "github.com/hashicorp/terraform/helper/validation" @@ -17,6 +18,9 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { Read: resourceAwsSsmMaintenanceWindowTaskRead, Update: resourceAwsSsmMaintenanceWindowTaskUpdate, Delete: resourceAwsSsmMaintenanceWindowTaskDelete, + Importer: &schema.ResourceImporter{ + State: resourceAwsSsmMaintenanceWindowTaskImport, + }, Schema: map[string]*schema.Schema{ "window_id": { @@ -343,3 +347,18 @@ func resourceAwsSsmMaintenanceWindowTaskDelete(d *schema.ResourceData, meta inte return nil } + +func resourceAwsSsmMaintenanceWindowTaskImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + idParts := strings.SplitN(d.Id(), "/", 2) + if len(idParts) != 2 || idParts[0] == "" || idParts[1] == "" { + return nil, fmt.Errorf("unexpected format of ID (%q), expected /", d.Id()) + } + + windowID := idParts[0] + windowTaskID := idParts[1] + + d.Set("window_id", windowID) + d.SetId(windowTaskID) + + return []*schema.ResourceData{d}, nil +} diff --git a/aws/resource_aws_ssm_maintenance_window_task_test.go b/aws/resource_aws_ssm_maintenance_window_task_test.go index 396eb00ec5b4..d3925bcabd93 100644 --- a/aws/resource_aws_ssm_maintenance_window_task_test.go +++ b/aws/resource_aws_ssm_maintenance_window_task_test.go @@ -14,6 +14,7 @@ import ( func TestAccAWSSSMMaintenanceWindowTask_basic(t *testing.T) { var task ssm.MaintenanceWindowTask + resourceName := "aws_ssm_maintenance_window_task.target" name := acctest.RandString(10) resource.ParallelTest(t, resource.TestCase{ @@ -24,9 +25,15 @@ func TestAccAWSSSMMaintenanceWindowTask_basic(t *testing.T) { { Config: testAccAWSSSMMaintenanceWindowTaskBasicConfig(name), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSSMMaintenanceWindowTaskExists("aws_ssm_maintenance_window_task.target", &task), + testAccCheckAWSSSMMaintenanceWindowTaskExists(resourceName, &task), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSSSMMaintenanceWindowTaskImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, }, }) } @@ -34,6 +41,8 @@ func TestAccAWSSSMMaintenanceWindowTask_basic(t *testing.T) { func TestAccAWSSSMMaintenanceWindowTask_updateForcesNewResource(t *testing.T) { var before, after ssm.MaintenanceWindowTask name := acctest.RandString(10) + resourceName := "aws_ssm_maintenance_window_task.target" + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -42,18 +51,24 @@ func TestAccAWSSSMMaintenanceWindowTask_updateForcesNewResource(t *testing.T) { { Config: testAccAWSSSMMaintenanceWindowTaskBasicConfig(name), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSSMMaintenanceWindowTaskExists("aws_ssm_maintenance_window_task.target", &before), + testAccCheckAWSSSMMaintenanceWindowTaskExists(resourceName, &before), ), }, { Config: testAccAWSSSMMaintenanceWindowTaskBasicConfigUpdated(name), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSSMMaintenanceWindowTaskExists("aws_ssm_maintenance_window_task.target", &after), - resource.TestCheckResourceAttr("aws_ssm_maintenance_window_task.target", "name", "TestMaintenanceWindowTask"), - resource.TestCheckResourceAttr("aws_ssm_maintenance_window_task.target", "description", "This resource is for test purpose only"), + testAccCheckAWSSSMMaintenanceWindowTaskExists(resourceName, &after), + resource.TestCheckResourceAttr(resourceName, "name", "TestMaintenanceWindowTask"), + resource.TestCheckResourceAttr(resourceName, "description", "This resource is for test purpose only"), testAccCheckAwsSsmWindowsTaskRecreated(t, &before, &after), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSSSMMaintenanceWindowTaskImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, }, }) } @@ -129,6 +144,17 @@ func testAccCheckAWSSSMMaintenanceWindowTaskDestroy(s *terraform.State) error { return nil } +func testAccAWSSSMMaintenanceWindowTaskImportStateIdFunc(resourceName string) resource.ImportStateIdFunc { + return func(s *terraform.State) (string, error) { + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return "", fmt.Errorf("Not found: %s", resourceName) + } + + return fmt.Sprintf("%s/%s", rs.Primary.Attributes["window_id"], rs.Primary.ID), nil + } +} + func testAccAWSSSMMaintenanceWindowTaskBasicConfig(rName string) string { return fmt.Sprintf(` resource "aws_ssm_maintenance_window" "foo" { diff --git a/website/docs/r/ssm_maintenance_window_task.html.markdown b/website/docs/r/ssm_maintenance_window_task.html.markdown index 2774d9f3e1d1..0d9c47844973 100644 --- a/website/docs/r/ssm_maintenance_window_task.html.markdown +++ b/website/docs/r/ssm_maintenance_window_task.html.markdown @@ -82,3 +82,11 @@ The following arguments are supported: In addition to all arguments above, the following attributes are exported: * `id` - The ID of the maintenance window task. + +## Import + +AWS Maintenance Window Task can be imported using the `window_id` and `window_task_id` separated by `/`. + +```sh +$ terraform import aws_ssm_maintenance_window_task.task / +``` From 6b183428af63cd8c6253ded2a022015778f6823b Mon Sep 17 00:00:00 2001 From: kterada0509 Date: Wed, 6 Mar 2019 15:36:04 +0900 Subject: [PATCH 0200/1054] Add support for task_invocation_parameters deprecated logging_info & task_parameters --- ...esource_aws_ssm_maintenance_window_task.go | 469 ++++++++++++- ...ce_aws_ssm_maintenance_window_task_test.go | 647 ++++++++++++++++++ .../ssm_maintenance_window_task.html.markdown | 53 +- 3 files changed, 1162 insertions(+), 7 deletions(-) diff --git a/aws/resource_aws_ssm_maintenance_window_task.go b/aws/resource_aws_ssm_maintenance_window_task.go index 184c11cc9b05..fa359f5ae30e 100644 --- a/aws/resource_aws_ssm_maintenance_window_task.go +++ b/aws/resource_aws_ssm_maintenance_window_task.go @@ -3,6 +3,8 @@ package aws import ( "fmt" "log" + "regexp" + "sort" "strings" "github.com/hashicorp/terraform/helper/validation" @@ -91,9 +93,10 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { }, "logging_info": { - Type: schema.TypeList, - MaxItems: 1, - Optional: true, + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Deprecated: "use 'task_invocation_parameters' argument instead", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "s3_bucket_name": { @@ -113,8 +116,9 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { }, "task_parameters": { - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + Deprecated: "use 'task_invocation_parameters' argument instead", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { @@ -129,6 +133,189 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { }, }, }, + + "task_invocation_parameters": { + Type: schema.TypeList, + Optional: true, + ConflictsWith: []string{"task_parameters", "logging_info"}, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "automation_parameters": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "document_version": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile("([$]LATEST|[$]DEFAULT|^[1-9][0-9]*$)"), "see https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_MaintenanceWindowAutomationParameters.html"), + }, + "parameters": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "values": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + }, + }, + }, + + "lambda_parameters": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "client_context": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 8000), + }, + + "payload": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringLenBetween(0, 4096), + }, + + "qualifier": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 128), + }, + }, + }, + }, + + "run_command_parameters": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "comment": { + Type: schema.TypeString, + Optional: true, + }, + + "document_hash": { + Type: schema.TypeString, + Optional: true, + }, + + "document_hash_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + ssm.DocumentHashTypeSha256, + ssm.DocumentHashTypeSha1, + }, false), + }, + + "notification_config": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "notification_arn": { + Type: schema.TypeString, + Optional: true, + }, + + "notification_events": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "notification_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + ssm.NotificationTypeCommand, + ssm.NotificationTypeInvocation, + }, false), + }, + }, + }, + }, + + "output_s3_bucket": { + Type: schema.TypeString, + Optional: true, + }, + + "output_s3_key_prefix": { + Type: schema.TypeString, + Optional: true, + }, + + "parameters": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "values": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + + "service_role_arn": { + Type: schema.TypeString, + Optional: true, + }, + + "timeout_seconds": { + Type: schema.TypeInt, + Optional: true, + }, + }, + }, + }, + + "step_functions_parameters": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "input": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringLenBetween(0, 4096), + }, + + "name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 80), + }, + }, + }, + }, + }, + }, + }, }, } } @@ -186,6 +373,264 @@ func flattenAwsSsmTaskParameters(taskParameters map[string]*ssm.MaintenanceWindo return result } +func expandAwsSsmTaskInvocationParameters(config []interface{}) *ssm.MaintenanceWindowTaskInvocationParameters { + params := &ssm.MaintenanceWindowTaskInvocationParameters{} + for _, v := range config { + paramConfig := v.(map[string]interface{}) + if attr, ok := paramConfig["automation_parameters"]; ok && len(attr.([]interface{})) > 0 { + params.Automation = expandAwsSsmTaskInvocationAutomationParameters(attr.([]interface{})) + } + if attr, ok := paramConfig["lambda_parameters"]; ok && len(attr.([]interface{})) > 0 { + params.Lambda = expandAwsSsmTaskInvocationLambdaParameters(attr.([]interface{})) + } + if attr, ok := paramConfig["run_command_parameters"]; ok && len(attr.([]interface{})) > 0 { + params.RunCommand = expandAwsSsmTaskInvocationRunCommandParameters(attr.([]interface{})) + } + if attr, ok := paramConfig["step_functions_parameters"]; ok && len(attr.([]interface{})) > 0 { + params.StepFunctions = expandAwsSsmTaskInvocationStepFunctionsParameters(attr.([]interface{})) + } + } + return params +} + +func flattenAwsSsmTaskInvocationParameters(parameters *ssm.MaintenanceWindowTaskInvocationParameters) []interface{} { + result := make(map[string]interface{}) + if parameters.Automation != nil { + result["automation_parameters"] = flattenAwsSsmTaskInvocationAutomationParameters(parameters.Automation) + } + + if parameters.Lambda != nil { + result["lambda_parameters"] = flattenAwsSsmTaskInvocationLambdaParameters(parameters.Lambda) + } + + if parameters.RunCommand != nil { + result["run_command_parameters"] = flattenAwsSsmTaskInvocationRunCommandParameters(parameters.RunCommand) + } + + if parameters.StepFunctions != nil { + result["step_functions_parameters"] = flattenAwsSsmTaskInvocationStepFunctionsParameters(parameters.StepFunctions) + } + + return []interface{}{result} +} + +func expandAwsSsmTaskInvocationAutomationParameters(config []interface{}) *ssm.MaintenanceWindowAutomationParameters { + params := &ssm.MaintenanceWindowAutomationParameters{} + configParam := config[0].(map[string]interface{}) + if attr, ok := configParam["document_version"]; ok && len(attr.(string)) != 0 { + params.DocumentVersion = aws.String(attr.(string)) + } + if attr, ok := configParam["parameters"]; ok && len(attr.([]interface{})) > 0 { + params.Parameters = expandAwsSsmTaskInvocationCommonParameters(attr.([]interface{})) + } + + return params +} + +func flattenAwsSsmTaskInvocationAutomationParameters(parameters *ssm.MaintenanceWindowAutomationParameters) []interface{} { + result := make(map[string]interface{}) + + if parameters.DocumentVersion != nil { + result["document_version"] = aws.StringValue(parameters.DocumentVersion) + } + if parameters.Parameters != nil { + result["parameters"] = flattenAwsSsmTaskInvocationCommonParameters(parameters.Parameters) + } + + return []interface{}{result} +} + +func expandAwsSsmTaskInvocationLambdaParameters(config []interface{}) *ssm.MaintenanceWindowLambdaParameters { + params := &ssm.MaintenanceWindowLambdaParameters{} + configParam := config[0].(map[string]interface{}) + if attr, ok := configParam["client_context"]; ok && len(attr.(string)) != 0 { + params.ClientContext = aws.String(attr.(string)) + } + if attr, ok := configParam["payload"]; ok && len(attr.(string)) != 0 { + params.Payload = []byte(attr.(string)) + } + if attr, ok := configParam["qualifier"]; ok && len(attr.(string)) != 0 { + params.Qualifier = aws.String(attr.(string)) + } + return params +} + +func flattenAwsSsmTaskInvocationLambdaParameters(parameters *ssm.MaintenanceWindowLambdaParameters) []interface{} { + result := make(map[string]interface{}) + + if parameters.ClientContext != nil { + result["client_context"] = aws.StringValue(parameters.ClientContext) + } + if parameters.Payload != nil { + result["payload"] = string(parameters.Payload) + } + if parameters.Qualifier != nil { + result["qualifier"] = aws.StringValue(parameters.Qualifier) + } + return []interface{}{result} +} + +func expandAwsSsmTaskInvocationRunCommandParameters(config []interface{}) *ssm.MaintenanceWindowRunCommandParameters { + params := &ssm.MaintenanceWindowRunCommandParameters{} + configParam := config[0].(map[string]interface{}) + if attr, ok := configParam["comment"]; ok && len(attr.(string)) != 0 { + params.Comment = aws.String(attr.(string)) + } + if attr, ok := configParam["document_hash"]; ok && len(attr.(string)) != 0 { + params.DocumentHash = aws.String(attr.(string)) + } + if attr, ok := configParam["document_hash_type"]; ok && len(attr.(string)) != 0 { + params.DocumentHashType = aws.String(attr.(string)) + } + if attr, ok := configParam["notification_config"]; ok && len(attr.([]interface{})) > 0 { + params.NotificationConfig = expandAwsSsmTaskInvocationRunCommandParametersNotificationConfig(attr.([]interface{})) + } + if attr, ok := configParam["output_s3_bucket"]; ok && len(attr.(string)) != 0 { + params.OutputS3BucketName = aws.String(attr.(string)) + } + if attr, ok := configParam["output_s3_key_prefix"]; ok && len(attr.(string)) != 0 { + params.OutputS3KeyPrefix = aws.String(attr.(string)) + } + if attr, ok := configParam["parameters"]; ok && len(attr.([]interface{})) > 0 { + params.Parameters = expandAwsSsmTaskInvocationCommonParameters(attr.([]interface{})) + } + if attr, ok := configParam["service_role_arn"]; ok && len(attr.(string)) != 0 { + params.ServiceRoleArn = aws.String(attr.(string)) + } + if attr, ok := configParam["timeout_seconds"]; ok && attr.(int) != 0 { + params.TimeoutSeconds = aws.Int64(int64(attr.(int))) + } + return params +} + +func flattenAwsSsmTaskInvocationRunCommandParameters(parameters *ssm.MaintenanceWindowRunCommandParameters) []interface{} { + result := make(map[string]interface{}) + + if parameters.Comment != nil { + result["comment"] = aws.StringValue(parameters.Comment) + } + if parameters.DocumentHash != nil { + result["document_hash"] = aws.StringValue(parameters.DocumentHash) + } + if parameters.DocumentHashType != nil { + result["document_hash_type"] = aws.StringValue(parameters.DocumentHashType) + } + if parameters.NotificationConfig != nil { + result["notification_config"] = flattenAwsSsmTaskInvocationRunCommandParametersNotificationConfig(parameters.NotificationConfig) + } + if parameters.OutputS3BucketName != nil { + result["output_s3_bucket"] = aws.StringValue(parameters.OutputS3BucketName) + } + if parameters.OutputS3KeyPrefix != nil { + result["output_s3_key_prefix"] = aws.StringValue(parameters.OutputS3KeyPrefix) + } + if parameters.Parameters != nil { + result["parameters"] = flattenAwsSsmTaskInvocationCommonParameters(parameters.Parameters) + } + if parameters.ServiceRoleArn != nil { + result["service_role_arn"] = aws.StringValue(parameters.ServiceRoleArn) + } + if parameters.TimeoutSeconds != nil { + result["timeout_seconds"] = aws.Int64Value(parameters.TimeoutSeconds) + } + + return []interface{}{result} +} + +func expandAwsSsmTaskInvocationStepFunctionsParameters(config []interface{}) *ssm.MaintenanceWindowStepFunctionsParameters { + params := &ssm.MaintenanceWindowStepFunctionsParameters{} + configParam := config[0].(map[string]interface{}) + + if attr, ok := configParam["input"]; ok && len(attr.(string)) != 0 { + params.Input = aws.String(attr.(string)) + } + if attr, ok := configParam["name"]; ok && len(attr.(string)) != 0 { + params.Name = aws.String(attr.(string)) + } + + return params +} + +func flattenAwsSsmTaskInvocationStepFunctionsParameters(parameters *ssm.MaintenanceWindowStepFunctionsParameters) []interface{} { + result := make(map[string]interface{}) + + if parameters.Input != nil { + result["input"] = aws.StringValue(parameters.Input) + } + if parameters.Name != nil { + result["name"] = aws.StringValue(parameters.Name) + } + return []interface{}{result} +} + +func expandAwsSsmTaskInvocationRunCommandParametersNotificationConfig(config []interface{}) *ssm.NotificationConfig { + params := &ssm.NotificationConfig{} + configParam := config[0].(map[string]interface{}) + + if attr, ok := configParam["notification_arn"]; ok && len(attr.(string)) != 0 { + params.NotificationArn = aws.String(attr.(string)) + } + if attr, ok := configParam["notification_events"]; ok && len(attr.([]interface{})) > 0 { + params.NotificationEvents = expandStringList(attr.([]interface{})) + } + if attr, ok := configParam["notification_type"]; ok && len(attr.(string)) != 0 { + params.NotificationType = aws.String(attr.(string)) + } + + return params +} + +func flattenAwsSsmTaskInvocationRunCommandParametersNotificationConfig(config *ssm.NotificationConfig) []interface{} { + result := make(map[string]interface{}) + + if config.NotificationArn != nil { + result["notification_arn"] = aws.StringValue(config.NotificationArn) + } + if config.NotificationEvents != nil { + result["notification_events"] = flattenStringList(config.NotificationEvents) + } + if config.NotificationType != nil { + result["notification_type"] = aws.StringValue(config.NotificationType) + } + + return []interface{}{result} +} + +func expandAwsSsmTaskInvocationCommonParameters(config []interface{}) map[string][]*string { + params := make(map[string][]*string) + + for _, v := range config { + paramConfig := v.(map[string]interface{}) + params[paramConfig["name"].(string)] = expandStringList(paramConfig["values"].([]interface{})) + } + + return params +} + +func flattenAwsSsmTaskInvocationCommonParameters(parameters map[string][]*string) []interface{} { + result := make([]interface{}, 0, len(parameters)) + + keys := make([]string, 0, len(parameters)) + for k := range parameters { + keys = append(keys, k) + } + sort.Strings(keys) + + for _, key := range keys { + values := make([]string, 0) + for _, value := range parameters[key] { + values = append(values, aws.StringValue(value)) + } + params := map[string]interface{}{ + "name": key, + "values": values, + } + result = append(result, params) + } + + return result +} + func resourceAwsSsmMaintenanceWindowTaskCreate(d *schema.ResourceData, meta interface{}) error { ssmconn := meta.(*AWSClient).ssmconn @@ -221,6 +666,10 @@ func resourceAwsSsmMaintenanceWindowTaskCreate(d *schema.ResourceData, meta inte params.TaskParameters = expandAwsSsmTaskParameters(v.([]interface{})) } + if v, ok := d.GetOk("task_invocation_parameters"); ok { + params.TaskInvocationParameters = expandAwsSsmTaskInvocationParameters(v.([]interface{})) + } + resp, err := ssmconn.RegisterTaskWithMaintenanceWindow(params) if err != nil { return err @@ -271,6 +720,12 @@ func resourceAwsSsmMaintenanceWindowTaskRead(d *schema.ResourceData, meta interf } } + if resp.TaskInvocationParameters != nil { + if err := d.Set("task_invocation_parameters", flattenAwsSsmTaskInvocationParameters(resp.TaskInvocationParameters)); err != nil { + return fmt.Errorf("Error setting task_invocation_parameters error: %#v", err) + } + } + if err := d.Set("targets", flattenAwsSsmTargets(resp.Targets)); err != nil { return fmt.Errorf("Error setting targets error: %#v", err) } @@ -313,6 +768,10 @@ func resourceAwsSsmMaintenanceWindowTaskUpdate(d *schema.ResourceData, meta inte params.TaskParameters = expandAwsSsmTaskParameters(v.([]interface{})) } + if v, ok := d.GetOk("task_invocation_parameters"); ok { + params.TaskInvocationParameters = expandAwsSsmTaskInvocationParameters(v.([]interface{})) + } + _, err := ssmconn.UpdateMaintenanceWindowTask(params) if isAWSErr(err, ssm.ErrCodeDoesNotExistException, "") { log.Printf("[WARN] Maintenance Window (%s) Task (%s) not found, removing from state", windowID, d.Id()) diff --git a/aws/resource_aws_ssm_maintenance_window_task_test.go b/aws/resource_aws_ssm_maintenance_window_task_test.go index d3925bcabd93..a41cae22334c 100644 --- a/aws/resource_aws_ssm_maintenance_window_task_test.go +++ b/aws/resource_aws_ssm_maintenance_window_task_test.go @@ -73,6 +73,139 @@ func TestAccAWSSSMMaintenanceWindowTask_updateForcesNewResource(t *testing.T) { }) } +func TestAccAWSSSMMaintenanceWindowTask_TaskInvocationAutomationParameters(t *testing.T) { + var task ssm.MaintenanceWindowTask + resourceName := "aws_ssm_maintenance_window_task.target" + + name := acctest.RandString(10) + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSSMMaintenanceWindowTaskAutomationConfig(name, "$DEFAULT"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMMaintenanceWindowTaskExists(resourceName, &task), + resource.TestCheckResourceAttr(resourceName, "task_invocation_parameters.0.automation_parameters.0.document_version", "$DEFAULT"), + ), + }, + { + Config: testAccAWSSSMMaintenanceWindowTaskAutomationConfigUpdate(name, "$LATEST"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMMaintenanceWindowTaskExists(resourceName, &task), + resource.TestCheckResourceAttr(resourceName, "task_invocation_parameters.0.automation_parameters.0.document_version", "$LATEST"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSSSMMaintenanceWindowTaskImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSSSMMaintenanceWindowTask_TaskInvocationLambdaParameters(t *testing.T) { + var task ssm.MaintenanceWindowTask + resourceName := "aws_ssm_maintenance_window_task.target" + rString := acctest.RandString(8) + rInt := acctest.RandInt() + + funcName := fmt.Sprintf("tf_acc_lambda_func_tags_%s", rString) + policyName := fmt.Sprintf("tf_acc_policy_lambda_func_tags_%s", rString) + roleName := fmt.Sprintf("tf_acc_role_lambda_func_tags_%s", rString) + sgName := fmt.Sprintf("tf_acc_sg_lambda_func_tags_%s", rString) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSSMMaintenanceWindowTaskLambdaConfig(funcName, policyName, roleName, sgName, rString, rInt), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMMaintenanceWindowTaskExists(resourceName, &task), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSSSMMaintenanceWindowTaskImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSSSMMaintenanceWindowTask_TaskInvocationRunCommandParameters(t *testing.T) { + var task ssm.MaintenanceWindowTask + resourceName := "aws_ssm_maintenance_window_task.target" + serviceRoleResourceName := "aws_iam_role.ssm_role" + s3BucketResourceName := "aws_s3_bucket.foo" + + name := acctest.RandString(10) + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSSMMaintenanceWindowTaskRunCommandConfig(name, "test comment", 30), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMMaintenanceWindowTaskExists(resourceName, &task), + resource.TestCheckResourceAttrPair(resourceName, "service_role_arn", serviceRoleResourceName, "arn"), + resource.TestCheckResourceAttrPair(resourceName, "task_invocation_parameters.0.run_command_parameters.0.service_role_arn", serviceRoleResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "task_invocation_parameters.0.run_command_parameters.0.comment", "test comment"), + resource.TestCheckResourceAttr(resourceName, "task_invocation_parameters.0.run_command_parameters.0.timeout_seconds", "30"), + ), + }, + { + Config: testAccAWSSSMMaintenanceWindowTaskRunCommandConfigUpdate(name, "test comment update", 60), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMMaintenanceWindowTaskExists(resourceName, &task), + resource.TestCheckResourceAttr(resourceName, "task_invocation_parameters.0.run_command_parameters.0.comment", "test comment update"), + resource.TestCheckResourceAttr(resourceName, "task_invocation_parameters.0.run_command_parameters.0.timeout_seconds", "60"), + resource.TestCheckResourceAttrPair(resourceName, "task_invocation_parameters.0.run_command_parameters.0.output_s3_bucket", s3BucketResourceName, "id"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSSSMMaintenanceWindowTaskImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSSSMMaintenanceWindowTask_TaskInvocationStepFunctionParameters(t *testing.T) { + var task ssm.MaintenanceWindowTask + resourceName := "aws_ssm_maintenance_window_task.target" + rString := acctest.RandString(8) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSSMMaintenanceWindowTaskStepFunctionConfig(rString), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMMaintenanceWindowTaskExists(resourceName, &task), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSSSMMaintenanceWindowTaskImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} + func testAccCheckAwsSsmWindowsTaskRecreated(t *testing.T, before, after *ssm.MaintenanceWindowTask) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -302,3 +435,517 @@ EOF } `, rName, rName, rName) } + +func testAccAWSSSMMaintenanceWindowTaskAutomationConfig(rName, version string) string { + return fmt.Sprintf(` +resource "aws_ssm_maintenance_window" "foo" { + name = "maintenance-window-%[1]s" + schedule = "cron(0 16 ? * TUE *)" + duration = 3 + cutoff = 1 +} + +resource "aws_ssm_maintenance_window_task" "target" { + window_id = "${aws_ssm_maintenance_window.foo.id}" + task_type = "AUTOMATION" + task_arn = "AWS-CreateImage" + priority = 1 + service_role_arn = "${aws_iam_role.ssm_role.arn}" + max_concurrency = "2" + max_errors = "1" + targets { + key = "InstanceIds" + values = ["${aws_instance.foo.id}"] + } + task_invocation_parameters { + automation_parameters { + document_version = "%[2]s" + parameters { + name = "InstanceId" + values = ["${aws_instance.foo.id}"] + } + parameters { + name = "NoReboot" + values = ["false"] + } + } + } +} + +resource "aws_instance" "foo" { + ami = "ami-4fccb37f" + + instance_type = "m1.small" +} + +resource "aws_iam_role" "ssm_role" { + name = "ssm-role-%[1]s" + + assume_role_policy = < Date: Tue, 9 Jul 2019 12:35:33 +0900 Subject: [PATCH 0201/1054] fix to space --- ...ce_aws_ssm_maintenance_window_task_test.go | 290 +++++++++--------- 1 file changed, 145 insertions(+), 145 deletions(-) diff --git a/aws/resource_aws_ssm_maintenance_window_task_test.go b/aws/resource_aws_ssm_maintenance_window_task_test.go index a41cae22334c..eb5d3c80f7f7 100644 --- a/aws/resource_aws_ssm_maintenance_window_task_test.go +++ b/aws/resource_aws_ssm_maintenance_window_task_test.go @@ -291,20 +291,20 @@ func testAccAWSSSMMaintenanceWindowTaskImportStateIdFunc(resourceName string) re func testAccAWSSSMMaintenanceWindowTaskBasicConfig(rName string) string { return fmt.Sprintf(` resource "aws_ssm_maintenance_window" "foo" { - name = "maintenance-window-%s" + name = "maintenance-window-%s" schedule = "cron(0 16 ? * TUE *)" duration = 3 cutoff = 1 } resource "aws_ssm_maintenance_window_task" "target" { - window_id = "${aws_ssm_maintenance_window.foo.id}" - task_type = "RUN_COMMAND" - task_arn = "AWS-RunShellScript" - priority = 1 + window_id = "${aws_ssm_maintenance_window.foo.id}" + task_type = "RUN_COMMAND" + task_arn = "AWS-RunShellScript" + priority = 1 service_role_arn = "${aws_iam_role.ssm_role.arn}" max_concurrency = "2" - max_errors = "1" + max_errors = "1" targets { key = "InstanceIds" @@ -330,14 +330,14 @@ resource "aws_iam_role" "ssm_role" { { "Version": "2012-10-17", "Statement": [ - { - "Action": "sts:AssumeRole", - "Principal": { - "Service": "events.amazonaws.com" - }, - "Effect": "Allow", - "Sid": "" - } + { + "Action": "sts:AssumeRole", + "Principal": { + "Service": "events.amazonaws.com" + }, + "Effect": "Allow", + "Sid": "" + } ] } POLICY @@ -364,22 +364,22 @@ EOF func testAccAWSSSMMaintenanceWindowTaskBasicConfigUpdated(rName string) string { return fmt.Sprintf(` resource "aws_ssm_maintenance_window" "foo" { - name = "maintenance-window-%s" + name = "maintenance-window-%s" schedule = "cron(0 16 ? * TUE *)" duration = 3 cutoff = 1 } resource "aws_ssm_maintenance_window_task" "target" { - window_id = "${aws_ssm_maintenance_window.foo.id}" - task_type = "RUN_COMMAND" - task_arn = "AWS-RunShellScript" - priority = 1 - name = "TestMaintenanceWindowTask" - description = "This resource is for test purpose only" + window_id = "${aws_ssm_maintenance_window.foo.id}" + task_type = "RUN_COMMAND" + task_arn = "AWS-RunShellScript" + priority = 1 + name = "TestMaintenanceWindowTask" + description = "This resource is for test purpose only" service_role_arn = "${aws_iam_role.ssm_role.arn}" max_concurrency = "2" - max_errors = "1" + max_errors = "1" targets { key = "InstanceIds" @@ -405,14 +405,14 @@ resource "aws_iam_role" "ssm_role" { { "Version": "2012-10-17", "Statement": [ - { - "Action": "sts:AssumeRole", - "Principal": { - "Service": "events.amazonaws.com" - }, - "Effect": "Allow", - "Sid": "" - } + { + "Action": "sts:AssumeRole", + "Principal": { + "Service": "events.amazonaws.com" + }, + "Effect": "Allow", + "Sid": "" + } ] } POLICY @@ -458,17 +458,17 @@ resource "aws_ssm_maintenance_window_task" "target" { values = ["${aws_instance.foo.id}"] } task_invocation_parameters { - automation_parameters { - document_version = "%[2]s" - parameters { - name = "InstanceId" - values = ["${aws_instance.foo.id}"] - } - parameters { - name = "NoReboot" - values = ["false"] - } - } + automation_parameters { + document_version = "%[2]s" + parameters { + name = "InstanceId" + values = ["${aws_instance.foo.id}"] + } + parameters { + name = "NoReboot" + values = ["false"] + } + } } } @@ -485,14 +485,14 @@ resource "aws_iam_role" "ssm_role" { { "Version": "2012-10-17", "Statement": [ - { - "Action": "sts:AssumeRole", - "Principal": { - "Service": "events.amazonaws.com" - }, - "Effect": "Allow", - "Sid": "" - } + { + "Action": "sts:AssumeRole", + "Principal": { + "Service": "events.amazonaws.com" + }, + "Effect": "Allow", + "Sid": "" + } ] } POLICY @@ -520,9 +520,9 @@ EOF func testAccAWSSSMMaintenanceWindowTaskAutomationConfigUpdate(rName, version string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "foo" { - bucket = "tf-s3-%[1]s" - acl = "private" - force_destroy = true + bucket = "tf-s3-%[1]s" + acl = "private" + force_destroy = true } resource "aws_ssm_maintenance_window" "foo" { @@ -545,17 +545,17 @@ resource "aws_ssm_maintenance_window_task" "target" { values = ["${aws_instance.foo.id}"] } task_invocation_parameters { - automation_parameters { - document_version = "%[2]s" - parameters { - name = "InstanceId" - values = ["${aws_instance.foo.id}"] - } - parameters { - name = "NoReboot" - values = ["false"] - } - } + automation_parameters { + document_version = "%[2]s" + parameters { + name = "InstanceId" + values = ["${aws_instance.foo.id}"] + } + parameters { + name = "NoReboot" + values = ["false"] + } + } } } @@ -572,14 +572,14 @@ resource "aws_iam_role" "ssm_role" { { "Version": "2012-10-17", "Statement": [ - { - "Action": "sts:AssumeRole", - "Principal": { - "Service": "events.amazonaws.com" - }, - "Effect": "Allow", - "Sid": "" - } + { + "Action": "sts:AssumeRole", + "Principal": { + "Service": "events.amazonaws.com" + }, + "Effect": "Allow", + "Sid": "" + } ] } POLICY @@ -626,10 +626,10 @@ resource "aws_ssm_maintenance_window_task" "target" { values = ["${aws_instance.foo.id}"] } task_invocation_parameters { - lambda_parameters { - client_context = "${base64encode(data.template_file.client_context.rendered)}" - payload = "${data.template_file.payload.rendered}" - } + lambda_parameters { + client_context = "${base64encode(data.template_file.client_context.rendered)}" + payload = "${data.template_file.payload.rendered}" + } } } @@ -646,14 +646,14 @@ resource "aws_iam_role" "ssm_role" { { "Version": "2012-10-17", "Statement": [ - { - "Action": "sts:AssumeRole", - "Principal": { - "Service": "events.amazonaws.com" - }, - "Effect": "Allow", - "Sid": "" - } + { + "Action": "sts:AssumeRole", + "Principal": { + "Service": "events.amazonaws.com" + }, + "Effect": "Allow", + "Sid": "" + } ] } POLICY @@ -678,9 +678,9 @@ EOF data "template_file" "client_context" { template = < Date: Tue, 9 Jul 2019 12:35:59 +0900 Subject: [PATCH 0202/1054] fix to follow review comment --- .../docs/r/ssm_maintenance_window_task.html.markdown | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/website/docs/r/ssm_maintenance_window_task.html.markdown b/website/docs/r/ssm_maintenance_window_task.html.markdown index 88c672bf2a3b..e51e9e872ee9 100644 --- a/website/docs/r/ssm_maintenance_window_task.html.markdown +++ b/website/docs/r/ssm_maintenance_window_task.html.markdown @@ -63,9 +63,9 @@ The following arguments are supported: * `description` - (Optional) The description of the maintenance window task. * `targets` - (Required) The targets (either instances or window target ids). Instances are specified using Key=InstanceIds,Values=instanceid1,instanceid2. Window target ids are specified using Key=WindowTargetIds,Values=window target id1, window target id2. * `priority` - (Optional) The priority of the task in the Maintenance Window, the lower the number the higher the priority. Tasks in a Maintenance Window are scheduled in priority order with tasks that have the same priority scheduled in parallel. -* `logging_info` - (Optional,**Deprecated**) A structure containing information about an Amazon S3 bucket to write instance-level logs to. Documented below. -* `task_parameters` - (Optional,**Deprecated**) A structure containing information about parameters required by the particular `task_arn`. Documented below. -* `task_invocation_parameters` - (Optional) The parameters for task execution. +* `logging_info` - (Optional, **Deprecated**) A structure containing information about an Amazon S3 bucket to write instance-level logs to. Use `task_invocation_parameters` configuration block `run_command_parameters` configuration block `output_s3_*` arguments instead. Conflicts with `task_invocation_parameters`. Documented below. +* `task_parameters` - (Optional, **Deprecated**) A structure containing information about parameters required by the particular `task_arn`. Use `parameter` configuration blocks under the `task_invocation_parameters` configuration block instead. Conflicts with `task_invocation_parameters`. Documented below. +* `task_invocation_parameters` - (Optional) The parameters for task execution. This argument is conflict with `task_parameters` and `logging_info`. `logging_info` supports the following: @@ -80,12 +80,10 @@ The following arguments are supported: `task_invocation_parameters` supports the following: -This argument is conflict with `task_parameters` and `logging_info`. - * `automation_parameters` - (Optional) The parameters for an AUTOMATION task type. Documented below. * `lambda_parameters` - (Optional) The parameters for a LAMBDA task type. Documented below. * `run_command_parameters` - (Optional) The parameters for a RUN_COMMAND task type. Documented below. -* `step_functions_parameters` - (Optional) +* `step_functions_parameters` - (Optional) The parameters for a STEP_FUNCTIONS task type. Documented below. `automation_parameters` supports the following: From b36e54b22d302f7234d8e865f5b5a97c7791ea47 Mon Sep 17 00:00:00 2001 From: kterada0509 Date: Fri, 12 Jul 2019 18:50:06 +0900 Subject: [PATCH 0203/1054] Add acctest case for removed ForceNew setting attributes --- ...ce_aws_ssm_maintenance_window_task_test.go | 114 ++++++++++++++++-- 1 file changed, 104 insertions(+), 10 deletions(-) diff --git a/aws/resource_aws_ssm_maintenance_window_task_test.go b/aws/resource_aws_ssm_maintenance_window_task_test.go index eb5d3c80f7f7..af6a16d2b582 100644 --- a/aws/resource_aws_ssm_maintenance_window_task_test.go +++ b/aws/resource_aws_ssm_maintenance_window_task_test.go @@ -13,7 +13,7 @@ import ( ) func TestAccAWSSSMMaintenanceWindowTask_basic(t *testing.T) { - var task ssm.MaintenanceWindowTask + var before, after ssm.MaintenanceWindowTask resourceName := "aws_ssm_maintenance_window_task.target" name := acctest.RandString(10) @@ -25,7 +25,18 @@ func TestAccAWSSSMMaintenanceWindowTask_basic(t *testing.T) { { Config: testAccAWSSSMMaintenanceWindowTaskBasicConfig(name), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSSMMaintenanceWindowTaskExists(resourceName, &task), + testAccCheckAWSSSMMaintenanceWindowTaskExists(resourceName, &before), + ), + }, + { + Config: testAccAWSSSMMaintenanceWindowTaskBasicConfigUpdate(name, "RUN_COMMAND", "AWS-InstallPowerShellModule", 3, 2), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMMaintenanceWindowTaskExists(resourceName, &after), + resource.TestCheckResourceAttr(resourceName, "task_type", "RUN_COMMAND"), + resource.TestCheckResourceAttr(resourceName, "task_arn", "AWS-InstallPowerShellModule"), + resource.TestCheckResourceAttr(resourceName, "max_concurrency", "3"), + resource.TestCheckResourceAttr(resourceName, "max_errors", "2"), + testAccCheckAwsSsmWindowsTaskNotRecreated(t, &before, &after), ), }, { @@ -206,6 +217,16 @@ func TestAccAWSSSMMaintenanceWindowTask_TaskInvocationStepFunctionParameters(t * }) } +func testAccCheckAwsSsmWindowsTaskNotRecreated(t *testing.T, + before, after *ssm.MaintenanceWindowTask) resource.TestCheckFunc { + return func(s *terraform.State) error { + if aws.StringValue(before.WindowTaskId) != aws.StringValue(after.WindowTaskId) { + t.Fatalf("Unexpected change of Windows Task IDs, but both were %s and %s", aws.StringValue(before.WindowTaskId), aws.StringValue(after.WindowTaskId)) + } + return nil + } +} + func testAccCheckAwsSsmWindowsTaskRecreated(t *testing.T, before, after *ssm.MaintenanceWindowTask) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -291,7 +312,7 @@ func testAccAWSSSMMaintenanceWindowTaskImportStateIdFunc(resourceName string) re func testAccAWSSSMMaintenanceWindowTaskBasicConfig(rName string) string { return fmt.Sprintf(` resource "aws_ssm_maintenance_window" "foo" { - name = "maintenance-window-%s" + name = "maintenance-window-%[1]s" schedule = "cron(0 16 ? * TUE *)" duration = 3 cutoff = 1 @@ -324,7 +345,7 @@ resource "aws_instance" "foo" { } resource "aws_iam_role" "ssm_role" { - name = "ssm-role-%s" + name = "ssm-role-%[1]s" assume_role_policy = < Date: Fri, 12 Jul 2019 11:59:12 +0100 Subject: [PATCH 0204/1054] Updated comment --- aws/data_source_aws_waf_web_acl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/data_source_aws_waf_web_acl.go b/aws/data_source_aws_waf_web_acl.go index 552e2ea8c365..266d376c77a4 100644 --- a/aws/data_source_aws_waf_web_acl.go +++ b/aws/data_source_aws_waf_web_acl.go @@ -29,7 +29,7 @@ func dataSourceAwsWafRegionalWebAclRead(d *schema.ResourceData, meta interface{} name := d.Get("name").(string) acls := make([]*waf.WebACLSummary, 0) - // ListRulesInput does not have a name parameter for filtering + // ListWebACLsInput does not have a name parameter for filtering input := &waf.ListWebACLsInput{} for { output, err := conn.ListWebACLs(input) From 974424ebdd3cdd020628bcaa3cd4103079cdedd6 Mon Sep 17 00:00:00 2001 From: Rob H Date: Fri, 12 Jul 2019 12:00:33 +0100 Subject: [PATCH 0205/1054] Updated comment --- aws/data_source_aws_waf_web_acl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/data_source_aws_waf_web_acl.go b/aws/data_source_aws_waf_web_acl.go index a56f2a681584..f99513cc3120 100644 --- a/aws/data_source_aws_waf_web_acl.go +++ b/aws/data_source_aws_waf_web_acl.go @@ -29,7 +29,7 @@ func dataSourceAwsWafWebAclRead(d *schema.ResourceData, meta interface{}) error name := d.Get("name").(string) acls := make([]*waf.WebACLSummary, 0) - // ListRulesInput does not have a name parameter for filtering + // ListWebACLsInput does not have a name parameter for filtering input := &waf.ListWebACLsInput{} for { output, err := conn.ListWebACLs(input) From 110be2ac0db772224e14613dba4c96933fe7e863 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Fri, 12 Jul 2019 11:24:03 -0400 Subject: [PATCH 0206/1054] tests/resource/aws_eip: Implement sweeper Previously: ``` --- FAIL: TestAccAWSEIP_basic (3.40s) testing.go:568: Step 0 error: errors during apply: Error: Error creating EIP: AddressLimitExceeded: The maximum number of addresses has been reached. $ aws ec2 describe-addresses | jq '.Addresses | length' 12 ``` Output from sweeper: ``` $ go test ./aws -v -sweep=us-west-2,us-east-1 -sweep-run=aws_eip -timeout 10h 2019/07/12 11:19:39 [DEBUG] Running Sweepers for region (us-west-2): ... 2019/07/12 11:22:11 [INFO] Releasing EC2 EIP: 34.208.158.17 2019/07/12 11:22:11 [INFO] Releasing EC2 EIP: 34.212.143.58 2019/07/12 11:22:12 [INFO] Releasing EC2 EIP: 35.162.26.198 2019/07/12 11:22:13 [INFO] Releasing EC2 EIP: 50.112.70.32 2019/07/12 11:22:13 [INFO] Releasing EC2 EIP: 52.11.97.102 2019/07/12 11:22:14 [INFO] Releasing EC2 EIP: 52.27.133.157 2019/07/12 11:22:14 [INFO] Releasing EC2 EIP: 52.32.47.10 2019/07/12 11:22:15 [INFO] Releasing EC2 EIP: 52.33.200.11 2019/07/12 11:22:15 [INFO] Releasing EC2 EIP: 52.35.152.141 2019/07/12 11:22:16 [INFO] Releasing EC2 EIP: 52.37.153.78 2019/07/12 11:22:16 [INFO] Releasing EC2 EIP: 52.39.3.122 2019/07/12 11:22:17 [INFO] Releasing EC2 EIP: 54.218.52.146 2019/07/12 11:22:18 Sweeper Tests ran: - aws_route_table - aws_eip - aws_batch_compute_environment - aws_db_instance - aws_elb - aws_instance - aws_vpc - aws_ec2_client_vpn_endpoint - aws_elasticache_replication_group - aws_lambda_function - aws_mq_broker - aws_ec2_transit_gateway_vpc_attachment - aws_route53_resolver_endpoint - aws_eks_cluster - aws_elasticache_cluster - aws_emr_cluster - aws_network_interface - aws_api_gateway_vpc_link - aws_security_group - aws_dx_gateway_association - aws_internet_gateway - aws_dx_gateway_association_proposal - aws_batch_job_queue - aws_beanstalk_environment - aws_vpc_endpoint - aws_msk_cluster - aws_spot_fleet_request - aws_vpn_gateway - aws_autoscaling_group - aws_db_subnet_group - aws_directory_service_directory - aws_vpc_endpoint_service - aws_nat_gateway - aws_network_acl - aws_elasticsearch_domain - aws_lb - aws_redshift_cluster - aws_subnet 2019/07/12 11:22:18 [DEBUG] Running Sweepers for region (us-east-1): 2019/07/12 11:22:39 [INFO] Releasing EC2 EIP: 54.225.196.195 2019/07/12 11:22:39 [INFO] Releasing EC2 EIP: 54.243.49.93 2019/07/12 11:22:39 [INFO] Releasing EC2 EIP: 3.212.164.38 2019/07/12 11:22:39 Sweeper Tests ran: - aws_autoscaling_group - aws_db_instance - aws_vpn_gateway - aws_db_subnet_group - aws_spot_fleet_request - aws_subnet - aws_nat_gateway - aws_elasticache_cluster - aws_vpc_endpoint - aws_lb - aws_redshift_cluster - aws_elb - aws_lambda_function - aws_network_acl - aws_vpc - aws_security_group - aws_dx_gateway_association - aws_eip - aws_directory_service_directory - aws_elasticache_replication_group - aws_mq_broker - aws_route_table - aws_instance - aws_network_interface - aws_route53_resolver_endpoint - aws_batch_compute_environment - aws_ec2_client_vpn_endpoint - aws_api_gateway_vpc_link - aws_msk_cluster - aws_vpc_endpoint_service - aws_internet_gateway - aws_dx_gateway_association_proposal - aws_beanstalk_environment - aws_ec2_transit_gateway_vpc_attachment - aws_eks_cluster - aws_elasticsearch_domain - aws_batch_job_queue - aws_emr_cluster $ aws ec2 describe-addresses | jq '.Addresses | length' 0 ``` --- aws/resource_aws_eip_test.go | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/aws/resource_aws_eip_test.go b/aws/resource_aws_eip_test.go index bbd1950bc663..832993bd7861 100644 --- a/aws/resource_aws_eip_test.go +++ b/aws/resource_aws_eip_test.go @@ -2,6 +2,7 @@ package aws import ( "fmt" + "log" "os" "strings" "testing" @@ -14,6 +15,76 @@ import ( "github.com/hashicorp/terraform/terraform" ) +// Implement a test sweeper for EIPs. +// This will currently skip EIPs with associations, +// although we depend on aws_vpc to potentially have +// the majority of those associations removed. +func init() { + resource.AddTestSweepers("aws_eip", &resource.Sweeper{ + Name: "aws_eip", + Dependencies: []string{ + "aws_vpc", + }, + F: testSweepEc2Eips, + }) +} + +func testSweepEc2Eips(region string) error { + client, err := sharedClientForRegion(region) + if err != nil { + return fmt.Errorf("error getting client: %s", err) + } + conn := client.(*AWSClient).ec2conn + + // There is currently no paginator or Marker/NextToken + input := &ec2.DescribeAddressesInput{} + + output, err := conn.DescribeAddresses(input) + + if testSweepSkipSweepError(err) { + log.Printf("[WARN] Skipping EC2 EIP sweep for %s: %s", region, err) + return nil + } + + if err != nil { + return fmt.Errorf("error describing EC2 EIPs: %s", err) + } + + if output == nil || len(output.Addresses) == 0 { + log.Print("[DEBUG] No EC2 EIPs to sweep") + return nil + } + + for _, address := range output.Addresses { + publicIP := aws.StringValue(address.PublicIp) + + if address.AssociationId != nil { + log.Printf("[INFO] Skipping EC2 EIP (%s) with association: %s", publicIP, aws.StringValue(address.AssociationId)) + continue + } + + input := &ec2.ReleaseAddressInput{} + + // The EC2 API is particular that you only specify one or the other + // InvalidParameterCombination: You may specify public IP or allocation id, but not both in the same call + if address.AllocationId != nil { + input.AllocationId = address.AllocationId + } else { + input.PublicIp = address.PublicIp + } + + log.Printf("[INFO] Releasing EC2 EIP: %s", publicIP) + + _, err := conn.ReleaseAddress(input) + + if err != nil { + return fmt.Errorf("error releasing EC2 EIP (%s): %s", publicIP, err) + } + } + + return nil +} + func TestAccAWSEIP_importEc2Classic(t *testing.T) { oldvar := os.Getenv("AWS_DEFAULT_REGION") os.Setenv("AWS_DEFAULT_REGION", "us-east-1") From d1d4edba45b8b32bd1d478b3f13c66672a1b7349 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Fri, 12 Jul 2019 11:32:04 -0400 Subject: [PATCH 0207/1054] Update CHANGELOG for #9305 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2a5534a61ee..1ab4ff04b14a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ ## 2.20.0 (Unreleased) + +ENHANCEMENTS: + +* provider: Support for assuming role using credential process from the shared AWS configuration file [GH-9305] + ## 2.19.0 (July 11, 2019) FEATURES: From 626b9640770cf139dcbdfbe5dcfade1f1715b231 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Fri, 12 Jul 2019 14:29:07 -0400 Subject: [PATCH 0208/1054] docs/provider: Initial Maintainers Guide Some starting information for a long form Maintainers Guide to complement the existing [Contributing Guide](https://github.com/terraform-providers/terraform-provider-aws/blob/master/.github/CONTRIBUTING.md). --- .github/MAINTAINING.md | 88 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/MAINTAINING.md diff --git a/.github/MAINTAINING.md b/.github/MAINTAINING.md new file mode 100644 index 000000000000..7be9cfef35e6 --- /dev/null +++ b/.github/MAINTAINING.md @@ -0,0 +1,88 @@ +# Maintaining the Terraform AWS Provider + + + +- [Pull Requests](#pull-requests) + - [Pull Request Review Process](#pull-request-review-process) + - [Dependency Updates](#dependency-updates) + - [AWS Go SDK Updates](#aws-go-sdk-updates) + - [Terraform Updates](#terraform-updates) + - [Pull Request Merge Process](#pull-request-merge-process) +- [Release Process](#release-process) + + + +## Pull Requests + +### Pull Request Review Process + +Notes for each type of pull request are (or will be) available in subsections below. + +- If you are planning on owning the pull request through merge/closure, assign it to yourself +- Add `bug`, `enhancement`, `new-data-source`, `new-resource`, or `technical-debt` labels to match expectations from change +- Review the contents of the pull request and ensure the change follows the relevant section of the [Contributing Guide](https://github.com/terraform-providers/terraform-provider-aws/blob/master/.github/CONTRIBUTING.md#checklists-for-contribution) +- If the change is not acceptable, leave a long form comment about the reasoning and close the pull request +- If the change is acceptable with modifications, leave a pull request review marked using the `Request Changes` option (for minor maintainer modification requests, giving feedback with the `Approve` option is recommended so they do not need to wait for another round of review) +- If the author is unresponsive for changes (generally we give two weeks), determine importance and level of effort to finish the pull request yourself including their commits or close the pull request +- Run relevant acceptance testing (locally or in TeamCity) and ensure no new failures are being introduced +- Approve the pull request with a comment outlining what steps you took that ensure the change is acceptable, e.g. acceptance testing output + +``````markdown +Looks good, thanks @username! :rocket: + +Output from acceptance testing in AWS Commercial: + +``` +--- PASS: TestAcc... +--- PASS: TestAcc... +``` + +Output from acceptance testing in AWS GovCloud (US): + +``` +--- PASS: TestAcc... +--- PASS: TestAcc... +``` +`````` + +#### Dependency Updates + +##### AWS Go SDK Updates + +Almost exclusively, `github.com/aws/aws-sdk-go` updates are additive in nature and it is generally safe to only scan through them before approving and merging. If you have any concerns about any of the service client updates such as suspicous code removals in the update or deprecations introduced, run the acceptance testing for potentially affected resources before merging. + +Other important notes: + +- CloudFront service client updates have previously caused an issue when a new field introduced in the SDK was not included with Terraform and caused all requests to error (https://github.com/terraform-providers/terraform-provider-aws/issues/4091). As a precaution, if you see CloudFront updates, run all the CloudFront resource acceptance testing before merging. +- Occassionally, there will be changes listed in the authentication pieces of the AWS Go SDK codebase, e.g. changes to `aws/session`. The AWS Go SDK `CHANGELOG` should include a relevant description of these changes under a heading such as `SDK Enhancements` or `SDK Bug Fixes`. If they seem worthy of a callout in the Terraform AWS Provider `CHANGELOG`, then upon merging we should include a similar message prefixed with the `provider` subsystem, e.g. `* provider: ...`. Additionally, if a `CHANGELOG` addition seemed appropriate, this dependency and version should also be updated in the Terraform S3 Backend, which currently lives in Terraform Core. An example of this can be found with https://github.com/terraform-providers/terraform-provider-aws/pull/9305 and https://github.com/hashicorp/terraform/pull/22055. + +##### Terraform Updates + +Run the full acceptance testing suite against the pull request and verify there are no new or unexpected failures. + +### Pull Request Merge Process + +- Add this pull request to the upcoming release milestone +- Add any linked issues that will be closed by the pull request to the same upcoming release milestone +- Merge the pull request +- Delete the branch (if the branch is on this repository) +- Update the repository `CHANGELOG.md`. See also the [Extending Terraform documentation](https://www.terraform.io/docs/extend/best-practices/versioning.html) for more information about the expected CHANGELOG format. +- Leave a comment on any issues closed by the pull request noting that it has been merged and when to expect the release containing it, e.g. + +```markdown +The fix for this has been merged and will release with version X.Y.Z of the Terraform AWS Provider, likely in the XXX timeframe. +``` + +## Release Process + +- Ensure a milestone exists for the next release after this release (Generally, the next milestone will be a minor version increase unless previously decided for a major or patch version) +- Check the upcoming release milestone for open items and either work through them or move them to the next milestone +- Run the HashiCorp (non-OSS) TeamCity release job with the `DEPLOYMENT_TARGET_VERSION` matching the expected release milestone and `DEPLOYMENT_NEXT_VERSION` matching the next release milestone +- Wait for the TeamCity release job and TeamCity website deployment jobs to complete +- For each item noted in the `CHANGELOG.md` for the release just completed (or milestone as a whole), add a comment to the pull request and any linked closed issues noting that it has been released, e.g. + +```markdown +This has been released in [version 2.19.0 of the Terraform AWS provider](https://github.com/terraform-providers/terraform-provider-aws/blob/master/CHANGELOG.md#2190-july-11-2019). Please see the [Terraform documentation on provider versioning](https://www.terraform.io/docs/configuration/providers.html#provider-versions) or reach out if you need any assistance upgrading. + +For further feature requests or bug reports with this functionality, please create a [new GitHub issue](https://github.com/terraform-providers/terraform-provider-aws/issues/new/choose) following the template for triage. Thanks! +``` From 0cd7a09803d62f61e95755210ef41aa3ad114911 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Fri, 12 Jul 2019 14:33:25 -0400 Subject: [PATCH 0209/1054] docs/provider: Clarify usage of pull request review types --- .github/MAINTAINING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/MAINTAINING.md b/.github/MAINTAINING.md index 7be9cfef35e6..211b8fcad279 100644 --- a/.github/MAINTAINING.md +++ b/.github/MAINTAINING.md @@ -22,7 +22,7 @@ Notes for each type of pull request are (or will be) available in subsections be - Add `bug`, `enhancement`, `new-data-source`, `new-resource`, or `technical-debt` labels to match expectations from change - Review the contents of the pull request and ensure the change follows the relevant section of the [Contributing Guide](https://github.com/terraform-providers/terraform-provider-aws/blob/master/.github/CONTRIBUTING.md#checklists-for-contribution) - If the change is not acceptable, leave a long form comment about the reasoning and close the pull request -- If the change is acceptable with modifications, leave a pull request review marked using the `Request Changes` option (for minor maintainer modification requests, giving feedback with the `Approve` option is recommended so they do not need to wait for another round of review) +- If the change is acceptable with modifications, leave a pull request review marked using the `Request Changes` option (for maintainer pull requests with minor modification requests, giving feedback with the `Approve` option is recommended so they do not need to wait for another round of review) - If the author is unresponsive for changes (generally we give two weeks), determine importance and level of effort to finish the pull request yourself including their commits or close the pull request - Run relevant acceptance testing (locally or in TeamCity) and ensure no new failures are being introduced - Approve the pull request with a comment outlining what steps you took that ensure the change is acceptable, e.g. acceptance testing output From 00cf29c483a2ae8daf74dae6afb12c0cd60c3a8d Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 12 Jul 2019 18:43:12 +0000 Subject: [PATCH 0210/1054] Update module aws/aws-sdk-go to v1.20.20 --- go.mod | 2 +- go.sum | 4 +- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 1 + .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../aws-sdk-go/service/apigatewayv2/api.go | 30 ++++++++++++ .../service/elasticsearchservice/api.go | 48 +++++++++++++++++++ .../aws/aws-sdk-go/service/iam/api.go | 6 --- vendor/modules.txt | 2 +- 8 files changed, 84 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index c16d2375148f..a07ee7bfdfb3 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/terraform-providers/terraform-provider-aws require ( - github.com/aws/aws-sdk-go v1.20.19 + github.com/aws/aws-sdk-go v1.20.20 github.com/beevik/etree v1.1.0 github.com/bflad/tfproviderlint v0.4.0 github.com/client9/misspell v0.3.4 diff --git a/go.sum b/go.sum index 5130d6ac6e21..a79661555f58 100644 --- a/go.sum +++ b/go.sum @@ -52,8 +52,8 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.16.36/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.20.19 h1:RQDLGGlcffQzAceEXGdMu+uGGPGhNu+vNG3BrUZAMPI= -github.com/aws/aws-sdk-go v1.20.19/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.20.20 h1:OAR/GtjMOhenkp1NNKr1N1FgIP3mQXHeGbRhvVIAQp0= +github.com/aws/aws-sdk-go v1.20.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs= github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A= diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index 371dfa6ff6e5..5e6346d83bf0 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -1568,6 +1568,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index e5e93a8bb640..55f246463940 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.20.19" +const SDKVersion = "1.20.20" diff --git a/vendor/github.com/aws/aws-sdk-go/service/apigatewayv2/api.go b/vendor/github.com/aws/aws-sdk-go/service/apigatewayv2/api.go index f611e9ec3d33..6a4afcc77d73 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/apigatewayv2/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/apigatewayv2/api.go @@ -12576,6 +12576,10 @@ type UpdateApiOutput struct { // for more information. RouteSelectionExpression *string `locationName:"routeSelectionExpression" type:"string"` + // A key value pair of string with key length between[1-128] and value length + // between[1-256] + Tags map[string]*string `locationName:"tags" type:"map"` + // A string with a length between [1-64]. Version *string `locationName:"version" type:"string"` @@ -12646,6 +12650,12 @@ func (s *UpdateApiOutput) SetRouteSelectionExpression(v string) *UpdateApiOutput return s } +// SetTags sets the Tags field's value. +func (s *UpdateApiOutput) SetTags(v map[string]*string) *UpdateApiOutput { + s.Tags = v + return s +} + // SetVersion sets the Version field's value. func (s *UpdateApiOutput) SetVersion(v string) *UpdateApiOutput { s.Version = &v @@ -13086,6 +13096,10 @@ type UpdateDomainNameOutput struct { // The domain name configurations. DomainNameConfigurations []*DomainNameConfiguration `locationName:"domainNameConfigurations" type:"list"` + + // A key value pair of string with key length between[1-128] and value length + // between[1-256] + Tags map[string]*string `locationName:"tags" type:"map"` } // String returns the string representation @@ -13116,6 +13130,12 @@ func (s *UpdateDomainNameOutput) SetDomainNameConfigurations(v []*DomainNameConf return s } +// SetTags sets the Tags field's value. +func (s *UpdateDomainNameOutput) SetTags(v map[string]*string) *UpdateDomainNameOutput { + s.Tags = v + return s +} + type UpdateIntegrationInput struct { _ struct{} `type:"structure"` @@ -14460,6 +14480,10 @@ type UpdateStageOutput struct { // The stage variable map. StageVariables map[string]*string `locationName:"stageVariables" type:"map"` + + // A key value pair of string with key length between[1-128] and value length + // between[1-256] + Tags map[string]*string `locationName:"tags" type:"map"` } // String returns the string representation @@ -14532,6 +14556,12 @@ func (s *UpdateStageOutput) SetStageVariables(v map[string]*string) *UpdateStage return s } +// SetTags sets the Tags field's value. +func (s *UpdateStageOutput) SetTags(v map[string]*string) *UpdateStageOutput { + s.Tags = v + return s +} + // The authorization type. Valid values are NONE for open access, AWS_IAM for // using AWS IAM permissions, and CUSTOM for using a Lambda authorizer. const ( diff --git a/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/api.go b/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/api.go index 30989f21ab61..1396376b54c5 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/elasticsearchservice/api.go @@ -6551,6 +6551,54 @@ const ( // ESPartitionInstanceTypeM410xlargeElasticsearch is a ESPartitionInstanceType enum value ESPartitionInstanceTypeM410xlargeElasticsearch = "m4.10xlarge.elasticsearch" + // ESPartitionInstanceTypeM5LargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeM5LargeElasticsearch = "m5.large.elasticsearch" + + // ESPartitionInstanceTypeM5XlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeM5XlargeElasticsearch = "m5.xlarge.elasticsearch" + + // ESPartitionInstanceTypeM52xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeM52xlargeElasticsearch = "m5.2xlarge.elasticsearch" + + // ESPartitionInstanceTypeM54xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeM54xlargeElasticsearch = "m5.4xlarge.elasticsearch" + + // ESPartitionInstanceTypeM512xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeM512xlargeElasticsearch = "m5.12xlarge.elasticsearch" + + // ESPartitionInstanceTypeR5LargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeR5LargeElasticsearch = "r5.large.elasticsearch" + + // ESPartitionInstanceTypeR5XlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeR5XlargeElasticsearch = "r5.xlarge.elasticsearch" + + // ESPartitionInstanceTypeR52xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeR52xlargeElasticsearch = "r5.2xlarge.elasticsearch" + + // ESPartitionInstanceTypeR54xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeR54xlargeElasticsearch = "r5.4xlarge.elasticsearch" + + // ESPartitionInstanceTypeR512xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeR512xlargeElasticsearch = "r5.12xlarge.elasticsearch" + + // ESPartitionInstanceTypeC5LargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeC5LargeElasticsearch = "c5.large.elasticsearch" + + // ESPartitionInstanceTypeC5XlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeC5XlargeElasticsearch = "c5.xlarge.elasticsearch" + + // ESPartitionInstanceTypeC52xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeC52xlargeElasticsearch = "c5.2xlarge.elasticsearch" + + // ESPartitionInstanceTypeC54xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeC54xlargeElasticsearch = "c5.4xlarge.elasticsearch" + + // ESPartitionInstanceTypeC59xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeC59xlargeElasticsearch = "c5.9xlarge.elasticsearch" + + // ESPartitionInstanceTypeC518xlargeElasticsearch is a ESPartitionInstanceType enum value + ESPartitionInstanceTypeC518xlargeElasticsearch = "c5.18xlarge.elasticsearch" + // ESPartitionInstanceTypeT2MicroElasticsearch is a ESPartitionInstanceType enum value ESPartitionInstanceTypeT2MicroElasticsearch = "t2.micro.elasticsearch" diff --git a/vendor/github.com/aws/aws-sdk-go/service/iam/api.go b/vendor/github.com/aws/aws-sdk-go/service/iam/api.go index ddefa47bfe69..686836132db2 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/iam/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/iam/api.go @@ -5420,12 +5420,6 @@ func (c *IAM) GetAccessKeyLastUsedRequest(input *GetAccessKeyLastUsedInput) (req // // See the AWS API reference guide for AWS Identity and Access Management's // API operation GetAccessKeyLastUsed for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchEntityException "NoSuchEntity" -// The request was rejected because it referenced a resource entity that does -// not exist. The error message describes the resource. -// // See also, https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetAccessKeyLastUsed func (c *IAM) GetAccessKeyLastUsed(input *GetAccessKeyLastUsedInput) (*GetAccessKeyLastUsedOutput, error) { req, out := c.GetAccessKeyLastUsedRequest(input) diff --git a/vendor/modules.txt b/vendor/modules.txt index a44fdb1c37ad..0cffc4288c7d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -21,7 +21,7 @@ github.com/apparentlymart/go-cidr/cidr github.com/apparentlymart/go-textseg/textseg # github.com/armon/go-radix v1.0.0 github.com/armon/go-radix -# github.com/aws/aws-sdk-go v1.20.19 +# github.com/aws/aws-sdk-go v1.20.20 github.com/aws/aws-sdk-go/aws github.com/aws/aws-sdk-go/aws/arn github.com/aws/aws-sdk-go/aws/awserr From a6c389b3f85ec721c422881b728c1ae6b5fcba7f Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 12 Jul 2019 19:21:44 +0000 Subject: [PATCH 0211/1054] Update module hashicorp/terraform to v0.12.4 --- go.mod | 2 +- go.sum | 12 +++- .../hashicorp/go-getter/checksum.go | 30 ++++---- .../hashicorp/go-getter/detect_bitbucket.go | 2 +- .../hcl2/hcl/hclsyntax/expression.go | 22 +++++- .../hcl2/hcl/hclsyntax/expression_template.go | 20 ++++++ .../hashicorp/hcl2/hcl/hclsyntax/parser.go | 8 +++ .../hashicorp/hcl2/hcl/json/structure.go | 6 +- .../hashicorp/hcl2/hcl/traversal_for_expr.go | 2 +- .../terraform/command/format/state.go | 17 +++-- .../terraform/configs/configload/getter.go | 2 + .../terraform/configs/version_constraint.go | 7 ++ .../terraform/helper/acctest/random.go | 13 ++-- .../terraform/helper/plugin/grpc_provider.go | 69 ++++++++++++++++--- .../helper/schema/field_reader_config.go | 3 + .../helper/schema/field_reader_diff.go | 4 +- .../terraform/helper/schema/resource.go | 15 +--- .../terraform/internal/initwd/getter.go | 2 + .../terraform/lang/funcs/collection.go | 5 +- .../terraform/lang/funcs/filesystem.go | 15 ++++ .../hashicorp/terraform/lang/functions.go | 1 + .../terraform/plans/objchange/compatible.go | 2 +- .../terraform/terraform/eval_diff.go | 3 +- .../hashicorp/terraform/terraform/evaluate.go | 2 +- .../hashicorp/terraform/version/version.go | 2 +- vendor/github.com/zclconf/go-cty/cty/path.go | 42 +++++++++++ vendor/modules.txt | 8 +-- 27 files changed, 242 insertions(+), 74 deletions(-) diff --git a/go.mod b/go.mod index a07ee7bfdfb3..74e0e59fd645 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.1 github.com/hashicorp/go-multierror v1.0.0 github.com/hashicorp/go-version v1.2.0 - github.com/hashicorp/terraform v0.12.2 + github.com/hashicorp/terraform v0.12.4 github.com/hashicorp/vault v0.10.4 github.com/jen20/awspolicyequivalence v1.0.0 github.com/kubernetes-sigs/aws-iam-authenticator v0.3.1-0.20181019024009-82544ec86140 diff --git a/go.sum b/go.sum index a79661555f58..7a9ea2a7882f 100644 --- a/go.sum +++ b/go.sum @@ -52,6 +52,7 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.16.36/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.20.4/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.20.20 h1:OAR/GtjMOhenkp1NNKr1N1FgIP3mQXHeGbRhvVIAQp0= github.com/aws/aws-sdk-go v1.20.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= @@ -248,6 +249,8 @@ github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng github.com/hashicorp/go-getter v1.1.0/go.mod h1:q+PoBhh16brIKwJS9kt18jEtXHTg2EGkmrA9P7HVS+U= github.com/hashicorp/go-getter v1.3.0 h1:pFMSFlI9l5NaeuzkpE3L7BYk9qQ9juTAgXW/H0cqxcU= github.com/hashicorp/go-getter v1.3.0/go.mod h1:/O1k/AizTN0QmfEKknCYGvICeyKUDqCYA8vvWtGWDeQ= +github.com/hashicorp/go-getter v1.3.1-0.20190627223108-da0323b9545e h1:6krcdHPiS+aIP9XKzJzSahfjD7jG7Z+4+opm0z39V1M= +github.com/hashicorp/go-getter v1.3.1-0.20190627223108-da0323b9545e/go.mod h1:/O1k/AizTN0QmfEKknCYGvICeyKUDqCYA8vvWtGWDeQ= github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f h1:Yv9YzBlAETjy6AOX9eLBZ3nshNVRREgerT/3nvxlGho= github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= @@ -292,6 +295,8 @@ github.com/hashicorp/hcl2 v0.0.0-20181208003705-670926858200/go.mod h1:ShfpTh661 github.com/hashicorp/hcl2 v0.0.0-20190416162332-2c5a4b7d729a/go.mod h1:HtEzazM5AZ9fviNEof8QZB4T1Vz9UhHrGhnMPzl//Ek= github.com/hashicorp/hcl2 v0.0.0-20190515223218-4b22149b7cef h1:xZRvbcwHY8zhaxDwgkmpAp2emwZkVn7p3gat0zhq2X0= github.com/hashicorp/hcl2 v0.0.0-20190515223218-4b22149b7cef/go.mod h1:4oI94iqF3GB10QScn46WqbG0kgTUpha97SAzzg2+2ec= +github.com/hashicorp/hcl2 v0.0.0-20190702185634-5b39d9ff3a9a h1:1KfDwkIXrxrfMpqwuW//ujObiYNuR2DqaETSK2NB8Ug= +github.com/hashicorp/hcl2 v0.0.0-20190702185634-5b39d9ff3a9a/go.mod h1:FSQTwDi9qesxGBsII2VqhIzKQ4r0bHvBkOczWfD7llg= github.com/hashicorp/hil v0.0.0-20190212112733-ab17b08d6590 h1:2yzhWGdgQUWZUCNK+AoO35V+HTsgEmcM4J9IkArh7PI= github.com/hashicorp/hil v0.0.0-20190212112733-ab17b08d6590/go.mod h1:n2TSygSNwsLJ76m8qFXTSc7beTb+auJxYdqrnoqwZWE= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= @@ -300,8 +305,8 @@ github.com/hashicorp/memberlist v0.1.0/go.mod h1:ncdBp14cuox2iFOq3kDiquKU6fqsTBc github.com/hashicorp/serf v0.0.0-20160124182025-e4ec8cc423bb/go.mod h1:h/Ru6tmZazX7WO/GDmwdpS975F019L4t5ng5IgwbNrE= github.com/hashicorp/terraform v0.12.0-alpha4.0.20190424121927-9327eedb0417/go.mod h1:A3NsI7WT87OMgpcD15cu6dK2YNpihchZp5fxUf8EHBg= github.com/hashicorp/terraform v0.12.0/go.mod h1:Ke0ig9gGZ8rhV6OddAhBYt5nXmpvXsuNQQ8w9qYBZfU= -github.com/hashicorp/terraform v0.12.2 h1:P5yMdQc+IYEc+fWw3olShmKdbBiCN7DtPjVz+GieBpk= -github.com/hashicorp/terraform v0.12.2/go.mod h1:4MELVjPGm2DO5bK9E7jPXM5F+1pkvT4fYJYtMcQ2CMs= +github.com/hashicorp/terraform v0.12.4 h1:cm+JE5bOO1RyvltKOkyxmhenGZ6lBIazzzxWdHDmWeE= +github.com/hashicorp/terraform v0.12.4/go.mod h1:R3nGcJpajl/k9hfg6Q/Mvj/mO9Zg4N2CuqXyGBFhjX0= github.com/hashicorp/terraform-config-inspect v0.0.0-20190327195015-8022a2663a70 h1:oZm5nE11yhzsTRz/YrUyDMSvixePqjoZihwn8ipuOYI= github.com/hashicorp/terraform-config-inspect v0.0.0-20190327195015-8022a2663a70/go.mod h1:ItvqtvbC3K23FFET62ZwnkwtpbKZm8t8eMcWjmVVjD8= github.com/hashicorp/vault v0.10.4 h1:4x0lHxui/ZRp/B3E0Auv1QNBJpzETqHR2kQD3mHSBJU= @@ -556,6 +561,9 @@ github.com/zclconf/go-cty v0.0.0-20190320224746-fd76348b9329/go.mod h1:xnAOWiHeO github.com/zclconf/go-cty v0.0.0-20190426224007-b18a157db9e2/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v0.0.0-20190516203816-4fecf87372ec h1:MSeYjmyjucsFbecMTxg63ASg23lcSARP/kr9sClTFfk= github.com/zclconf/go-cty v0.0.0-20190516203816-4fecf87372ec/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= +github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= +github.com/zclconf/go-cty v1.0.1-0.20190708163926-19588f92a98f h1:sq2p8SN6ji66CFEQFIWLlD/gFmGtr5hBrOzv5nLlGfA= +github.com/zclconf/go-cty v1.0.1-0.20190708163926-19588f92a98f/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty-yaml v0.1.0 h1:OP5nkApyAuXB88t8mRUqxD9gbKZocSLuVovrBAt8z10= github.com/zclconf/go-cty-yaml v0.1.0/go.mod h1:Lk26EcRlO3XbaQ8U2fxIJbEtbgEteSZFUpEr3XFTtsU= go.opencensus.io v0.18.0 h1:Mk5rgZcggtbvtAun5aJzAtjKKN/t0R3jJPlWILlv938= diff --git a/vendor/github.com/hashicorp/go-getter/checksum.go b/vendor/github.com/hashicorp/go-getter/checksum.go index bea7ed13c630..eeccfea9d3bf 100644 --- a/vendor/github.com/hashicorp/go-getter/checksum.go +++ b/vendor/github.com/hashicorp/go-getter/checksum.go @@ -19,8 +19,8 @@ import ( urlhelper "github.com/hashicorp/go-getter/helper/url" ) -// fileChecksum helps verifying the checksum for a file. -type fileChecksum struct { +// FileChecksum helps verifying the checksum for a file. +type FileChecksum struct { Type string Hash hash.Hash Value []byte @@ -50,7 +50,7 @@ func (cerr *ChecksumError) Error() string { // checksum is a simple method to compute the checksum of a source file // and compare it to the given expected value. -func (c *fileChecksum) checksum(source string) error { +func (c *FileChecksum) checksum(source string) error { f, err := os.Open(source) if err != nil { return fmt.Errorf("Failed to open file for checksum: %s", err) @@ -74,7 +74,7 @@ func (c *fileChecksum) checksum(source string) error { return nil } -// extractChecksum will return a fileChecksum based on the 'checksum' +// extractChecksum will return a FileChecksum based on the 'checksum' // parameter of u. // ex: // http://hashicorp.com/terraform?checksum= @@ -93,7 +93,7 @@ func (c *fileChecksum) checksum(source string) error { // *file2 // // see parseChecksumLine for more detail on checksum file parsing -func (c *Client) extractChecksum(u *url.URL) (*fileChecksum, error) { +func (c *Client) extractChecksum(u *url.URL) (*FileChecksum, error) { q := u.Query() v := q.Get("checksum") @@ -115,14 +115,14 @@ func (c *Client) extractChecksum(u *url.URL) (*fileChecksum, error) { switch checksumType { case "file": - return c.checksumFromFile(checksumValue, u) + return c.ChecksumFromFile(checksumValue, u) default: return newChecksumFromType(checksumType, checksumValue, filepath.Base(u.EscapedPath())) } } -func newChecksum(checksumValue, filename string) (*fileChecksum, error) { - c := &fileChecksum{ +func newChecksum(checksumValue, filename string) (*FileChecksum, error) { + c := &FileChecksum{ Filename: filename, } var err error @@ -133,7 +133,7 @@ func newChecksum(checksumValue, filename string) (*fileChecksum, error) { return c, nil } -func newChecksumFromType(checksumType, checksumValue, filename string) (*fileChecksum, error) { +func newChecksumFromType(checksumType, checksumValue, filename string) (*FileChecksum, error) { c, err := newChecksum(checksumValue, filename) if err != nil { return nil, err @@ -157,7 +157,7 @@ func newChecksumFromType(checksumType, checksumValue, filename string) (*fileChe return c, nil } -func newChecksumFromValue(checksumValue, filename string) (*fileChecksum, error) { +func newChecksumFromValue(checksumValue, filename string) (*FileChecksum, error) { c, err := newChecksum(checksumValue, filename) if err != nil { return nil, err @@ -183,14 +183,14 @@ func newChecksumFromValue(checksumValue, filename string) (*fileChecksum, error) return c, nil } -// checksumsFromFile will return all the fileChecksums found in file +// ChecksumFromFile will return all the FileChecksums found in file // -// checksumsFromFile will try to guess the hashing algorithm based on content +// ChecksumFromFile will try to guess the hashing algorithm based on content // of checksum file // -// checksumsFromFile will only return checksums for files that match file +// ChecksumFromFile will only return checksums for files that match file // behind src -func (c *Client) checksumFromFile(checksumFile string, src *url.URL) (*fileChecksum, error) { +func (c *Client) ChecksumFromFile(checksumFile string, src *url.URL) (*FileChecksum, error) { checksumFileURL, err := urlhelper.Parse(checksumFile) if err != nil { return nil, err @@ -286,7 +286,7 @@ func (c *Client) checksumFromFile(checksumFile string, src *url.URL) (*fileCheck // of a line. // for BSD type sums parseChecksumLine guesses the hashing algorithm // by checking the length of the checksum. -func parseChecksumLine(line string) (*fileChecksum, error) { +func parseChecksumLine(line string) (*FileChecksum, error) { parts := strings.Fields(line) switch len(parts) { diff --git a/vendor/github.com/hashicorp/go-getter/detect_bitbucket.go b/vendor/github.com/hashicorp/go-getter/detect_bitbucket.go index a183a17dfe77..19047eb19792 100644 --- a/vendor/github.com/hashicorp/go-getter/detect_bitbucket.go +++ b/vendor/github.com/hashicorp/go-getter/detect_bitbucket.go @@ -35,7 +35,7 @@ func (d *BitBucketDetector) detectHTTP(src string) (string, bool, error) { var info struct { SCM string `json:"scm"` } - infoUrl := "https://api.bitbucket.org/1.0/repositories" + u.Path + infoUrl := "https://api.bitbucket.org/2.0/repositories" + u.Path resp, err := http.Get(infoUrl) if err != nil { return "", true, fmt.Errorf("error looking up BitBucket URL: %s", err) diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression.go index 26819a2dafcc..b9bd6aced0d3 100644 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression.go +++ b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression.go @@ -473,8 +473,26 @@ func (e *ConditionalExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostic falseResult, falseDiags := e.FalseResult.Value(ctx) var diags hcl.Diagnostics - // Try to find a type that both results can be converted to. - resultType, convs := convert.UnifyUnsafe([]cty.Type{trueResult.Type(), falseResult.Type()}) + var resultType cty.Type + convs := make([]convert.Conversion, 2) + + switch { + // If either case is a dynamic null value (which would result from a + // literal null in the config), we know that it can convert to the expected + // type of the opposite case, and we don't need to speculatively reduce the + // final result type to DynamicPseudoType. + case trueResult.RawEquals(cty.NullVal(cty.DynamicPseudoType)): + resultType = falseResult.Type() + convs[0] = convert.GetConversionUnsafe(cty.DynamicPseudoType, resultType) + case falseResult.RawEquals(cty.NullVal(cty.DynamicPseudoType)): + resultType = trueResult.Type() + convs[1] = convert.GetConversionUnsafe(cty.DynamicPseudoType, resultType) + + default: + // Try to find a type that both results can be converted to. + resultType, convs = convert.UnifyUnsafe([]cty.Type{trueResult.Type(), falseResult.Type()}) + } + if resultType == cty.NilType { return cty.DynamicVal, hcl.Diagnostics{ { diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template.go index fa79e3d08f7d..ca3dae189f4c 100644 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template.go +++ b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template.go @@ -89,6 +89,26 @@ func (e *TemplateExpr) StartRange() hcl.Range { return e.Parts[0].StartRange() } +// IsStringLiteral returns true if and only if the template consists only of +// single string literal, as would be created for a simple quoted string like +// "foo". +// +// If this function returns true, then calling Value on the same expression +// with a nil EvalContext will return the literal value. +// +// Note that "${"foo"}", "${1}", etc aren't considered literal values for the +// purposes of this method, because the intent of this method is to identify +// situations where the user seems to be explicitly intending literal string +// interpretation, not situations that result in literals as a technicality +// of the template expression unwrapping behavior. +func (e *TemplateExpr) IsStringLiteral() bool { + if len(e.Parts) != 1 { + return false + } + _, ok := e.Parts[0].(*LiteralValueExpr) + return ok +} + // TemplateJoinExpr is used to convert tuples of strings produced by template // constructs (i.e. for loops) into flat strings, by converting the values // tos strings and joining them. This AST node is not used directly; it's diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser.go index 253ad5031a25..772ebae2bc60 100644 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser.go +++ b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser.go @@ -853,6 +853,14 @@ Traversal: SrcRange: rng, } ret = makeRelativeTraversal(ret, step, rng) + } else if tmpl, isTmpl := keyExpr.(*TemplateExpr); isTmpl && tmpl.IsStringLiteral() { + litKey, _ := tmpl.Value(nil) + rng := hcl.RangeBetween(open.Range, close.Range) + step := hcl.TraverseIndex{ + Key: litKey, + SrcRange: rng, + } + ret = makeRelativeTraversal(ret, step, rng) } else { rng := hcl.RangeBetween(open.Range, close.Range) ret = &IndexExpr{ diff --git a/vendor/github.com/hashicorp/hcl2/hcl/json/structure.go b/vendor/github.com/hashicorp/hcl2/hcl/json/structure.go index bdc0e983e5ee..74847c79a557 100644 --- a/vendor/github.com/hashicorp/hcl2/hcl/json/structure.go +++ b/vendor/github.com/hashicorp/hcl2/hcl/json/structure.go @@ -416,12 +416,14 @@ func (e *expression) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { case *booleanVal: return cty.BoolVal(v.Value), nil case *arrayVal: + var diags hcl.Diagnostics vals := []cty.Value{} for _, jsonVal := range v.Values { - val, _ := (&expression{src: jsonVal}).Value(ctx) + val, valDiags := (&expression{src: jsonVal}).Value(ctx) vals = append(vals, val) + diags = append(diags, valDiags...) } - return cty.TupleVal(vals), nil + return cty.TupleVal(vals), diags case *objectVal: var diags hcl.Diagnostics attrs := map[string]cty.Value{} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/traversal_for_expr.go b/vendor/github.com/hashicorp/hcl2/hcl/traversal_for_expr.go index d4a565a5f580..f69d5fe9b287 100644 --- a/vendor/github.com/hashicorp/hcl2/hcl/traversal_for_expr.go +++ b/vendor/github.com/hashicorp/hcl2/hcl/traversal_for_expr.go @@ -36,7 +36,7 @@ func AbsTraversalForExpr(expr Expression) (Traversal, Diagnostics) { &Diagnostic{ Severity: DiagError, Summary: "Invalid expression", - Detail: "A static variable reference is required.", + Detail: "A single static variable reference is required: only attribute access and indexing with constant keys. No calculations, function calls, template expressions, etc are allowed here.", Subject: expr.Range().Ptr(), }, } diff --git a/vendor/github.com/hashicorp/terraform/command/format/state.go b/vendor/github.com/hashicorp/terraform/command/format/state.go index f411ef9c6123..0130f5cf1ba0 100644 --- a/vendor/github.com/hashicorp/terraform/command/format/state.go +++ b/vendor/github.com/hashicorp/terraform/command/format/state.go @@ -75,11 +75,14 @@ func State(opts *StateOpts) string { v := m.OutputValues[k] p.buf.WriteString(fmt.Sprintf("%s = ", k)) p.writeValue(v.Value, plans.NoOp, 0) - p.buf.WriteString("\n\n") + p.buf.WriteString("\n") } } - return opts.Color.Color(strings.TrimSpace(p.buf.String())) + trimmedOutput := strings.TrimSpace(p.buf.String()) + trimmedOutput += "[reset]" + + return opts.Color.Color(trimmedOutput) } @@ -99,9 +102,9 @@ func formatStateModule(p blockBodyDiffPrinter, m *states.Module, schemas *terraf taintStr := "" if v.Current.Status == 'T' { - taintStr = "(tainted)" + taintStr = " (tainted)" } - p.buf.WriteString(fmt.Sprintf("# %s: %s\n", addr.Absolute(m.Addr).Instance(k), taintStr)) + p.buf.WriteString(fmt.Sprintf("# %s:%s\n", addr.Absolute(m.Addr).Instance(k), taintStr)) var schema *configschema.Block provider := m.Resources[key].ProviderConfig.ProviderConfig.StringCompact() @@ -169,7 +172,7 @@ func formatStateModule(p blockBodyDiffPrinter, m *states.Module, schemas *terraf p.buf.WriteString("}\n\n") } } - p.buf.WriteString("[reset]\n") + p.buf.WriteString("\n") } func formatNestedList(indent string, outputList []interface{}) string { @@ -231,7 +234,7 @@ func formatListOutput(indent, outputName string, outputList []interface{}) strin func formatNestedMap(indent string, outputMap map[string]interface{}) string { ks := make([]string, 0, len(outputMap)) - for k, _ := range outputMap { + for k := range outputMap { ks = append(ks, k) } sort.Strings(ks) @@ -256,7 +259,7 @@ func formatNestedMap(indent string, outputMap map[string]interface{}) string { func formatMapOutput(indent, outputName string, outputMap map[string]interface{}) string { ks := make([]string, 0, len(outputMap)) - for k, _ := range outputMap { + for k := range outputMap { ks = append(ks, k) } sort.Strings(ks) diff --git a/vendor/github.com/hashicorp/terraform/configs/configload/getter.go b/vendor/github.com/hashicorp/terraform/configs/configload/getter.go index 4a3daceee46d..75c7ef1f4174 100644 --- a/vendor/github.com/hashicorp/terraform/configs/configload/getter.go +++ b/vendor/github.com/hashicorp/terraform/configs/configload/getter.go @@ -20,6 +20,7 @@ import ( var goGetterDetectors = []getter.Detector{ new(getter.GitHubDetector), new(getter.BitBucketDetector), + new(getter.GCSDetector), new(getter.S3Detector), new(getter.FileDetector), } @@ -44,6 +45,7 @@ var goGetterDecompressors = map[string]getter.Decompressor{ var goGetterGetters = map[string]getter.Getter{ "file": new(getter.FileGetter), + "gcs": new(getter.GCSGetter), "git": new(getter.GitGetter), "hg": new(getter.HgGetter), "s3": new(getter.S3Getter), diff --git a/vendor/github.com/hashicorp/terraform/configs/version_constraint.go b/vendor/github.com/hashicorp/terraform/configs/version_constraint.go index 7aa19efc6767..e40ce1639695 100644 --- a/vendor/github.com/hashicorp/terraform/configs/version_constraint.go +++ b/vendor/github.com/hashicorp/terraform/configs/version_constraint.go @@ -45,6 +45,13 @@ func decodeVersionConstraint(attr *hcl.Attribute) (VersionConstraint, hcl.Diagno return ret, diags } + if !val.IsWhollyKnown() { + // If there is a syntax error, HCL sets the value of the given attribute + // to cty.DynamicVal. A diagnostic for the syntax error will already + // bubble up, so we will move forward gracefully here. + return ret, diags + } + constraintStr := val.AsString() constraints, err := version.NewConstraint(constraintStr) if err != nil { diff --git a/vendor/github.com/hashicorp/terraform/helper/acctest/random.go b/vendor/github.com/hashicorp/terraform/helper/acctest/random.go index 50b44301b27f..811bad420738 100644 --- a/vendor/github.com/hashicorp/terraform/helper/acctest/random.go +++ b/vendor/github.com/hashicorp/terraform/helper/acctest/random.go @@ -16,24 +16,25 @@ import ( "golang.org/x/crypto/ssh" ) +func init() { + rand.Seed(time.Now().UTC().UnixNano()) +} + // Helpers for generating random tidbits for use in identifiers to prevent // collisions in acceptance tests. // RandInt generates a random integer func RandInt() int { - reseed() return rand.New(rand.NewSource(time.Now().UnixNano())).Int() } // RandomWithPrefix is used to generate a unique name with a prefix, for // randomizing names in acceptance tests func RandomWithPrefix(name string) string { - reseed() return fmt.Sprintf("%s-%d", name, rand.New(rand.NewSource(time.Now().UnixNano())).Int()) } func RandIntRange(min int, max int) int { - reseed() source := rand.New(rand.NewSource(time.Now().UnixNano())) rangeMax := max - min @@ -48,7 +49,6 @@ func RandString(strlen int) string { // RandStringFromCharSet generates a random string by selecting characters from // the charset provided func RandStringFromCharSet(strlen int, charSet string) string { - reseed() result := make([]byte, strlen) for i := 0; i < strlen; i++ { result[i] = charSet[rand.Intn(len(charSet))] @@ -129,11 +129,6 @@ func pemEncode(b []byte, block string) (string, error) { return buf.String(), nil } -// Seeds random with current timestamp -func reseed() { - rand.Seed(time.Now().UTC().UnixNano()) -} - const ( // CharSetAlphaNum is the alphanumeric character set for use with // RandStringFromCharSet diff --git a/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go b/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go index 161af4d46188..104c8f5f470c 100644 --- a/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go +++ b/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/helper/schema" proto "github.com/hashicorp/terraform/internal/tfplugin5" + "github.com/hashicorp/terraform/plans/objchange" "github.com/hashicorp/terraform/plugin/convert" "github.com/hashicorp/terraform/terraform" ) @@ -283,6 +284,17 @@ func (s *GRPCProviderServer) UpgradeResourceState(_ context.Context, req *proto. return resp, nil } + // Now we need to make sure blocks are represented correctly, which means + // that missing blocks are empty collections, rather than null. + // First we need to CoerceValue to ensure that all object types match. + val, err = schemaBlock.CoerceValue(val) + if err != nil { + resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err) + return resp, nil + } + // Normalize the value and fill in any missing blocks. + val = objchange.NormalizeObjectFromLegacySDK(val, schemaBlock) + // encode the final state to the expected msgpack format newStateMP, err := msgpack.Marshal(val, schemaBlock.ImpliedType()) if err != nil { @@ -479,7 +491,12 @@ func (s *GRPCProviderServer) Configure(_ context.Context, req *proto.Configure_R } func (s *GRPCProviderServer) ReadResource(_ context.Context, req *proto.ReadResource_Request) (*proto.ReadResource_Response, error) { - resp := &proto.ReadResource_Response{} + resp := &proto.ReadResource_Response{ + // helper/schema did previously handle private data during refresh, but + // core is now going to expect this to be maintained in order to + // persist it in the state. + Private: req.Private, + } res := s.provider.ResourcesMap[req.TypeName] schemaBlock := s.getResourceSchemaBlock(req.TypeName) @@ -496,6 +513,15 @@ func (s *GRPCProviderServer) ReadResource(_ context.Context, req *proto.ReadReso return resp, nil } + private := make(map[string]interface{}) + if len(req.Private) > 0 { + if err := json.Unmarshal(req.Private, &private); err != nil { + resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err) + return resp, nil + } + } + instanceState.Meta = private + newInstanceState, err := res.RefreshWithoutUpgrade(instanceState, s.provider.Meta()) if err != nil { resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err) @@ -538,11 +564,6 @@ func (s *GRPCProviderServer) ReadResource(_ context.Context, req *proto.ReadReso Msgpack: newStateMP, } - // helper/schema did previously handle private data during refresh, but - // core is now going to expect this to be maintained in order to - // persist it in the state. - resp.Private = req.Private - return resp, nil } @@ -632,6 +653,7 @@ func (s *GRPCProviderServer) PlanResourceChange(_ context.Context, req *proto.Pl // description that _shows_ there are no changes. This is always the // prior state, because we force a diff above if this is a new instance. resp.PlannedState = req.PriorState + resp.PlannedPrivate = req.PriorPrivate return resp, nil } @@ -692,6 +714,18 @@ func (s *GRPCProviderServer) PlanResourceChange(_ context.Context, req *proto.Pl Msgpack: plannedMP, } + // encode any timeouts into the diff Meta + t := &schema.ResourceTimeout{} + if err := t.ConfigDecode(res, cfg); err != nil { + resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err) + return resp, nil + } + + if err := t.DiffEncode(diff); err != nil { + resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err) + return resp, nil + } + // Now we need to store any NewExtra values, which are where any actual // StateFunc modified config fields are hidden. privateMap := diff.Meta @@ -938,6 +972,9 @@ func (s *GRPCProviderServer) ImportResourceState(_ context.Context, req *proto.I return resp, nil } + // Normalize the value and fill in any missing blocks. + newStateVal = objchange.NormalizeObjectFromLegacySDK(newStateVal, schemaBlock) + newStateMP, err := msgpack.Marshal(newStateVal, schemaBlock.ImpliedType()) if err != nil { resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err) @@ -1169,6 +1206,8 @@ func normalizeNullValues(dst, src cty.Value, apply bool) cty.Value { } } + // check the invariants that we need below, to ensure we are working with + // non-null and known values. if src.IsNull() || !src.IsKnown() || !dst.IsKnown() { return dst } @@ -1287,8 +1326,12 @@ func normalizeNullValues(dst, src cty.Value, apply bool) cty.Value { return cty.ListVal(dsts) } - case ty.IsPrimitiveType(): - if dst.IsNull() && src.IsWhollyKnown() && apply { + case ty == cty.String: + // The legacy SDK should not be able to remove a value during plan or + // apply, however we are only going to overwrite this if the source was + // an empty string, since that is what is often equated with unset and + // lost in the diff process. + if dst.IsNull() && src.AsString() == "" { return src } } @@ -1314,11 +1357,19 @@ func validateConfigNulls(v cty.Value, path cty.Path) []*proto.Diagnostic { for it.Next() { kv, ev := it.Element() if ev.IsNull() { + // if this is a set, the kv is also going to be null which + // isn't a valid path element, so we can't append it to the + // diagnostic. + p := path + if !kv.IsNull() { + p = append(p, cty.IndexStep{Key: kv}) + } + diags = append(diags, &proto.Diagnostic{ Severity: proto.Diagnostic_ERROR, Summary: "Null value found in list", Detail: "Null values are not allowed for this attribute value.", - Attribute: convert.PathToAttributePath(append(path, cty.IndexStep{Key: kv})), + Attribute: convert.PathToAttributePath(p), }) continue } diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_config.go b/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_config.go index 808375ceb7eb..6ad3f13cb96d 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_config.go +++ b/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_config.go @@ -219,6 +219,9 @@ func (r *ConfigFieldReader) readMap(k string, schema *Schema) (FieldReadResult, v, _ := r.Config.Get(key) result[ik] = v } + case nil: + // the map may have been empty on the configuration, so we leave the + // empty result default: panic(fmt.Sprintf("unknown type: %#v", mraw)) } diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_diff.go b/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_diff.go index ae35b4a87619..3e70acf0b0a9 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_diff.go +++ b/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_diff.go @@ -95,7 +95,9 @@ func (r *DiffFieldReader) readMap( return FieldReadResult{}, err } if source.Exists { - result = source.Value.(map[string]interface{}) + // readMap may return a nil value, or an unknown value placeholder in + // some cases, causing the type assertion to panic if we don't assign the ok value + result, _ = source.Value.(map[string]interface{}) resultSet = true } diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/resource.go b/vendor/github.com/hashicorp/terraform/helper/schema/resource.go index b5e306574555..bcfe5666fcca 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/resource.go +++ b/vendor/github.com/hashicorp/terraform/helper/schema/resource.go @@ -329,21 +329,13 @@ func (r *Resource) simpleDiff( c *terraform.ResourceConfig, meta interface{}) (*terraform.InstanceDiff, error) { - t := &ResourceTimeout{} - err := t.ConfigDecode(r, c) - - if err != nil { - return nil, fmt.Errorf("[ERR] Error decoding timeout: %s", err) - } - instanceDiff, err := schemaMap(r.Schema).Diff(s, c, r.CustomizeDiff, meta, false) if err != nil { return instanceDiff, err } if instanceDiff == nil { - log.Printf("[DEBUG] Instance Diff is nil in SimpleDiff()") - return nil, err + instanceDiff = terraform.NewInstanceDiff() } // Make sure the old value is set in each of the instance diffs. @@ -357,10 +349,7 @@ func (r *Resource) simpleDiff( } } - if err := t.DiffEncode(instanceDiff); err != nil { - log.Printf("[ERR] Error encoding timeout to instance diff: %s", err) - } - return instanceDiff, err + return instanceDiff, nil } // Validate validates the resource configuration against the schema. diff --git a/vendor/github.com/hashicorp/terraform/internal/initwd/getter.go b/vendor/github.com/hashicorp/terraform/internal/initwd/getter.go index 50e2572afdac..2f306be73bc8 100644 --- a/vendor/github.com/hashicorp/terraform/internal/initwd/getter.go +++ b/vendor/github.com/hashicorp/terraform/internal/initwd/getter.go @@ -22,6 +22,7 @@ import ( var goGetterDetectors = []getter.Detector{ new(getter.GitHubDetector), new(getter.BitBucketDetector), + new(getter.GCSDetector), new(getter.S3Detector), new(getter.FileDetector), } @@ -46,6 +47,7 @@ var goGetterDecompressors = map[string]getter.Decompressor{ var goGetterGetters = map[string]getter.Getter{ "file": new(getter.FileGetter), + "gcs": new(getter.GCSGetter), "git": new(getter.GitGetter), "hg": new(getter.HgGetter), "s3": new(getter.S3Getter), diff --git a/vendor/github.com/hashicorp/terraform/lang/funcs/collection.go b/vendor/github.com/hashicorp/terraform/lang/funcs/collection.go index ab68a6411972..fd0de9ea5f61 100644 --- a/vendor/github.com/hashicorp/terraform/lang/funcs/collection.go +++ b/vendor/github.com/hashicorp/terraform/lang/funcs/collection.go @@ -689,8 +689,10 @@ var LookupFunc = function.New(&function.Spec{ return cty.StringVal(v.AsString()), nil case ty.Equals(cty.Number): return cty.NumberVal(v.AsBigFloat()), nil + case ty.Equals(cty.Bool): + return cty.BoolVal(v.True()), nil default: - return cty.NilVal, errors.New("lookup() can only be used with flat lists") + return cty.NilVal, errors.New("lookup() can only be used with maps of primitive types") } } } @@ -876,7 +878,6 @@ var MergeFunc = function.New(&function.Spec{ Name: "maps", Type: cty.DynamicPseudoType, AllowDynamicType: true, - AllowNull: true, }, Type: function.StaticReturnType(cty.DynamicPseudoType), Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { diff --git a/vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go b/vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go index 7dfc9058758b..016b102d946b 100644 --- a/vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go +++ b/vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go @@ -237,6 +237,21 @@ var DirnameFunc = function.New(&function.Spec{ }, }) +// AbsPathFunc constructs a function that converts a filesystem path to an absolute path +var AbsPathFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "path", + Type: cty.String, + }, + }, + Type: function.StaticReturnType(cty.String), + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + absPath, err := filepath.Abs(args[0].AsString()) + return cty.StringVal(filepath.ToSlash(absPath)), err + }, +}) + // PathExpandFunc constructs a function that expands a leading ~ character to the current user's home directory. var PathExpandFunc = function.New(&function.Spec{ Params: []function.Parameter{ diff --git a/vendor/github.com/hashicorp/terraform/lang/functions.go b/vendor/github.com/hashicorp/terraform/lang/functions.go index 5cc26d49b567..b77a55fdea21 100644 --- a/vendor/github.com/hashicorp/terraform/lang/functions.go +++ b/vendor/github.com/hashicorp/terraform/lang/functions.go @@ -31,6 +31,7 @@ func (s *Scope) Functions() map[string]function.Function { s.funcs = map[string]function.Function{ "abs": stdlib.AbsoluteFunc, + "abspath": funcs.AbsPathFunc, "basename": funcs.BasenameFunc, "base64decode": funcs.Base64DecodeFunc, "base64encode": funcs.Base64EncodeFunc, diff --git a/vendor/github.com/hashicorp/terraform/plans/objchange/compatible.go b/vendor/github.com/hashicorp/terraform/plans/objchange/compatible.go index 8b7ef43fddfa..8a74c07feddb 100644 --- a/vendor/github.com/hashicorp/terraform/plans/objchange/compatible.go +++ b/vendor/github.com/hashicorp/terraform/plans/objchange/compatible.go @@ -84,7 +84,7 @@ func assertObjectCompatible(schema *configschema.Block, planned, actual cty.Valu // whether there are dynamically-typed attributes inside. However, // both support a similar-enough API that we can treat them the // same for our purposes here. - if !plannedV.IsKnown() || plannedV.IsNull() || actualV.IsNull() { + if !plannedV.IsKnown() || !actualV.IsKnown() || plannedV.IsNull() || actualV.IsNull() { continue } diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go b/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go index 3ac23b709fae..20af9593cde5 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go +++ b/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go @@ -4,7 +4,6 @@ import ( "bytes" "fmt" "log" - "reflect" "strings" "github.com/hashicorp/hcl2/hcl" @@ -532,7 +531,7 @@ func processIgnoreChangesIndividual(prior, proposed cty.Value, ignoreChanges []h // away any deeper values we already produced at that point. var ignoreTraversal hcl.Traversal for i, candidate := range ignoreChangesPath { - if reflect.DeepEqual(path, candidate) { + if path.Equals(candidate) { ignoreTraversal = ignoreChanges[i] } } diff --git a/vendor/github.com/hashicorp/terraform/terraform/evaluate.go b/vendor/github.com/hashicorp/terraform/terraform/evaluate.go index ab65d475b1e7..11a0dac8a8fe 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/evaluate.go +++ b/vendor/github.com/hashicorp/terraform/terraform/evaluate.go @@ -696,7 +696,7 @@ func (d *evaluationStateData) getResourceInstancesAll(addr addrs.Resource, rng t ty := schema.ImpliedType() key := addrs.IntKey(i) is, exists := rs.Instances[key] - if exists { + if exists && is.Current != nil { instAddr := addr.Instance(key).Absolute(d.ModulePath) // Prefer pending value in plan if present. See getResourceInstanceSingle diff --git a/vendor/github.com/hashicorp/terraform/version/version.go b/vendor/github.com/hashicorp/terraform/version/version.go index 4826ba1d5d31..7df02bd2768b 100644 --- a/vendor/github.com/hashicorp/terraform/version/version.go +++ b/vendor/github.com/hashicorp/terraform/version/version.go @@ -11,7 +11,7 @@ import ( ) // The main version number that is being run at the moment. -var Version = "0.12.2" +var Version = "0.12.4" // A pre-release marker for the version. If this is "" (empty string) // then it means that it is a final release. Otherwise, this is a pre-release diff --git a/vendor/github.com/zclconf/go-cty/cty/path.go b/vendor/github.com/zclconf/go-cty/cty/path.go index bf1a7c15aa01..b31444954d3a 100644 --- a/vendor/github.com/zclconf/go-cty/cty/path.go +++ b/vendor/github.com/zclconf/go-cty/cty/path.go @@ -71,6 +71,48 @@ func (p Path) GetAttr(name string) Path { return ret } +// Equals compares 2 Paths for exact equality. +func (p Path) Equals(other Path) bool { + if len(p) != len(other) { + return false + } + + for i := range p { + pv := p[i] + switch pv := pv.(type) { + case GetAttrStep: + ov, ok := other[i].(GetAttrStep) + if !ok || pv != ov { + return false + } + case IndexStep: + ov, ok := other[i].(IndexStep) + if !ok { + return false + } + + if !pv.Key.RawEquals(ov.Key) { + return false + } + default: + // Any invalid steps default to evaluating false. + return false + } + } + + return true + +} + +// HasPrefix determines if the path p contains the provided prefix. +func (p Path) HasPrefix(prefix Path) bool { + if len(prefix) > len(p) { + return false + } + + return p[:len(prefix)].Equals(prefix) +} + // GetAttrPath is a convenience method to start a new Path with a GetAttrStep. func GetAttrPath(name string) Path { return Path{}.GetAttr(name) diff --git a/vendor/modules.txt b/vendor/modules.txt index 0cffc4288c7d..406b618975da 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -382,7 +382,7 @@ github.com/hashicorp/aws-sdk-go-base github.com/hashicorp/errwrap # github.com/hashicorp/go-cleanhttp v0.5.1 github.com/hashicorp/go-cleanhttp -# github.com/hashicorp/go-getter v1.3.0 +# github.com/hashicorp/go-getter v1.3.1-0.20190627223108-da0323b9545e github.com/hashicorp/go-getter github.com/hashicorp/go-getter/helper/url # github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f @@ -409,7 +409,7 @@ github.com/hashicorp/hcl/hcl/scanner github.com/hashicorp/hcl/hcl/strconv github.com/hashicorp/hcl/json/scanner github.com/hashicorp/hcl/json/token -# github.com/hashicorp/hcl2 v0.0.0-20190515223218-4b22149b7cef +# github.com/hashicorp/hcl2 v0.0.0-20190702185634-5b39d9ff3a9a github.com/hashicorp/hcl2/hcl github.com/hashicorp/hcl2/hcl/hclsyntax github.com/hashicorp/hcl2/hcldec @@ -427,7 +427,7 @@ github.com/hashicorp/hil/parser github.com/hashicorp/hil/scanner # github.com/hashicorp/logutils v1.0.0 github.com/hashicorp/logutils -# github.com/hashicorp/terraform v0.12.2 +# github.com/hashicorp/terraform v0.12.4 github.com/hashicorp/terraform/plugin github.com/hashicorp/terraform/flatmap github.com/hashicorp/terraform/helper/customdiff @@ -594,7 +594,7 @@ github.com/ulikunitz/xz/internal/hash # github.com/vmihailenco/msgpack v4.0.1+incompatible github.com/vmihailenco/msgpack github.com/vmihailenco/msgpack/codes -# github.com/zclconf/go-cty v0.0.0-20190516203816-4fecf87372ec +# github.com/zclconf/go-cty v1.0.1-0.20190708163926-19588f92a98f github.com/zclconf/go-cty/cty github.com/zclconf/go-cty/cty/msgpack github.com/zclconf/go-cty/cty/convert From 4c2161511ab14393c69fdefd824cbac40e4b4afa Mon Sep 17 00:00:00 2001 From: kterada0509 Date: Sat, 13 Jul 2019 14:40:34 +0900 Subject: [PATCH 0212/1054] add missing test case --- ...urce_aws_ssm_maintenance_window_task_test.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/aws/resource_aws_ssm_maintenance_window_task_test.go b/aws/resource_aws_ssm_maintenance_window_task_test.go index af6a16d2b582..0666ad621e17 100644 --- a/aws/resource_aws_ssm_maintenance_window_task_test.go +++ b/aws/resource_aws_ssm_maintenance_window_task_test.go @@ -29,11 +29,14 @@ func TestAccAWSSSMMaintenanceWindowTask_basic(t *testing.T) { ), }, { - Config: testAccAWSSSMMaintenanceWindowTaskBasicConfigUpdate(name, "RUN_COMMAND", "AWS-InstallPowerShellModule", 3, 2), + Config: testAccAWSSSMMaintenanceWindowTaskBasicConfigUpdate(name, "test description", "RUN_COMMAND", "AWS-InstallPowerShellModule", 3, 3, 2), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSSMMaintenanceWindowTaskExists(resourceName, &after), + resource.TestCheckResourceAttr(resourceName, "name", fmt.Sprintf("maintenance-window-task-%s", name)), + resource.TestCheckResourceAttr(resourceName, "description", "test description"), resource.TestCheckResourceAttr(resourceName, "task_type", "RUN_COMMAND"), resource.TestCheckResourceAttr(resourceName, "task_arn", "AWS-InstallPowerShellModule"), + resource.TestCheckResourceAttr(resourceName, "priority", "3"), resource.TestCheckResourceAttr(resourceName, "max_concurrency", "3"), resource.TestCheckResourceAttr(resourceName, "max_errors", "2"), testAccCheckAwsSsmWindowsTaskNotRecreated(t, &before, &after), @@ -382,7 +385,7 @@ EOF `, rName) } -func testAccAWSSSMMaintenanceWindowTaskBasicConfigUpdate(rName, taskType, taskArn string, maxConcurrency, maxErrors int) string { +func testAccAWSSSMMaintenanceWindowTaskBasicConfigUpdate(rName, description, taskType, taskArn string, priority, maxConcurrency, maxErrors int) string { return fmt.Sprintf(` resource "aws_ssm_maintenance_window" "foo" { name = "maintenance-window-%[1]s" @@ -395,10 +398,12 @@ resource "aws_ssm_maintenance_window_task" "target" { window_id = "${aws_ssm_maintenance_window.foo.id}" task_type = "%[2]s" task_arn = "%[3]s" - priority = 1 + name = "maintenance-window-task-%[1]s" + description = "%[4]s" + priority = %[5]d service_role_arn = "${aws_iam_role.ssm_role_update.arn}" - max_concurrency = %[4]d - max_errors = %[5]d + max_concurrency = %[6]d + max_errors = %[7]d targets { key = "InstanceIds" @@ -452,7 +457,7 @@ resource "aws_iam_role_policy" "bar" { } EOF } -`, rName, taskType, taskArn, maxConcurrency, maxErrors) +`, rName, taskType, taskArn, description, priority, maxConcurrency, maxErrors) } func testAccAWSSSMMaintenanceWindowTaskBasicConfigUpdated(rName string) string { From ef4bf15ce230705b7263df7d1ac2f9cf83b5d4b4 Mon Sep 17 00:00:00 2001 From: kterada0509 Date: Sat, 13 Jul 2019 14:41:58 +0900 Subject: [PATCH 0213/1054] add missing ConflictsWith setting --- aws/resource_aws_ssm_maintenance_window_task.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/aws/resource_aws_ssm_maintenance_window_task.go b/aws/resource_aws_ssm_maintenance_window_task.go index fa359f5ae30e..60fbf10f90a7 100644 --- a/aws/resource_aws_ssm_maintenance_window_task.go +++ b/aws/resource_aws_ssm_maintenance_window_task.go @@ -93,10 +93,11 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { }, "logging_info": { - Type: schema.TypeList, - MaxItems: 1, - Optional: true, - Deprecated: "use 'task_invocation_parameters' argument instead", + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + ConflictsWith: []string{"task_invocation_parameters"}, + Deprecated: "use 'task_invocation_parameters' argument instead", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "s3_bucket_name": { @@ -116,9 +117,10 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { }, "task_parameters": { - Type: schema.TypeList, - Optional: true, - Deprecated: "use 'task_invocation_parameters' argument instead", + Type: schema.TypeList, + Optional: true, + ConflictsWith: []string{"task_invocation_parameters"}, + Deprecated: "use 'task_invocation_parameters' argument instead", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { From fc858efc2817498476d2f13fcc1fa162e1c0ff52 Mon Sep 17 00:00:00 2001 From: kterada0509 Date: Sat, 13 Jul 2019 14:44:00 +0900 Subject: [PATCH 0214/1054] add missing MaxItems setting --- aws/resource_aws_ssm_maintenance_window_task.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aws/resource_aws_ssm_maintenance_window_task.go b/aws/resource_aws_ssm_maintenance_window_task.go index 60fbf10f90a7..d7de3511bab5 100644 --- a/aws/resource_aws_ssm_maintenance_window_task.go +++ b/aws/resource_aws_ssm_maintenance_window_task.go @@ -146,6 +146,7 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { "automation_parameters": { Type: schema.TypeList, Optional: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "document_version": { @@ -177,6 +178,7 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { "lambda_parameters": { Type: schema.TypeList, Optional: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "client_context": { @@ -204,6 +206,7 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { "run_command_parameters": { Type: schema.TypeList, Optional: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "comment": { @@ -298,6 +301,7 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { "step_functions_parameters": { Type: schema.TypeList, Optional: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "input": { From b80e4e3a4f009bb5c4257cfa3b1badd8459dc00a Mon Sep 17 00:00:00 2001 From: kterada0509 Date: Sat, 13 Jul 2019 14:44:33 +0900 Subject: [PATCH 0215/1054] add cnil check to prevent potential panics --- aws/resource_aws_ssm_maintenance_window_task.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aws/resource_aws_ssm_maintenance_window_task.go b/aws/resource_aws_ssm_maintenance_window_task.go index d7de3511bab5..f37450bf87db 100644 --- a/aws/resource_aws_ssm_maintenance_window_task.go +++ b/aws/resource_aws_ssm_maintenance_window_task.go @@ -383,16 +383,16 @@ func expandAwsSsmTaskInvocationParameters(config []interface{}) *ssm.Maintenance params := &ssm.MaintenanceWindowTaskInvocationParameters{} for _, v := range config { paramConfig := v.(map[string]interface{}) - if attr, ok := paramConfig["automation_parameters"]; ok && len(attr.([]interface{})) > 0 { + if attr, ok := paramConfig["automation_parameters"]; ok && len(attr.([]interface{})) > 0 && attr.([]interface{})[0] != nil { params.Automation = expandAwsSsmTaskInvocationAutomationParameters(attr.([]interface{})) } - if attr, ok := paramConfig["lambda_parameters"]; ok && len(attr.([]interface{})) > 0 { + if attr, ok := paramConfig["lambda_parameters"]; ok && len(attr.([]interface{})) > 0 && attr.([]interface{})[0] != nil { params.Lambda = expandAwsSsmTaskInvocationLambdaParameters(attr.([]interface{})) } - if attr, ok := paramConfig["run_command_parameters"]; ok && len(attr.([]interface{})) > 0 { + if attr, ok := paramConfig["run_command_parameters"]; ok && len(attr.([]interface{})) > 0 && attr.([]interface{})[0] != nil { params.RunCommand = expandAwsSsmTaskInvocationRunCommandParameters(attr.([]interface{})) } - if attr, ok := paramConfig["step_functions_parameters"]; ok && len(attr.([]interface{})) > 0 { + if attr, ok := paramConfig["step_functions_parameters"]; ok && len(attr.([]interface{})) > 0 && attr.([]interface{})[0] != nil { params.StepFunctions = expandAwsSsmTaskInvocationStepFunctionsParameters(attr.([]interface{})) } } From 458aba1ad2bdad8492052084b1009492ede1fea7 Mon Sep 17 00:00:00 2001 From: kterada0509 Date: Sun, 14 Jul 2019 16:58:57 +0900 Subject: [PATCH 0216/1054] fix parameter scheme type to TypeSet fix attribute name parameters -> parameter --- ...esource_aws_ssm_maintenance_window_task.go | 28 ++++++++++--------- ...ce_aws_ssm_maintenance_window_task_test.go | 12 ++++---- .../ssm_maintenance_window_task.html.markdown | 6 ++-- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/aws/resource_aws_ssm_maintenance_window_task.go b/aws/resource_aws_ssm_maintenance_window_task.go index f37450bf87db..34513f900e61 100644 --- a/aws/resource_aws_ssm_maintenance_window_task.go +++ b/aws/resource_aws_ssm_maintenance_window_task.go @@ -154,8 +154,8 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { Optional: true, ValidateFunc: validation.StringMatch(regexp.MustCompile("([$]LATEST|[$]DEFAULT|^[1-9][0-9]*$)"), "see https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_MaintenanceWindowAutomationParameters.html"), }, - "parameters": { - Type: schema.TypeList, + "parameter": { + Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -163,6 +163,7 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { Type: schema.TypeString, Required: true, }, + "values": { Type: schema.TypeList, Required: true, @@ -267,8 +268,8 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { Optional: true, }, - "parameters": { - Type: schema.TypeList, + "parameter": { + Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -276,6 +277,7 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { Type: schema.TypeString, Required: true, }, + "values": { Type: schema.TypeList, Required: true, @@ -426,8 +428,8 @@ func expandAwsSsmTaskInvocationAutomationParameters(config []interface{}) *ssm.M if attr, ok := configParam["document_version"]; ok && len(attr.(string)) != 0 { params.DocumentVersion = aws.String(attr.(string)) } - if attr, ok := configParam["parameters"]; ok && len(attr.([]interface{})) > 0 { - params.Parameters = expandAwsSsmTaskInvocationCommonParameters(attr.([]interface{})) + if attr, ok := configParam["parameter"]; ok && len(attr.(*schema.Set).List()) > 0 { + params.Parameters = expandAwsSsmTaskInvocationCommonParameters(attr.(*schema.Set).List()) } return params @@ -440,7 +442,7 @@ func flattenAwsSsmTaskInvocationAutomationParameters(parameters *ssm.Maintenance result["document_version"] = aws.StringValue(parameters.DocumentVersion) } if parameters.Parameters != nil { - result["parameters"] = flattenAwsSsmTaskInvocationCommonParameters(parameters.Parameters) + result["parameter"] = flattenAwsSsmTaskInvocationCommonParameters(parameters.Parameters) } return []interface{}{result} @@ -497,8 +499,8 @@ func expandAwsSsmTaskInvocationRunCommandParameters(config []interface{}) *ssm.M if attr, ok := configParam["output_s3_key_prefix"]; ok && len(attr.(string)) != 0 { params.OutputS3KeyPrefix = aws.String(attr.(string)) } - if attr, ok := configParam["parameters"]; ok && len(attr.([]interface{})) > 0 { - params.Parameters = expandAwsSsmTaskInvocationCommonParameters(attr.([]interface{})) + if attr, ok := configParam["parameter"]; ok && len(attr.(*schema.Set).List()) > 0 { + params.Parameters = expandAwsSsmTaskInvocationCommonParameters(attr.(*schema.Set).List()) } if attr, ok := configParam["service_role_arn"]; ok && len(attr.(string)) != 0 { params.ServiceRoleArn = aws.String(attr.(string)) @@ -531,7 +533,7 @@ func flattenAwsSsmTaskInvocationRunCommandParameters(parameters *ssm.Maintenance result["output_s3_key_prefix"] = aws.StringValue(parameters.OutputS3KeyPrefix) } if parameters.Parameters != nil { - result["parameters"] = flattenAwsSsmTaskInvocationCommonParameters(parameters.Parameters) + result["parameter"] = flattenAwsSsmTaskInvocationCommonParameters(parameters.Parameters) } if parameters.ServiceRoleArn != nil { result["service_role_arn"] = aws.StringValue(parameters.ServiceRoleArn) @@ -614,7 +616,7 @@ func expandAwsSsmTaskInvocationCommonParameters(config []interface{}) map[string } func flattenAwsSsmTaskInvocationCommonParameters(parameters map[string][]*string) []interface{} { - result := make([]interface{}, 0, len(parameters)) + attributes := make([]interface{}, 0, len(parameters)) keys := make([]string, 0, len(parameters)) for k := range parameters { @@ -631,10 +633,10 @@ func flattenAwsSsmTaskInvocationCommonParameters(parameters map[string][]*string "name": key, "values": values, } - result = append(result, params) + attributes = append(attributes, params) } - return result + return attributes } func resourceAwsSsmMaintenanceWindowTaskCreate(d *schema.ResourceData, meta interface{}) error { diff --git a/aws/resource_aws_ssm_maintenance_window_task_test.go b/aws/resource_aws_ssm_maintenance_window_task_test.go index 0666ad621e17..c3532bc19f2e 100644 --- a/aws/resource_aws_ssm_maintenance_window_task_test.go +++ b/aws/resource_aws_ssm_maintenance_window_task_test.go @@ -559,11 +559,11 @@ resource "aws_ssm_maintenance_window_task" "target" { task_invocation_parameters { automation_parameters { document_version = "%[2]s" - parameters { + parameter { name = "InstanceId" values = ["${aws_instance.foo.id}"] } - parameters { + parameter { name = "NoReboot" values = ["false"] } @@ -646,11 +646,11 @@ resource "aws_ssm_maintenance_window_task" "target" { task_invocation_parameters { automation_parameters { document_version = "%[2]s" - parameters { + parameter { name = "InstanceId" values = ["${aws_instance.foo.id}"] } - parameters { + parameter { name = "NoReboot" values = ["false"] } @@ -823,7 +823,7 @@ resource "aws_ssm_maintenance_window_task" "target" { document_hash_type = "Sha256" service_role_arn = "${aws_iam_role.ssm_role.arn}" timeout_seconds = %[3]d - parameters { + parameter { name = "commands" values = ["date"] } @@ -912,7 +912,7 @@ resource "aws_ssm_maintenance_window_task" "target" { timeout_seconds = %[3]d output_s3_bucket = "${aws_s3_bucket.foo.id}" output_s3_key_prefix = "foo" - parameters { + parameter { name = "commands" values = ["date"] } diff --git a/website/docs/r/ssm_maintenance_window_task.html.markdown b/website/docs/r/ssm_maintenance_window_task.html.markdown index e51e9e872ee9..b5abe9e5c2d6 100644 --- a/website/docs/r/ssm_maintenance_window_task.html.markdown +++ b/website/docs/r/ssm_maintenance_window_task.html.markdown @@ -88,7 +88,7 @@ The following arguments are supported: `automation_parameters` supports the following: * `document_version` - (Optional) The version of an Automation document to use during task execution. -* `parameters` - (Optional) The parameters for the RUN_COMMAND task execution. Documented below. +* `parameter` - (Optional) The parameters for the RUN_COMMAND task execution. Documented below. `lambda_parameters` supports the following: @@ -104,7 +104,7 @@ The following arguments are supported: * `notification_config` - (Optional) Configurations for sending notifications about command status changes on a per-instance basis. Documented below. * `output_s3_bucket` - (Optional) The name of the Amazon S3 bucket. * `output_s3_key_prefix` - (Optional) The Amazon S3 bucket subfolder. -* `parameters` - (Optional) The parameters for the RUN_COMMAND task execution. Documented below. +* `parameter` - (Optional) The parameters for the RUN_COMMAND task execution. Documented below. * `service_role_arn` - (Optional) The IAM service role to assume during task execution. * `timeout_seconds` - (Optional) If this time is reached and the command has not already started executing, it doesn't run. @@ -119,7 +119,7 @@ The following arguments are supported: * `notification_events` - (Optional) The different events for which you can receive notifications. * `notification_type` - (Optional) Command: Receive notification when the status of a command changes. Invocation: For commands sent to multiple instances, receive notification on a per-instance basis when the status of a command changes. -`parameters` supports the following: +`parameter` supports the following: * `name` - (Required) The parameter name. * `values` - (Required) The array of strings. From cdf96a7a42bf9585ee24377ad56f9d280f8044db Mon Sep 17 00:00:00 2001 From: kterada0509 Date: Sun, 14 Jul 2019 18:19:21 +0900 Subject: [PATCH 0217/1054] split icommon settings and put in testAccAWSSSMMaintenanceWindowTaskConfigBase --- ...ce_aws_ssm_maintenance_window_task_test.go | 515 +++--------------- 1 file changed, 86 insertions(+), 429 deletions(-) diff --git a/aws/resource_aws_ssm_maintenance_window_task_test.go b/aws/resource_aws_ssm_maintenance_window_task_test.go index c3532bc19f2e..1197f02a50e2 100644 --- a/aws/resource_aws_ssm_maintenance_window_task_test.go +++ b/aws/resource_aws_ssm_maintenance_window_task_test.go @@ -156,7 +156,7 @@ func TestAccAWSSSMMaintenanceWindowTask_TaskInvocationLambdaParameters(t *testin func TestAccAWSSSMMaintenanceWindowTask_TaskInvocationRunCommandParameters(t *testing.T) { var task ssm.MaintenanceWindowTask resourceName := "aws_ssm_maintenance_window_task.target" - serviceRoleResourceName := "aws_iam_role.ssm_role" + serviceRoleResourceName := "aws_iam_role.test" s3BucketResourceName := "aws_s3_bucket.foo" name := acctest.RandString(10) @@ -312,66 +312,44 @@ func testAccAWSSSMMaintenanceWindowTaskImportStateIdFunc(resourceName string) re } } -func testAccAWSSSMMaintenanceWindowTaskBasicConfig(rName string) string { +func testAccAWSSSMMaintenanceWindowTaskConfigBase(rName string) string { return fmt.Sprintf(` -resource "aws_ssm_maintenance_window" "foo" { - name = "maintenance-window-%[1]s" - schedule = "cron(0 16 ? * TUE *)" - duration = 3 +resource "aws_ssm_maintenance_window" "test" { cutoff = 1 + duration = 3 + name = %[1]q + schedule = "cron(0 16 ? * TUE *)" } -resource "aws_ssm_maintenance_window_task" "target" { - window_id = "${aws_ssm_maintenance_window.foo.id}" - task_type = "RUN_COMMAND" - task_arn = "AWS-RunShellScript" - priority = 1 - service_role_arn = "${aws_iam_role.ssm_role.arn}" - max_concurrency = "2" - max_errors = "1" - - targets { - key = "InstanceIds" - values = ["${aws_instance.foo.id}"] - } - - task_parameters { - name = "commands" - values = ["pwd"] - } -} - -resource "aws_instance" "foo" { +resource "aws_instance" "test" { ami = "ami-4fccb37f" instance_type = "m1.small" } -resource "aws_iam_role" "ssm_role" { - name = "ssm-role-%[1]s" - +resource "aws_iam_role" "test" { + name = %[1]q assume_role_policy = < Date: Mon, 15 Jul 2019 06:14:08 -0400 Subject: [PATCH 0218/1054] docs/resource/aws_emr_cluster: Adjust wording that multi-master only requires public subnets to have public IP on launch Reference: https://github.com/terraform-providers/terraform-provider-aws/pull/9235#pullrequestreview-257932291 --- website/docs/r/emr_cluster.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/r/emr_cluster.html.markdown b/website/docs/r/emr_cluster.html.markdown index c2b6d2143903..d288fffbabfa 100644 --- a/website/docs/r/emr_cluster.html.markdown +++ b/website/docs/r/emr_cluster.html.markdown @@ -184,7 +184,7 @@ Available in EMR version 5.23.0 and later, an EMR Cluster can be launched with t # This configuration is for illustrative purposes and highlights # only relevant configurations for working with this functionality. -# Map public IP on launch must be enabled for the subnet +# Map public IP on launch must be enabled for public (Internet accessible) subnets resource "aws_subnet" "example" { # ... other configuration ... @@ -344,7 +344,7 @@ Supported nested arguments for the `master_instance_group` configuration block: * `instance_type` - (Required) EC2 instance type for all instances in the instance group. * `bid_price` - (Optional) Bid price for each EC2 instance in the instance group, expressed in USD. By setting this attribute, the instance group is being declared as a Spot Instance, and will implicitly create a Spot request. Leave this blank to use On-Demand Instances. * `ebs_config` - (Optional) Configuration block(s) for EBS volumes attached to each instance in the instance group. Detailed below. -* `instance_count` - (Optional) Target number of instances for the instance group. Must be 1 or 3. Defaults to 1. Launching with multiple master nodes is only supported in EMR version 5.23.0+, requires this resource's `core_instance_group` to be configured, and requires the VPC subnets to have map public IP on launch enabled. Termination protection is automatically enabled when launched with multiple master nodes and Terraform must have the `termination_protection = false` configuration applied before destroying this resource. +* `instance_count` - (Optional) Target number of instances for the instance group. Must be 1 or 3. Defaults to 1. Launching with multiple master nodes is only supported in EMR version 5.23.0+, requires this resource's `core_instance_group` to be configured, and requires public (Internet accessible) VPC subnets to have map public IP on launch enabled. Termination protection is automatically enabled when launched with multiple master nodes and Terraform must have the `termination_protection = false` configuration applied before destroying this resource. * `name` - (Optional) Friendly name given to the instance group. ## ebs_config From 431d08aa0e08760843580a4237296d7d547a9263 Mon Sep 17 00:00:00 2001 From: kondo takeshi Date: Sun, 14 Jul 2019 15:44:21 +0900 Subject: [PATCH 0219/1054] Add support for AutoScaling Lifecycle Hook Import --- ...resource_aws_autoscaling_lifecycle_hook.go | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/aws/resource_aws_autoscaling_lifecycle_hook.go b/aws/resource_aws_autoscaling_lifecycle_hook.go index 500924eac481..7508a9d0f251 100644 --- a/aws/resource_aws_autoscaling_lifecycle_hook.go +++ b/aws/resource_aws_autoscaling_lifecycle_hook.go @@ -20,6 +20,10 @@ func resourceAwsAutoscalingLifecycleHook() *schema.Resource { Update: resourceAwsAutoscalingLifecycleHookPut, Delete: resourceAwsAutoscalingLifecycleHookDelete, + Importer: &schema.ResourceImporter{ + State: resourceAwsAutoscalingLifecycleHookImport, + }, + Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, @@ -192,3 +196,19 @@ func getAwsAutoscalingLifecycleHook(d *schema.ResourceData, meta interface{}) (* // lifecycle hook not found return nil, nil } + +func resourceAwsAutoscalingLifecycleHookImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + idParts := strings.SplitN(d.Id(), "/", 2) + if len(idParts) != 2 || idParts[0] == "" || idParts[1] == "" { + return nil, fmt.Errorf("unexpected format (%q), expected /", d.Id()) + } + + asgName := idParts[0] + lifecycleHookName := idParts[1] + + d.Set("name", lifecycleHookName) + d.Set("autoscaling_group_name", asgName) + d.SetId(lifecycleHookName) + + return []*schema.ResourceData{d}, nil +} From 064b7be84644a1111bd7f5348ae9ee6db4b0f2ee Mon Sep 17 00:00:00 2001 From: kondo takeshi Date: Mon, 15 Jul 2019 20:07:35 +0900 Subject: [PATCH 0220/1054] Update document for importing Autoscaling Lifecycle Hook --- website/docs/r/autoscaling_lifecycle_hooks.html.markdown | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/website/docs/r/autoscaling_lifecycle_hooks.html.markdown b/website/docs/r/autoscaling_lifecycle_hooks.html.markdown index 7a3e7b0e1882..9880734906c8 100644 --- a/website/docs/r/autoscaling_lifecycle_hooks.html.markdown +++ b/website/docs/r/autoscaling_lifecycle_hooks.html.markdown @@ -68,3 +68,11 @@ The following arguments are supported: * `notification_metadata` - (Optional) Contains additional information that you want to include any time Auto Scaling sends a message to the notification target. * `notification_target_arn` - (Optional) The ARN of the notification target that Auto Scaling will use to notify you when an instance is in the transition state for the lifecycle hook. This ARN target can be either an SQS queue or an SNS topic. * `role_arn` - (Optional) The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. + +## Import + +AutoScaling Lifecycle Hook can be imported using the role autoscaling_group_name and name separated by `/`. + +``` +$ terraform import aws_aws_autoscaling_lifecycle_hook.test-lifecycle-hook asg-name/lifecycle-hook-name +``` From b656507a7bb50b2ada7a4ed433df9a3b901162c0 Mon Sep 17 00:00:00 2001 From: kondo takeshi Date: Mon, 15 Jul 2019 20:15:29 +0900 Subject: [PATCH 0221/1054] Add test for support Autoscaling Lifecycle Hook Import --- ...ource_aws_autoscaling_lifecycle_hook_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/aws/resource_aws_autoscaling_lifecycle_hook_test.go b/aws/resource_aws_autoscaling_lifecycle_hook_test.go index 4a28cd6a26cd..a6eee055f7d7 100644 --- a/aws/resource_aws_autoscaling_lifecycle_hook_test.go +++ b/aws/resource_aws_autoscaling_lifecycle_hook_test.go @@ -29,6 +29,12 @@ func TestAccAWSAutoscalingLifecycleHook_basic(t *testing.T) { resource.TestCheckResourceAttr("aws_autoscaling_lifecycle_hook.foobar", "lifecycle_transition", "autoscaling:EC2_INSTANCE_LAUNCHING"), ), }, + { + ResourceName: "aws_autoscaling_lifecycle_hook.foobar", + ImportState: true, + ImportStateIdFunc: testAccAWSAutoscalingLifecycleHookImportStateIdFunc("aws_autoscaling_lifecycle_hook.foobar"), + ImportStateVerify: true, + }, }, }) } @@ -107,6 +113,17 @@ func testAccCheckAWSAutoscalingLifecycleHookDestroy(s *terraform.State) error { return nil } +func testAccAWSAutoscalingLifecycleHookImportStateIdFunc(resourceName string) resource.ImportStateIdFunc { + return func(s *terraform.State) (string, error) { + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return "", fmt.Errorf("Not found: %s", resourceName) + } + + return fmt.Sprintf("%s/%s", rs.Primary.Attributes["autoscaling_group_name"], rs.Primary.Attributes["name"]), nil + } +} + func testAccAWSAutoscalingLifecycleHookConfig(name string) string { return fmt.Sprintf(` resource "aws_launch_configuration" "foobar" { From 1f6308541d651f6bacdf7fd5cedbdbe0d5dfed45 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Mon, 15 Jul 2019 07:49:39 -0400 Subject: [PATCH 0222/1054] tests/resource/aws_ec2_transit_gateway: Ensure sweeper has dependency on aws_dx_gateway_association There is also eventual consistency with EC2 Transit Gateway disassociations, which was handled in the resource Delete function and needs to be handed with the sweeper. Previously, the `aws_ec2_transit_gateway` sweeper could fail with: ``` [04:29:17][Step 2/5] 2019/07/15 04:29:17 [ERR] error running (aws_ec2_transit_gateway): error deleting EC2 Transit Gateway (tgw-05cd4e77633d87984): IncorrectState: tgw-05cd4e77633d87984 has non-deleted DirectConnect Gateway Attachments: tgw-attach-00b9e5b1a496eb2f1. ``` Output from sweeper (before EC2 Transit Gateway retries added): ``` $ go test ./aws -v -sweep=us-west-2,us-east-1 -sweep-run=aws_ec2_transit_gateway -timeout 10h 2019/07/15 07:28:21 [DEBUG] Running Sweepers for region (us-west-2): ... 2019/07/15 07:28:26 [INFO] Deleting EC2 Transit Gateway (tgw-05cd4e77633d87984) Direct Connect Gateway Association: c4ec8e1a-2d7e-412d-b972-c5cb57616b40 2019/07/15 07:28:26 [DEBUG] Waiting for state to become: [disassociated deleted] ... 2019/07/15 07:39:19 [INFO] Deleting EC2 Transit Gateway: tgw-05cd4e77633d87984 2019/07/15 07:39:20 [ERR] error running (aws_ec2_transit_gateway): error deleting EC2 Transit Gateway (tgw-05cd4e77633d87984): IncorrectState: tgw-05cd4e77633d87984 has non-deleted DirectConnect Gateway Attachments: tgw-attach-00b9e5b1a496eb2f1. ``` Output from sweeper in AWS Commercial: ``` $ go test ./aws -v -sweep=us-west-2,us-east-1 -sweep-run=aws_ec2_transit_gateway -timeout 10h 2019/07/15 07:46:33 [DEBUG] Running Sweepers for region (us-west-2): ... 2019/07/15 07:46:47 [INFO] Deleting EC2 Transit Gateway: tgw-05cd4e77633d87984 ... 2019/07/15 07:47:50 Sweeper Tests ran: - aws_dx_gateway_association_proposal - aws_dx_gateway_association - aws_ec2_transit_gateway_vpc_attachment - aws_ec2_transit_gateway ``` Output from sweeper in AWS GovCloud (US): ``` $ go test ./aws -v -sweep=us-gov-west-1 -sweep-run=aws_ec2_transit_gateway -timeout 10h 2019/07/15 07:46:33 [DEBUG] Running Sweepers for region (us-gov-west-1): ... 2019/07/15 07:46:44 Sweeper Tests ran: - aws_dx_gateway_association_proposal - aws_dx_gateway_association - aws_ec2_transit_gateway_vpc_attachment - aws_ec2_transit_gateway ``` --- ...esource_aws_dx_gateway_association_test.go | 72 +++++++++++++++++++ aws/resource_aws_ec2_transit_gateway_test.go | 32 ++++++++- 2 files changed, 101 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_dx_gateway_association_test.go b/aws/resource_aws_dx_gateway_association_test.go index d6bbe97e5539..80533d4ad5dd 100644 --- a/aws/resource_aws_dx_gateway_association_test.go +++ b/aws/resource_aws_dx_gateway_association_test.go @@ -8,6 +8,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/directconnect" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" @@ -106,6 +107,77 @@ func testSweepDirectConnectGatewayAssociations(region string) error { gatewayInput.NextToken = gatewayOutput.NextToken } + // Handle cross-account EC2 Transit Gateway associations. + // Direct Connect does not provide an easy lookup method for + // these within the service itself so they can only be found + // via AssociatedGatewayId of the EC2 Transit Gateway since the + // DirectConnectGatewayId lives in the other account. + ec2conn := client.(*AWSClient).ec2conn + + err = ec2conn.DescribeTransitGatewaysPages(&ec2.DescribeTransitGatewaysInput{}, func(page *ec2.DescribeTransitGatewaysOutput, lastPage bool) bool { + if page == nil { + return !lastPage + } + + for _, transitGateway := range page.TransitGateways { + if aws.StringValue(transitGateway.State) == ec2.TransitGatewayStateDeleted { + continue + } + + associationInput := &directconnect.DescribeDirectConnectGatewayAssociationsInput{ + AssociatedGatewayId: transitGateway.TransitGatewayId, + } + transitGatewayID := aws.StringValue(transitGateway.TransitGatewayId) + + associationOutput, err := conn.DescribeDirectConnectGatewayAssociations(associationInput) + + if err != nil { + log.Printf("[ERROR] error retrieving EC2 Transit Gateway (%s) Direct Connect Gateway Associations: %s", transitGatewayID, err) + continue + } + + for _, association := range associationOutput.DirectConnectGatewayAssociations { + associationID := aws.StringValue(association.AssociationId) + + if aws.StringValue(association.AssociationState) != directconnect.GatewayAssociationStateAssociated { + log.Printf("[INFO] Skipping EC2 Transit Gateway (%s) Direct Connect Gateway Association (%s) in non-available state: %s", transitGatewayID, associationID, aws.StringValue(association.AssociationState)) + continue + } + + input := &directconnect.DeleteDirectConnectGatewayAssociationInput{ + AssociationId: association.AssociationId, + } + + log.Printf("[INFO] Deleting EC2 Transit Gateway (%s) Direct Connect Gateway Association: %s", transitGatewayID, associationID) + _, err := conn.DeleteDirectConnectGatewayAssociation(input) + + if isAWSErr(err, directconnect.ErrCodeClientException, "No association exists") { + continue + } + + if err != nil { + log.Printf("[ERROR] error deleting EC2 Transit Gateway (%s) Direct Connect Gateway Association (%s): %s", transitGatewayID, associationID, err) + continue + } + + if err := waitForDirectConnectGatewayAssociationDeletion(conn, associationID, 30*time.Minute); err != nil { + log.Printf("[ERROR] error waiting for EC2 Transit Gateway (%s) Direct Connect Gateway Association (%s) to be deleted: %s", transitGatewayID, associationID, err) + } + } + } + + return !lastPage + }) + + if testSweepSkipSweepError(err) { + log.Printf("[WARN] Skipping EC2 Transit Gateway Direct Connect Gateway Association sweep for %s: %s", region, err) + return nil + } + + if err != nil { + return fmt.Errorf("error retrieving EC2 Transit Gateways: %s", err) + } + return nil } diff --git a/aws/resource_aws_ec2_transit_gateway_test.go b/aws/resource_aws_ec2_transit_gateway_test.go index c10a4e05df0a..23bc9a9d2b09 100644 --- a/aws/resource_aws_ec2_transit_gateway_test.go +++ b/aws/resource_aws_ec2_transit_gateway_test.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "testing" + "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" @@ -17,6 +18,7 @@ func init() { Name: "aws_ec2_transit_gateway", F: testSweepEc2TransitGateways, Dependencies: []string{ + "aws_dx_gateway_association", "aws_ec2_transit_gateway_vpc_attachment", }, }) @@ -54,10 +56,34 @@ func testSweepEc2TransitGateways(region string) error { } log.Printf("[INFO] Deleting EC2 Transit Gateway: %s", id) - _, err := conn.DeleteTransitGateway(input) + err := resource.Retry(2*time.Minute, func() *resource.RetryError { + _, err := conn.DeleteTransitGateway(input) - if isAWSErr(err, "InvalidTransitGatewayID.NotFound", "") { - continue + if isAWSErr(err, "IncorrectState", "has non-deleted Transit Gateway Attachments") { + return resource.RetryableError(err) + } + + if isAWSErr(err, "IncorrectState", "has non-deleted DirectConnect Gateway Attachments") { + return resource.RetryableError(err) + } + + if isAWSErr(err, "IncorrectState", "has non-deleted VPN Attachments") { + return resource.RetryableError(err) + } + + if isAWSErr(err, "InvalidTransitGatewayID.NotFound", "") { + return nil + } + + if err != nil { + return resource.NonRetryableError(err) + } + + return nil + }) + + if isResourceTimeoutError(err) { + _, err = conn.DeleteTransitGateway(input) } if err != nil { From 2fccf7a729774625525146ddbf45be8f7c78fc12 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Mon, 15 Jul 2019 09:34:08 -0400 Subject: [PATCH 0223/1054] docs/provider: Link to new Extending Terraform documentation for adding resource import support in Contributing Guide --- .github/CONTRIBUTING.md | 182 ++-------------------------------------- 1 file changed, 9 insertions(+), 173 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index b71b802005c2..b68efaf377c9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -15,9 +15,9 @@ ability to merge PRs and respond to issues. - [Issues](#issues) - [Issue Reporting Checklists](#issue-reporting-checklists) - - [Bug Reports](#bug-reports) - - [Feature Requests](#feature-requests) - - [Questions](#questions) + - [[Bug Reports](https://github.com/terraform-providers/terraform-provider-aws/issues/new?template=Bug_Report.md)](#bug-reportshttpsgithubcomterraform-providersterraform-provider-awsissuesnewtemplatebug_reportmd) + - [[Feature Requests](https://github.com/terraform-providers/terraform-provider-aws/issues/new?labels=enhancement&template=Feature_Request.md)](#feature-requestshttpsgithubcomterraform-providersterraform-provider-awsissuesnewlabelsenhancementtemplatefeature_requestmd) + - [[Questions](https://github.com/terraform-providers/terraform-provider-aws/issues/new?labels=question&template=Question.md)](#questionshttpsgithubcomterraform-providersterraform-provider-awsissuesnewlabelsquestiontemplatequestionmd) - [Issue Lifecycle](#issue-lifecycle) - [Pull Requests](#pull-requests) - [Pull Request Lifecycle](#pull-request-lifecycle) @@ -202,179 +202,15 @@ guidelines. #### Adding Resource Import Support -Adding import support for Terraform resources will allow existing -infrastructure to be managed within Terraform. This type of enhancement -generally requires a small to moderate amount of code changes. +Adding import support for Terraform resources will allow existing infrastructure to be managed within Terraform. This type of enhancement generally requires a small to moderate amount of code changes. -##### Required Import Support Items +Comprehensive code examples and information about resource import support can be found in the [Extending Terraform documentation](https://www.terraform.io/docs/extend/resources/import.html). -In addition to the below checklist, please see the [Common Review -Items](#common-review-items) sections for more specific coding and testing -guidelines. - -- [ ] _Resource Code Implementation_: In the resource code (e.g. `aws/resource_aws_service_thing.go`), implementation of `Importer` `State` function, e.g. - -```go -func resourceAwsServiceThing() *schema.Resource { - return &schema.Resource{ - /* ... existing Resource functions ... */ - Importer: &schema.ResourceImporter{ - State: /* ... */, - }, - } -} -``` - -- [ ] _Resource Acceptance Testing Implementation_: In the resource acceptance testing (e.g. `aws/resource_aws_service_thing_test.go`), implementation of `TestStep`s with `ImportState: true`, e.g. - -```go -func TestAccAwsServiceThing_basic(t *testing.T) { - /* ... potentially existing acceptance testing logic ... */ - - resource.ParallelTest(t, resource.TestCase{ - /* ... existing TestCase functions ... */ - Steps: []resource.TestStep{ - /* ... existing TestStep ... */ - { - ResourceName: "aws_service_thing.test", - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} -``` - -- [ ] _Resource Documentation Implementation_: In the resource documentation (e.g. `website/docs/r/service_thing.html.markdown`), addition of `Import` documentation section at the bottom of the page, e.g. - -``````markdown -## Import - -Service Thing can be imported using the id, e.g. - -``` -$ terraform import aws_service_thing.example abc123 -``` -`````` - -##### Resource Import Guidelines - -The items below are coding/testing styles that will be noted during submission review and prevent immediate merging: - -- The `TestStep` including `ImportState` testing should not be performed solely in a separate acceptance test. This duplicates testing infrastructure/time and does not check that all resource configurations import into Terraform properly. -- The `TestStep` including `ImportState` should be included in all applicable resource acceptance tests (except those that delete the resource in question, e.g. `_disappears` tests) -- Import implementations should not change existing `Create` function `d.SetId()` calls. [Versioning best practices for Terraform Provider development](https://www.terraform.io/docs/extend/best-practices/versioning.html#example-major-number-increments) notes that changing the resource ID is considered a breaking change for a major version upgrade as it makes the `id` attribute ambiguous between provider versions. -- `ImportStateVerifyIgnore` should only be used where its not possible to `d.Set()` the attribute in the `Read` function (preferable) or `Importer` `State` function. - -##### Additional Information - -###### Importer State Function - -Where possible, prefer using `schema.ImportStatePassthrough` as the `Importer` `State` function: - -```go -func resourceAwsServiceThing() *schema.Resource { - return &schema.Resource{ - /* ... existing Resource functions ... */ - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, - } -} -``` - -This function requires the `Read` function to be able to refresh the entire resource with `d.Id()` _ONLY_. Sometimes it is possible to adjust the resource `Read` function to replace `d.Get()` use with `d.Id()` if they exactly match or add a function that parses the resource ID into the necessary attributes: - -```go -// Illustrative example of parsing a resource ID into two parts to match requirements for Read function -// In this example, the resource ID is a combination of attribute1 and attribute2, separated by a colon (:) character - -func resourceServiceThingExampleThingParseId(id string) (string, string, error) { - parts := strings.SplitN(id, ":", 2) - - if len(parts) != 2 || parts[0] == "" || parts[1] == "" { - return "", "", fmt.Errorf("unexpected format of ID (%s), expected attribute1:attribute2", id) - } - - return parts[0], parts[1], nil -} - -// In the resource Read function: - -attribute1, attribute2, err := resourceServiceThingExampleThingParseId(d.Id()) - -if err != nil { - return err -} -``` - -More likely though, if the resource requires multiple attributes and they are not already in the resource ID, `Importer` `State` will require a custom function implementation beyond using `schema.ImportStatePassthrough`, seen below. The ID passed into `terraform import` should be parsed so `d.Set()` can be called with the required attributes to make the `Read` function operate properly. The resource ID should match the ID set during the resource `Create` function via `d.SetId()`. - -```go -// Illustrative example of parsing the import ID during terraform import -// This should only be used where the resource ID cannot be solely used -// during the resource Read function. -func resourceAwsServiceThing() *schema.Resource { - return &schema.Resource{ - /* ... other Resource functions ... */ - Importer: &schema.ResourceImporter{ - State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - // d.Id() here is the last argument passed to the `terraform import RESOURCE_TYPE.RESOURCE_NAME RESOURCE_ID` command - // Here we use a function to parse the import ID (like the example above) to simplify our logic - attribute1, attribute2, err := resourceServiceThingExampleThingParseId(d.Id()) - - if err != nil { - return err - } - - d.Set("attribute1", attribute1) - d.Set("attribute2", attribute2) - d.SetId(fmt.Sprintf("%s:%s", attribute1, attribute2)) - - return []*schema.ResourceData{d}, nil - }, - }, -``` - -##### ImportStateVerifyIgnore - -Some resource attributes only exist within the context of the Terraform resource or are only used to modify an API request during resource `Create`, `Update`, and `Delete` functions. In these cases, if implementation of the resource cannot obtain the value for the attribute in the `Read` function or its not determined/defaulted to the correct value during the `Importer` `State` function, the acceptance testing may return an error like the following: - -```text ---- FAIL: TestAccAwsServiceThing_namePrefix (18.56s) - testing.go:568: Step 2 error: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected. - - (map[string]string) { - } - - - (map[string]string) (len=1) { - (string) (len=11) "name_prefix": (string) (len=24) "test-7166041588452991103" - } -``` - -To have the import testing ignore this attribute's value being missing during import, the `ImportStateVerifyIgnore` field can be used with the list containing the name(s) of the attributes, e.g. - -```go -func TestAccAwsServiceThing_basic(t *testing.T) { - /* ... potentially existing acceptance testing logic ... */ - - resource.ParallelTest(t, resource.TestCase{ - /* ... existing TestCase functions ... */ - Steps: []resource.TestStep{ - /* ... existing TestStep ... */ - { - ResourceName: "aws_service_thing.test", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"name_prefix"}, - }, - }, - }) -} -``` +In addition to the below checklist and the items noted in the Extending Terraform documentation, please see the [Common Review Items](#common-review-items) sections for more specific coding and testing guidelines. -This should sparingly be used as it means Terraform will require a followup apply to the resource after import or operators must configure `lifecycle` configuration block `ignore_changes` argument (especially for attributes that are `ForceNew`). +- [ ] _Resource Code Implementation_: In the resource code (e.g. `aws/resource_aws_service_thing.go`), implementation of `Importer` `State` function +- [ ] _Resource Acceptance Testing Implementation_: In the resource acceptance testing (e.g. `aws/resource_aws_service_thing_test.go`), implementation of `TestStep`s with `ImportState: true` +- [ ] _Resource Documentation Implementation_: In the resource documentation (e.g. `website/docs/r/service_thing.html.markdown`), addition of `Import` documentation section at the bottom of the page #### New Resource From 03bb255649c9d5a10694e615e4878a176136265a Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Mon, 15 Jul 2019 09:37:46 -0400 Subject: [PATCH 0224/1054] docs/provider: Keep Table of Contents brief --- .github/CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index b68efaf377c9..ed210abdfe51 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -15,9 +15,9 @@ ability to merge PRs and respond to issues. - [Issues](#issues) - [Issue Reporting Checklists](#issue-reporting-checklists) - - [[Bug Reports](https://github.com/terraform-providers/terraform-provider-aws/issues/new?template=Bug_Report.md)](#bug-reportshttpsgithubcomterraform-providersterraform-provider-awsissuesnewtemplatebug_reportmd) - - [[Feature Requests](https://github.com/terraform-providers/terraform-provider-aws/issues/new?labels=enhancement&template=Feature_Request.md)](#feature-requestshttpsgithubcomterraform-providersterraform-provider-awsissuesnewlabelsenhancementtemplatefeature_requestmd) - - [[Questions](https://github.com/terraform-providers/terraform-provider-aws/issues/new?labels=question&template=Question.md)](#questionshttpsgithubcomterraform-providersterraform-provider-awsissuesnewlabelsquestiontemplatequestionmd) + - [Bug Reports](#bug-reports) + - [Feature Requests](#feature-requests) + - [Questions](#questions) - [Issue Lifecycle](#issue-lifecycle) - [Pull Requests](#pull-requests) - [Pull Request Lifecycle](#pull-request-lifecycle) From 2afa58e0cec07c02780acb626d0625d1a8991fc0 Mon Sep 17 00:00:00 2001 From: kondo takeshi Date: Mon, 15 Jul 2019 23:31:37 +0900 Subject: [PATCH 0225/1054] Update compatible node runtime nodejs6.10 was EOL on April 30, 2019 ref: https://aws.amazon.com/blogs/developer/node-js-6-is-approaching-end-of-life-upgrade-your-aws-lambda-functions-to-the-node-js-10-lts/ cmd: git grep nodejs6.10 | cut -d ':' -f1 | xargs sed -i.bak -e 's/nodejs6.10/nodejs8.10/g' --- aws/resource_aws_lambda_function_test.go | 4 ++-- aws/resource_aws_lambda_layer_version_test.go | 2 +- aws/resource_aws_pinpoint_app_test.go | 2 +- vendor/github.com/aws/aws-sdk-go/service/lambda/api.go | 2 +- .../guides/serverless-with-aws-lambda-and-api-gateway.html.md | 4 ++-- website/docs/r/lambda_layer_version.html.markdown | 2 +- website/docs/r/lambda_permission.html.markdown | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/aws/resource_aws_lambda_function_test.go b/aws/resource_aws_lambda_function_test.go index c06677d756a4..22f4acdc518b 100644 --- a/aws/resource_aws_lambda_function_test.go +++ b/aws/resource_aws_lambda_function_test.go @@ -279,7 +279,7 @@ func TestAccAWSLambdaFunction_updateRuntime(t *testing.T) { Config: testAccAWSLambdaConfigBasicUpdateRuntime(funcName, policyName, roleName, sgName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsLambdaFunctionExists("aws_lambda_function.lambda_function_test", funcName, &conf), - resource.TestCheckResourceAttr("aws_lambda_function.lambda_function_test", "runtime", "nodejs6.10"), + resource.TestCheckResourceAttr("aws_lambda_function.lambda_function_test", "runtime", "nodejs8.10"), ), }, }, @@ -1724,7 +1724,7 @@ resource "aws_lambda_function" "lambda_function_test" { function_name = "%s" role = "${aws_iam_role.iam_for_lambda.arn}" handler = "exports.example" - runtime = "nodejs6.10" + runtime = "nodejs8.10" } `, funcName) } diff --git a/aws/resource_aws_lambda_layer_version_test.go b/aws/resource_aws_lambda_layer_version_test.go index 2e81ee0271f4..a9b659e8dfc4 100644 --- a/aws/resource_aws_lambda_layer_version_test.go +++ b/aws/resource_aws_lambda_layer_version_test.go @@ -345,7 +345,7 @@ resource "aws_lambda_layer_version" "lambda_layer_test" { filename = "test-fixtures/lambdatest.zip" layer_name = "%s" - compatible_runtimes = ["nodejs8.10", "nodejs6.10"] + compatible_runtimes = ["nodejs8.10", "nodejs8.10"] } `, layerName) } diff --git a/aws/resource_aws_pinpoint_app_test.go b/aws/resource_aws_pinpoint_app_test.go index f249806ac163..c930cef9a4b3 100644 --- a/aws/resource_aws_pinpoint_app_test.go +++ b/aws/resource_aws_pinpoint_app_test.go @@ -193,7 +193,7 @@ resource "aws_lambda_function" "test" { function_name = "%s" role = "${aws_iam_role.iam_for_lambda.arn}" handler = "lambdapinpoint.handler" - runtime = "nodejs6.10" + runtime = "nodejs8.10" publish = true } diff --git a/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go b/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go index f386b5c3eb14..71c356c660e0 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go @@ -9243,7 +9243,7 @@ const ( RuntimeNodejs43 = "nodejs4.3" // RuntimeNodejs610 is a Runtime enum value - RuntimeNodejs610 = "nodejs6.10" + RuntimeNodejs610 = "nodejs8.10" // RuntimeNodejs810 is a Runtime enum value RuntimeNodejs810 = "nodejs8.10" diff --git a/website/docs/guides/serverless-with-aws-lambda-and-api-gateway.html.md b/website/docs/guides/serverless-with-aws-lambda-and-api-gateway.html.md index f73cdb92c0d8..fb4e163a4612 100644 --- a/website/docs/guides/serverless-with-aws-lambda-and-api-gateway.html.md +++ b/website/docs/guides/serverless-with-aws-lambda-and-api-gateway.html.md @@ -151,7 +151,7 @@ resource "aws_lambda_function" "example" { # is the name of the property under which the handler function was # exported in that file. handler = "main.handler" - runtime = "nodejs6.10" + runtime = "nodejs8.10" role = "${aws_iam_role.lambda_exec.arn}" } @@ -227,7 +227,7 @@ aws_lambda_function.example: Creating... publish: "" => "false" qualified_arn: "" => "" role: "" => "arn:aws:iam::123456:role/serverless_example_lambda" - runtime: "" => "nodejs6.10" + runtime: "" => "nodejs8.10" s3_bucket: "" => "terraform-serverless-example" s3_key: "" => "v1.0.0/example.zip" source_code_hash: "" => "" diff --git a/website/docs/r/lambda_layer_version.html.markdown b/website/docs/r/lambda_layer_version.html.markdown index 7f651ae23dd7..7c2016ec6991 100644 --- a/website/docs/r/lambda_layer_version.html.markdown +++ b/website/docs/r/lambda_layer_version.html.markdown @@ -19,7 +19,7 @@ resource "aws_lambda_layer_version" "lambda_layer" { filename = "lambda_layer_payload.zip" layer_name = "lambda_layer_name" - compatible_runtimes = ["nodejs8.10", "nodejs6.10"] + compatible_runtimes = ["nodejs8.10", "nodejs8.10"] } ``` diff --git a/website/docs/r/lambda_permission.html.markdown b/website/docs/r/lambda_permission.html.markdown index 6417ab3a5297..80970d9cfae7 100644 --- a/website/docs/r/lambda_permission.html.markdown +++ b/website/docs/r/lambda_permission.html.markdown @@ -35,7 +35,7 @@ resource "aws_lambda_function" "test_lambda" { function_name = "lambda_function_name" role = "${aws_iam_role.iam_for_lambda.arn}" handler = "exports.handler" - runtime = "nodejs6.10" + runtime = "nodejs8.10" } resource "aws_iam_role" "iam_for_lambda" { From 3db566bb7cf25497867de0afea4b0aaf3e1db884 Mon Sep 17 00:00:00 2001 From: kondo takeshi Date: Mon, 15 Jul 2019 23:34:03 +0900 Subject: [PATCH 0226/1054] Remove duplicate versions --- aws/resource_aws_lambda_layer_version_test.go | 2 +- website/docs/r/lambda_layer_version.html.markdown | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aws/resource_aws_lambda_layer_version_test.go b/aws/resource_aws_lambda_layer_version_test.go index a9b659e8dfc4..d8c7c40ad238 100644 --- a/aws/resource_aws_lambda_layer_version_test.go +++ b/aws/resource_aws_lambda_layer_version_test.go @@ -345,7 +345,7 @@ resource "aws_lambda_layer_version" "lambda_layer_test" { filename = "test-fixtures/lambdatest.zip" layer_name = "%s" - compatible_runtimes = ["nodejs8.10", "nodejs8.10"] + compatible_runtimes = ["nodejs8.10"] } `, layerName) } diff --git a/website/docs/r/lambda_layer_version.html.markdown b/website/docs/r/lambda_layer_version.html.markdown index 7c2016ec6991..ba2b8986b9c9 100644 --- a/website/docs/r/lambda_layer_version.html.markdown +++ b/website/docs/r/lambda_layer_version.html.markdown @@ -19,7 +19,7 @@ resource "aws_lambda_layer_version" "lambda_layer" { filename = "lambda_layer_payload.zip" layer_name = "lambda_layer_name" - compatible_runtimes = ["nodejs8.10", "nodejs8.10"] + compatible_runtimes = ["nodejs8.10"] } ``` From 7e6d7dbcfc8fd06874fed09bfa3fb0f6c9970f56 Mon Sep 17 00:00:00 2001 From: kondo takeshi Date: Mon, 15 Jul 2019 23:39:30 +0900 Subject: [PATCH 0227/1054] Revert wront fixing --- vendor/github.com/aws/aws-sdk-go/service/lambda/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go b/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go index 71c356c660e0..f386b5c3eb14 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/lambda/api.go @@ -9243,7 +9243,7 @@ const ( RuntimeNodejs43 = "nodejs4.3" // RuntimeNodejs610 is a Runtime enum value - RuntimeNodejs610 = "nodejs8.10" + RuntimeNodejs610 = "nodejs6.10" // RuntimeNodejs810 is a Runtime enum value RuntimeNodejs810 = "nodejs8.10" From 9a4397fb880fb382ca08a9281ca16946fd550d76 Mon Sep 17 00:00:00 2001 From: RichardWLaub Date: Mon, 15 Jul 2019 09:26:12 -0700 Subject: [PATCH 0228/1054] Remove an extra "how to" --- website/docs/r/ec2_transit_gateway_vpc_attachment.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/ec2_transit_gateway_vpc_attachment.html.markdown b/website/docs/r/ec2_transit_gateway_vpc_attachment.html.markdown index 50275c3ef677..3d5d60ac6b6e 100644 --- a/website/docs/r/ec2_transit_gateway_vpc_attachment.html.markdown +++ b/website/docs/r/ec2_transit_gateway_vpc_attachment.html.markdown @@ -20,7 +20,7 @@ resource "aws_ec2_transit_gateway_vpc_attachment" "example" { } ``` -A full example of how to how to create a Transit Gateway in one AWS account, share it with a second AWS account, and attach a VPC in the second account to the Transit Gateway via the `aws_ec2_transit_gateway_vpc_attachment` and `aws_ec2_transit_gateway_vpc_attachment_accepter` resources can be found in [the `./examples/transit-gateway-cross-account-vpc-attachment` directory within the Github Repository](https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples/transit-gateway-cross-account-vpc-attachment). +A full example of how to create a Transit Gateway in one AWS account, share it with a second AWS account, and attach a VPC in the second account to the Transit Gateway via the `aws_ec2_transit_gateway_vpc_attachment` and `aws_ec2_transit_gateway_vpc_attachment_accepter` resources can be found in [the `./examples/transit-gateway-cross-account-vpc-attachment` directory within the Github Repository](https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples/transit-gateway-cross-account-vpc-attachment). ## Argument Reference From a0ca23f910aa77a2e8f4f6d4b16aed8da62fb679 Mon Sep 17 00:00:00 2001 From: Evan Date: Mon, 15 Jul 2019 13:24:54 -0500 Subject: [PATCH 0229/1054] Update security_group.html.markdown --- website/docs/r/security_group.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/security_group.html.markdown b/website/docs/r/security_group.html.markdown index 34233b86d1f5..acca97efb58e 100644 --- a/website/docs/r/security_group.html.markdown +++ b/website/docs/r/security_group.html.markdown @@ -33,7 +33,7 @@ resource "aws_security_group" "allow_tls" { # TLS (change to whatever ports you need) from_port = 443 to_port = 443 - protocol = "-1" + protocol = "tcp" # Please restrict your ingress to only necessary IPs and ports. # Opening to 0.0.0.0/0 can lead to security vulnerabilities. cidr_blocks = # add a CIDR block here From 2dc69f5115af38ef5df0c2b1f017d01da281abe2 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Mon, 15 Jul 2019 15:42:19 -0400 Subject: [PATCH 0230/1054] Apply suggestions from code review Co-Authored-By: Audrey Eschright --- .github/MAINTAINING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/MAINTAINING.md b/.github/MAINTAINING.md index 211b8fcad279..4e834ec5f196 100644 --- a/.github/MAINTAINING.md +++ b/.github/MAINTAINING.md @@ -23,7 +23,7 @@ Notes for each type of pull request are (or will be) available in subsections be - Review the contents of the pull request and ensure the change follows the relevant section of the [Contributing Guide](https://github.com/terraform-providers/terraform-provider-aws/blob/master/.github/CONTRIBUTING.md#checklists-for-contribution) - If the change is not acceptable, leave a long form comment about the reasoning and close the pull request - If the change is acceptable with modifications, leave a pull request review marked using the `Request Changes` option (for maintainer pull requests with minor modification requests, giving feedback with the `Approve` option is recommended so they do not need to wait for another round of review) -- If the author is unresponsive for changes (generally we give two weeks), determine importance and level of effort to finish the pull request yourself including their commits or close the pull request +- If the author is unresponsive for changes (by default we give two weeks), determine importance and level of effort to finish the pull request yourself including their commits or close the pull request - Run relevant acceptance testing (locally or in TeamCity) and ensure no new failures are being introduced - Approve the pull request with a comment outlining what steps you took that ensure the change is acceptable, e.g. acceptance testing output @@ -49,7 +49,7 @@ Output from acceptance testing in AWS GovCloud (US): ##### AWS Go SDK Updates -Almost exclusively, `github.com/aws/aws-sdk-go` updates are additive in nature and it is generally safe to only scan through them before approving and merging. If you have any concerns about any of the service client updates such as suspicous code removals in the update or deprecations introduced, run the acceptance testing for potentially affected resources before merging. +Almost exclusively, `github.com/aws/aws-sdk-go` updates are additive in nature. It is generally safe to only scan through them before approving and merging. If you have any concerns about any of the service client updates such as suspicious code removals in the update, or deprecations introduced, run the acceptance testing for potentially affected resources before merging. Other important notes: From 5db051ddb98089f62642a9dcc6c011acae92156a Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Mon, 15 Jul 2019 15:46:04 -0400 Subject: [PATCH 0231/1054] docs/provider: Link to Contributor Guide for local acceptance testing and note running acceptance testing for AWS Commercial and AWS GovCloud (US) --- .github/MAINTAINING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/MAINTAINING.md b/.github/MAINTAINING.md index 4e834ec5f196..ad2969b6ab0e 100644 --- a/.github/MAINTAINING.md +++ b/.github/MAINTAINING.md @@ -24,7 +24,7 @@ Notes for each type of pull request are (or will be) available in subsections be - If the change is not acceptable, leave a long form comment about the reasoning and close the pull request - If the change is acceptable with modifications, leave a pull request review marked using the `Request Changes` option (for maintainer pull requests with minor modification requests, giving feedback with the `Approve` option is recommended so they do not need to wait for another round of review) - If the author is unresponsive for changes (by default we give two weeks), determine importance and level of effort to finish the pull request yourself including their commits or close the pull request -- Run relevant acceptance testing (locally or in TeamCity) and ensure no new failures are being introduced +- Run relevant acceptance testing ([locally](https://github.com/terraform-providers/terraform-provider-aws/blob/master/.github/CONTRIBUTING.md#running-an-acceptance-test) or in TeamCity) against AWS Commercial and AWS GovCloud (US) to ensure no new failures are being introduced - Approve the pull request with a comment outlining what steps you took that ensure the change is acceptable, e.g. acceptance testing output ``````markdown From 685894f629706f31bb26469936491d636f207314 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Mon, 15 Jul 2019 15:47:47 -0400 Subject: [PATCH 0232/1054] Update .github/MAINTAINING.md Co-Authored-By: Audrey Eschright --- .github/MAINTAINING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/MAINTAINING.md b/.github/MAINTAINING.md index ad2969b6ab0e..8d3420a7dd93 100644 --- a/.github/MAINTAINING.md +++ b/.github/MAINTAINING.md @@ -53,7 +53,7 @@ Almost exclusively, `github.com/aws/aws-sdk-go` updates are additive in nature. Other important notes: -- CloudFront service client updates have previously caused an issue when a new field introduced in the SDK was not included with Terraform and caused all requests to error (https://github.com/terraform-providers/terraform-provider-aws/issues/4091). As a precaution, if you see CloudFront updates, run all the CloudFront resource acceptance testing before merging. +- CloudFront service client updates have previously caused an issue when a new field introduced in the SDK was not included with Terraform and caused all requests to error (https://github.com/terraform-providers/terraform-provider-aws/issues/4091). As a precaution, if you see CloudFront updates, run all the CloudFront resource acceptance testing before merging (`TestAccAWSCloudFront`). - Occassionally, there will be changes listed in the authentication pieces of the AWS Go SDK codebase, e.g. changes to `aws/session`. The AWS Go SDK `CHANGELOG` should include a relevant description of these changes under a heading such as `SDK Enhancements` or `SDK Bug Fixes`. If they seem worthy of a callout in the Terraform AWS Provider `CHANGELOG`, then upon merging we should include a similar message prefixed with the `provider` subsystem, e.g. `* provider: ...`. Additionally, if a `CHANGELOG` addition seemed appropriate, this dependency and version should also be updated in the Terraform S3 Backend, which currently lives in Terraform Core. An example of this can be found with https://github.com/terraform-providers/terraform-provider-aws/pull/9305 and https://github.com/hashicorp/terraform/pull/22055. ##### Terraform Updates From 208ae63bdba089b57b8c50f6aaeda0a732049f6b Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 04:36:40 -0400 Subject: [PATCH 0233/1054] Apply suggestions from code review Co-Authored-By: Audrey Eschright --- .github/MAINTAINING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/MAINTAINING.md b/.github/MAINTAINING.md index 8d3420a7dd93..6dd1777e57db 100644 --- a/.github/MAINTAINING.md +++ b/.github/MAINTAINING.md @@ -66,11 +66,11 @@ Run the full acceptance testing suite against the pull request and verify there - Add any linked issues that will be closed by the pull request to the same upcoming release milestone - Merge the pull request - Delete the branch (if the branch is on this repository) -- Update the repository `CHANGELOG.md`. See also the [Extending Terraform documentation](https://www.terraform.io/docs/extend/best-practices/versioning.html) for more information about the expected CHANGELOG format. +- Update the repository `CHANGELOG.md` by directly committing to the `master` branch. See also the [Extending Terraform documentation](https://www.terraform.io/docs/extend/best-practices/versioning.html) for more information about the expected CHANGELOG format. - Leave a comment on any issues closed by the pull request noting that it has been merged and when to expect the release containing it, e.g. ```markdown -The fix for this has been merged and will release with version X.Y.Z of the Terraform AWS Provider, likely in the XXX timeframe. +The fix for this has been merged and will release with version X.Y.Z of the Terraform AWS Provider, expected in the XXX timeframe. ``` ## Release Process From 7fe92766cb8a2df88290db60d92cff929575292b Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 04:40:58 -0400 Subject: [PATCH 0234/1054] docs/provider: Minor wording updates in Maintaining Guide Reference: https://github.com/terraform-providers/terraform-provider-aws/pull/9332 --- .github/MAINTAINING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/MAINTAINING.md b/.github/MAINTAINING.md index 6dd1777e57db..4fbbbdb105f3 100644 --- a/.github/MAINTAINING.md +++ b/.github/MAINTAINING.md @@ -18,7 +18,7 @@ Notes for each type of pull request are (or will be) available in subsections below. -- If you are planning on owning the pull request through merge/closure, assign it to yourself +- If you plan to be responsible for the pull request through the merge/closure process, assign it to yourself - Add `bug`, `enhancement`, `new-data-source`, `new-resource`, or `technical-debt` labels to match expectations from change - Review the contents of the pull request and ensure the change follows the relevant section of the [Contributing Guide](https://github.com/terraform-providers/terraform-provider-aws/blob/master/.github/CONTRIBUTING.md#checklists-for-contribution) - If the change is not acceptable, leave a long form comment about the reasoning and close the pull request @@ -75,10 +75,10 @@ The fix for this has been merged and will release with version X.Y.Z of the Terr ## Release Process -- Ensure a milestone exists for the next release after this release (Generally, the next milestone will be a minor version increase unless previously decided for a major or patch version) -- Check the upcoming release milestone for open items and either work through them or move them to the next milestone +- Create a milestone for the next release after this release (generally, the next milestone will be a minor version increase unless previously decided for a major or patch version) +- Check the existing release milestone for open items and either work through them or move them to the next milestone - Run the HashiCorp (non-OSS) TeamCity release job with the `DEPLOYMENT_TARGET_VERSION` matching the expected release milestone and `DEPLOYMENT_NEXT_VERSION` matching the next release milestone -- Wait for the TeamCity release job and TeamCity website deployment jobs to complete +- Wait for the TeamCity release job and TeamCity website deployment jobs to complete either by watching the build logs or Slack notifications - For each item noted in the `CHANGELOG.md` for the release just completed (or milestone as a whole), add a comment to the pull request and any linked closed issues noting that it has been released, e.g. ```markdown From d14fe54af23cb3ecbee40c33ff8151a1b99771d5 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 05:21:23 -0400 Subject: [PATCH 0235/1054] docs/provider: Clarify Resource Naming guidelines in Contributing Guide --- .github/CONTRIBUTING.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index ed210abdfe51..8f406661ca73 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -229,9 +229,22 @@ guidelines. covering their behavior. See [Writing Acceptance Tests](#writing-acceptance-tests) below for a detailed guide on how to approach these. - - [ ] __Naming__: Resources should be named `aws__` where - `service` is the AWS short service name and `name` is a short, preferably - single word, description of the resource. Use `_` as a separator. + - [ ] __Resource Naming__: Resources should be named `aws__`, + using underscores (`_`) as the separator. Resources are namespaced with the + service name to allow easier searching of related resources, to align + the resource naming with the service for [Customizing Endpoints](https://www.terraform.io/docs/providers/aws/guides/custom-service-endpoints.html#available-endpoint-customizations), + and to prevent future conflicts with new AWS services/resources. + For reference: + + - `service` is the AWS short service name that matches the entry in + `endpointServiceNames` (created via the [New Service](#new-service) + section) + - `name` represents the conceptual infrastructure represented by the + create, read, update, and delete methods of the service API. For example, + in an API that has methods such as `CreateThing`, `DeleteThing`, + `DescribeThing`, and `ModifyThing` the name of the resource would end in + `_thing`. + - [ ] __Arguments_and_Attributes__: The HCL for arguments and attributes should mimic the types and structs presented by the AWS API. API arguments should be converted from `CamelCase` to `camel_case`. From 03b4382dcc378a5a2a4639ffd95ae30e3f48a7f0 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 05:35:48 -0400 Subject: [PATCH 0236/1054] docs/provider: Note that resource names should be singular nouns in Contributing Guide --- .github/CONTRIBUTING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8f406661ca73..e28d95921cdb 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -240,10 +240,10 @@ guidelines. `endpointServiceNames` (created via the [New Service](#new-service) section) - `name` represents the conceptual infrastructure represented by the - create, read, update, and delete methods of the service API. For example, - in an API that has methods such as `CreateThing`, `DeleteThing`, - `DescribeThing`, and `ModifyThing` the name of the resource would end in - `_thing`. + create, read, update, and delete methods of the service API. It should + be a singular noun. For example, in an API that has methods such as + `CreateThing`, `DeleteThing`, `DescribeThing`, and `ModifyThing` the name + of the resource would end in `_thing`. - [ ] __Arguments_and_Attributes__: The HCL for arguments and attributes should mimic the types and structs presented by the AWS API. API arguments should be From 00ef2ba1cd8dd3905374359d8ebad7bb8be64a28 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 08:50:05 -0400 Subject: [PATCH 0237/1054] tests/resource/aws_elb: Switch test configurations to data sources to be region agnostic While this gets the acceptance testing working in GovCloud (US), it does now also highlight a bug similar to https://github.com/terraform-providers/terraform-provider-aws/issues/9304 Output from acceptance testing in AWS Commerical: ``` --- PASS: TestAccAWSELB_disappears (68.68s) --- PASS: TestAccAWSELB_ConnectionDraining (76.74s) --- PASS: TestAccAWSELB_namePrefix (93.59s) --- PASS: TestAccAWSELB_AccessLogs_enabled (103.17s) --- PASS: TestAccAWSELB_generatedName (106.01s) --- PASS: TestAccAWSELB_fullCharacterRange (106.48s) --- PASS: TestAccAWSELB_importBasic (112.57s) --- PASS: TestAccAWSELB_generatesNameForZeroValue (122.21s) --- PASS: TestAccAWSELB_basic (130.19s) --- PASS: TestAccAWSELB_HealthCheck (133.04s) --- PASS: TestAccAWSELB_Listener_SSLCertificateID_IAMServerCertificate (136.34s) --- PASS: TestAccAWSELB_SecurityGroups (142.99s) --- FAIL: TestAccAWSELB_listener (148.51s) testing.go:568: Step 4 error: errors during plan: Error: insufficient items for attribute "listener"; must have at least 1 testing.go:629: Error destroying resource! WARNING: Dangling resources may exist. The full state and error is shown below. Error: errors during refresh: insufficient items for attribute "listener"; must have at least 1 State: --- PASS: TestAccAWSELB_AccessLogs_disabled (154.64s) --- PASS: TestAccAWSELB_tags (155.92s) --- PASS: TestAccAWSELB_Timeout (168.71s) --- PASS: TestAccAWSELB_availabilityZones (210.40s) --- PASS: TestAccAWSELB_swap_subnets (228.13s) --- PASS: TestAccAWSELB_InstanceAttaching (527.69s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSELB_availabilityZones (88.33s) --- PASS: TestAccAWSELB_tags (113.93s) --- PASS: TestAccAWSELB_Timeout (115.69s) --- PASS: TestAccAWSELB_importBasic (123.79s) --- PASS: TestAccAWSELB_swap_subnets (124.01s) --- PASS: TestAccAWSELB_Listener_SSLCertificateID_IAMServerCertificate (147.94s) --- PASS: TestAccAWSELB_HealthCheck (149.88s) --- PASS: TestAccAWSELB_SecurityGroups (154.84s) --- PASS: TestAccAWSELB_disappears (200.13s) --- PASS: TestAccAWSELB_namePrefix (200.70s) --- PASS: TestAccAWSELB_fullCharacterRange (213.47s) --- PASS: TestAccAWSELB_generatesNameForZeroValue (214.22s) --- PASS: TestAccAWSELB_generatedName (229.05s) --- PASS: TestAccAWSELB_ConnectionDraining (230.66s) --- PASS: TestAccAWSELB_basic (240.03s) --- FAIL: TestAccAWSELB_listener (268.22s) testing.go:568: Step 4 error: errors during plan: Error: insufficient items for attribute "listener"; must have at least 1 testing.go:629: Error destroying resource! WARNING: Dangling resources may exist. The full state and error is shown below. Error: errors during refresh: insufficient items for attribute "listener"; must have at least 1 State: --- PASS: TestAccAWSELB_AccessLogs_enabled (275.48s) --- PASS: TestAccAWSELB_AccessLogs_disabled (298.22s) --- PASS: TestAccAWSELB_InstanceAttaching (306.86s) ``` --- aws/resource_aws_elb_test.go | 229 +++++++++++++++++++++++------------ 1 file changed, 149 insertions(+), 80 deletions(-) diff --git a/aws/resource_aws_elb_test.go b/aws/resource_aws_elb_test.go index 2a501c1ea6b7..e81207f842ee 100644 --- a/aws/resource_aws_elb_test.go +++ b/aws/resource_aws_elb_test.go @@ -6,7 +6,6 @@ import ( "math/rand" "reflect" "regexp" - "sort" "testing" "time" @@ -103,15 +102,8 @@ func TestAccAWSELB_basic(t *testing.T) { resource.TestCheckResourceAttrSet("aws_elb.bar", "arn"), resource.TestCheckResourceAttr( "aws_elb.bar", "availability_zones.#", "3"), - resource.TestCheckResourceAttr( - "aws_elb.bar", "availability_zones.2487133097", "us-west-2a"), - resource.TestCheckResourceAttr( - "aws_elb.bar", "availability_zones.221770259", "us-west-2b"), - resource.TestCheckResourceAttr( - "aws_elb.bar", "availability_zones.2050015877", "us-west-2c"), resource.TestCheckResourceAttr( "aws_elb.bar", "subnets.#", "3"), - // NOTE: Subnet IDs are different across AWS accounts and cannot be checked. resource.TestCheckResourceAttr( "aws_elb.bar", "listener.206423021.instance_port", "8000"), resource.TestCheckResourceAttr( @@ -343,12 +335,6 @@ func TestAccAWSELB_availabilityZones(t *testing.T) { testAccCheckAWSELBExists("aws_elb.bar", &conf), resource.TestCheckResourceAttr( "aws_elb.bar", "availability_zones.#", "3"), - resource.TestCheckResourceAttr( - "aws_elb.bar", "availability_zones.2487133097", "us-west-2a"), - resource.TestCheckResourceAttr( - "aws_elb.bar", "availability_zones.221770259", "us-west-2b"), - resource.TestCheckResourceAttr( - "aws_elb.bar", "availability_zones.2050015877", "us-west-2c"), ), }, @@ -358,10 +344,6 @@ func TestAccAWSELB_availabilityZones(t *testing.T) { testAccCheckAWSELBExists("aws_elb.bar", &conf), resource.TestCheckResourceAttr( "aws_elb.bar", "availability_zones.#", "2"), - resource.TestCheckResourceAttr( - "aws_elb.bar", "availability_zones.2487133097", "us-west-2a"), - resource.TestCheckResourceAttr( - "aws_elb.bar", "availability_zones.221770259", "us-west-2b"), ), }, }, @@ -1086,16 +1068,6 @@ func testAccCheckAWSELBDisappears(loadBalancer *elb.LoadBalancerDescription) res func testAccCheckAWSELBAttributes(conf *elb.LoadBalancerDescription) resource.TestCheckFunc { return func(s *terraform.State) error { - zones := []string{"us-west-2a", "us-west-2b", "us-west-2c"} - azs := make([]string, 0, len(conf.AvailabilityZones)) - for _, x := range conf.AvailabilityZones { - azs = append(azs, *x) - } - sort.StringSlice(azs).Sort() - if !reflect.DeepEqual(azs, zones) { - return fmt.Errorf("bad availability_zones") - } - l := elb.Listener{ InstancePort: aws.Int64(int64(8000)), InstanceProtocol: aws.String("HTTP"), @@ -1120,16 +1092,6 @@ func testAccCheckAWSELBAttributes(conf *elb.LoadBalancerDescription) resource.Te func testAccCheckAWSELBAttributesHealthCheck(conf *elb.LoadBalancerDescription) resource.TestCheckFunc { return func(s *terraform.State) error { - zones := []string{"us-west-2a", "us-west-2b", "us-west-2c"} - azs := make([]string, 0, len(conf.AvailabilityZones)) - for _, x := range conf.AvailabilityZones { - azs = append(azs, *x) - } - sort.StringSlice(azs).Sort() - if !reflect.DeepEqual(azs, zones) { - return fmt.Errorf("bad availability_zones") - } - check := &elb.HealthCheck{ Timeout: aws.Int64(int64(30)), UnhealthyThreshold: aws.Int64(int64(5)), @@ -1195,15 +1157,18 @@ func testAccCheckAWSELBExists(n string, res *elb.LoadBalancerDescription) resour } const testAccAWSELBConfig = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "bar" { - availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}", "${data.aws_availability_zones.available.names[2]}"] listener { instance_port = 8000 instance_protocol = "http" lb_port = 80 - // Protocol should be case insensitive - lb_protocol = "HttP" + lb_protocol = "http" } tags = { @@ -1215,9 +1180,13 @@ resource "aws_elb" "bar" { ` const testAccAWSELBFullRangeOfCharacters = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "foo" { name = "%s" - availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}", "${data.aws_availability_zones.available.names[2]}"] listener { instance_port = 8000 @@ -1229,8 +1198,12 @@ resource "aws_elb" "foo" { ` const testAccAWSELBAccessLogs = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "foo" { - availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}", "${data.aws_availability_zones.available.names[2]}"] listener { instance_port = 8000 @@ -1243,9 +1216,14 @@ resource "aws_elb" "foo" { func testAccAWSELBAccessLogsOn(r string) string { return fmt.Sprintf(` -# an S3 bucket configured for Access logs -# The 797873946194 is the AWS ID for us-west-2, so this test -# must be ran in us-west-2 +data "aws_availability_zones" "available" { + state = "available" +} + +data "aws_elb_service_account" "current" {} + +data "aws_partition" "current" {} + resource "aws_s3_bucket" "acceslogs_bucket" { bucket = "%s" acl = "private" @@ -1259,9 +1237,9 @@ resource "aws_s3_bucket" "acceslogs_bucket" { "Action": "s3:PutObject", "Effect": "Allow", "Principal": { - "AWS": "arn:aws:iam::797873946194:root" + "AWS": "${data.aws_elb_service_account.current.arn}" }, - "Resource": "arn:aws:s3:::%s/*", + "Resource": "arn:${data.aws_partition.current.partition}:s3:::%s/*", "Sid": "Stmt1446575236270" } ], @@ -1271,7 +1249,7 @@ EOF } resource "aws_elb" "foo" { - availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}", "${data.aws_availability_zones.available.names[2]}"] listener { instance_port = 8000 @@ -1290,9 +1268,14 @@ resource "aws_elb" "foo" { func testAccAWSELBAccessLogsDisabled(r string) string { return fmt.Sprintf(` -# an S3 bucket configured for Access logs -# The 797873946194 is the AWS ID for us-west-2, so this test -# must be ran in us-west-2 +data "aws_availability_zones" "available" { + state = "available" +} + +data "aws_elb_service_account" "current" {} + +data "aws_partition" "current" {} + resource "aws_s3_bucket" "acceslogs_bucket" { bucket = "%s" acl = "private" @@ -1306,9 +1289,9 @@ resource "aws_s3_bucket" "acceslogs_bucket" { "Action": "s3:PutObject", "Effect": "Allow", "Principal": { - "AWS": "arn:aws:iam::797873946194:root" + "AWS": "${data.aws_elb_service_account.current.arn}" }, - "Resource": "arn:aws:s3:::%s/*", + "Resource": "arn:${data.aws_partition.current.partition}:s3:::%s/*", "Sid": "Stmt1446575236270" } ], @@ -1318,7 +1301,7 @@ EOF } resource "aws_elb" "foo" { - availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}", "${data.aws_availability_zones.available.names[2]}"] listener { instance_port = 8000 @@ -1337,9 +1320,13 @@ resource "aws_elb" "foo" { } const testAccAWSELB_namePrefix = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "test" { name_prefix = "test-" - availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}", "${data.aws_availability_zones.available.names[2]}"] listener { instance_port = 8000 @@ -1351,8 +1338,12 @@ resource "aws_elb" "test" { ` const testAccAWSELBGeneratedName = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "foo" { - availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}", "${data.aws_availability_zones.available.names[2]}"] listener { instance_port = 8000 @@ -1364,9 +1355,13 @@ resource "aws_elb" "foo" { ` const testAccAWSELB_zeroValueName = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "foo" { name = "" - availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}", "${data.aws_availability_zones.available.names[2]}"] listener { instance_port = 8000 @@ -1383,8 +1378,12 @@ output "lb_name" { ` const testAccAWSELBConfig_AvailabilityZonesUpdate = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "bar" { - availability_zones = ["us-west-2a", "us-west-2b"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}"] listener { instance_port = 8000 @@ -1396,8 +1395,12 @@ resource "aws_elb" "bar" { ` const testAccAWSELBConfig_TagUpdate = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "bar" { - availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}", "${data.aws_availability_zones.available.names[2]}"] listener { instance_port = 8000 @@ -1416,8 +1419,27 @@ resource "aws_elb" "bar" { ` const testAccAWSELBConfigNewInstance = ` +data "aws_ami" "amzn-ami-minimal-hvm-ebs" { + most_recent = true + owners = ["amazon"] + + filter { + name = "name" + values = ["amzn-ami-minimal-hvm-*"] + } + + filter { + name = "root-device-type" + values = ["ebs"] + } +} + +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "bar" { - availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}", "${data.aws_availability_zones.available.names[2]}"] listener { instance_port = 8000 @@ -1430,15 +1452,18 @@ resource "aws_elb" "bar" { } resource "aws_instance" "foo" { - # us-west-2 - ami = "ami-043a5034" - instance_type = "t1.micro" + ami = "${data.aws_ami.amzn-ami-minimal-hvm-ebs.id}" + instance_type = "t3.micro" } ` const testAccAWSELBConfigHealthCheck = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "bar" { - availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}", "${data.aws_availability_zones.available.names[2]}"] listener { instance_port = 8000 @@ -1458,8 +1483,12 @@ resource "aws_elb" "bar" { ` const testAccAWSELBConfigHealthCheck_update = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "bar" { - availability_zones = ["us-west-2a"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}"] listener { instance_port = 8000 @@ -1479,8 +1508,12 @@ resource "aws_elb" "bar" { ` const testAccAWSELBConfigListener_update = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "bar" { - availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}", "${data.aws_availability_zones.available.names[2]}"] listener { instance_port = 8080 @@ -1492,8 +1525,12 @@ resource "aws_elb" "bar" { ` const testAccAWSELBConfigListener_multipleListeners = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "bar" { - availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}", "${data.aws_availability_zones.available.names[2]}"] listener { instance_port = 8000 @@ -1512,8 +1549,12 @@ resource "aws_elb" "bar" { ` const testAccAWSELBConfigIdleTimeout = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "bar" { - availability_zones = ["us-west-2a"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}"] listener { instance_port = 8000 @@ -1527,8 +1568,12 @@ resource "aws_elb" "bar" { ` const testAccAWSELBConfigIdleTimeout_update = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "bar" { - availability_zones = ["us-west-2a"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}"] listener { instance_port = 8000 @@ -1542,8 +1587,12 @@ resource "aws_elb" "bar" { ` const testAccAWSELBConfigConnectionDraining = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "bar" { - availability_zones = ["us-west-2a"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}"] listener { instance_port = 8000 @@ -1558,8 +1607,12 @@ resource "aws_elb" "bar" { ` const testAccAWSELBConfigConnectionDraining_update_timeout = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "bar" { - availability_zones = ["us-west-2a"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}"] listener { instance_port = 8000 @@ -1574,8 +1627,12 @@ resource "aws_elb" "bar" { ` const testAccAWSELBConfigConnectionDraining_update_disable = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "bar" { - availability_zones = ["us-west-2a"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}"] listener { instance_port = 8000 @@ -1589,8 +1646,12 @@ resource "aws_elb" "bar" { ` const testAccAWSELBConfigSecurityGroups = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_elb" "bar" { - availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] + availability_zones = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}", "${data.aws_availability_zones.available.names[2]}"] listener { instance_port = 8000 @@ -1678,6 +1739,10 @@ resource "aws_elb" "bar" { } const testAccAWSELBConfig_subnets = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_vpc" "azelb" { cidr_block = "10.1.0.0/16" enable_dns_hostnames = true @@ -1691,7 +1756,7 @@ resource "aws_subnet" "public_a_one" { vpc_id = "${aws_vpc.azelb.id}" cidr_block = "10.1.1.0/24" - availability_zone = "us-west-2a" + availability_zone = "${data.aws_availability_zones.available.names[0]}" tags = { Name = "tf-acc-elb-subnets-a-one" } @@ -1701,7 +1766,7 @@ resource "aws_subnet" "public_b_one" { vpc_id = "${aws_vpc.azelb.id}" cidr_block = "10.1.7.0/24" - availability_zone = "us-west-2b" + availability_zone = "${data.aws_availability_zones.available.names[1]}" tags = { Name = "tf-acc-elb-subnets-b-one" } @@ -1711,7 +1776,7 @@ resource "aws_subnet" "public_a_two" { vpc_id = "${aws_vpc.azelb.id}" cidr_block = "10.1.2.0/24" - availability_zone = "us-west-2a" + availability_zone = "${data.aws_availability_zones.available.names[0]}" tags = { Name = "tf-acc-elb-subnets-a-two" } @@ -1745,6 +1810,10 @@ resource "aws_internet_gateway" "gw" { ` const testAccAWSELBConfig_subnet_swap = ` +data "aws_availability_zones" "available" { + state = "available" +} + resource "aws_vpc" "azelb" { cidr_block = "10.1.0.0/16" enable_dns_hostnames = true @@ -1758,7 +1827,7 @@ resource "aws_subnet" "public_a_one" { vpc_id = "${aws_vpc.azelb.id}" cidr_block = "10.1.1.0/24" - availability_zone = "us-west-2a" + availability_zone = "${data.aws_availability_zones.available.names[0]}" tags = { Name = "tf-acc-elb-subnet-swap-a-one" } @@ -1768,7 +1837,7 @@ resource "aws_subnet" "public_b_one" { vpc_id = "${aws_vpc.azelb.id}" cidr_block = "10.1.7.0/24" - availability_zone = "us-west-2b" + availability_zone = "${data.aws_availability_zones.available.names[1]}" tags = { Name = "tf-acc-elb-subnet-swap-b-one" } @@ -1778,7 +1847,7 @@ resource "aws_subnet" "public_a_two" { vpc_id = "${aws_vpc.azelb.id}" cidr_block = "10.1.2.0/24" - availability_zone = "us-west-2a" + availability_zone = "${data.aws_availability_zones.available.names[0]}" tags = { Name = "tf-acc-elb-subnet-swap-a-two" } From 7ef3f74ffe2f580be1a1e0c5eb5aac7e1bd30ea9 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 09:22:05 -0400 Subject: [PATCH 0238/1054] Update CHANGELOG for #9336 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ab4ff04b14a..10fb2bd17b22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ENHANCEMENTS: * provider: Support for assuming role using credential process from the shared AWS configuration file [GH-9305] +* resource/aws_autoscaling_lifecycle_hook: Support resource import [GH-9336] ## 2.19.0 (July 11, 2019) From 28614a7d4c1bfd1590b90fce32f50f875f46768f Mon Sep 17 00:00:00 2001 From: Ryn Daniels Date: Tue, 16 Jul 2019 15:56:18 +0200 Subject: [PATCH 0239/1054] Final retry when reading s3 account public access block --- aws/resource_aws_s3_account_public_access_block.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aws/resource_aws_s3_account_public_access_block.go b/aws/resource_aws_s3_account_public_access_block.go index e809824b22a0..d301c341d523 100644 --- a/aws/resource_aws_s3_account_public_access_block.go +++ b/aws/resource_aws_s3_account_public_access_block.go @@ -106,6 +106,10 @@ func resourceAwsS3AccountPublicAccessBlockRead(d *schema.ResourceData, meta inte return nil }) + if isResourceTimeoutError(err) { + output, err = conn.GetPublicAccessBlock(input) + } + if isAWSErr(err, s3control.ErrCodeNoSuchPublicAccessBlockConfiguration, "") { log.Printf("[WARN] S3 Account Public Access Block (%s) not found, removing from state", d.Id()) d.SetId("") From 6d6d4c18ff23d38086e2d105a6449db4a5cf55b6 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 10:01:28 -0400 Subject: [PATCH 0240/1054] Update CHANGELOG for #7823 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10fb2bd17b22..b1479b7f11d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,19 @@ ## 2.20.0 (Unreleased) +NOTES: + +* resource/aws_ssm_maintenance_window_task: The `logging_info` and `task_parameters` configuration blocks have been deprecated in favor of a new `task_invocation_parameters` configuration block to match the API [GH-7823] + ENHANCEMENTS: * provider: Support for assuming role using credential process from the shared AWS configuration file [GH-9305] * resource/aws_autoscaling_lifecycle_hook: Support resource import [GH-9336] +* resource/aws_ssm_maintenance_window_task: Support resource import and in-place updates [GH-7823] +* resource/aws_ssm_maintenance_window_task: Add `task_invocation_parameters` configuration block and deprecate `logging_info` and `task_parameters` configuration blockss to match API [GH-7823] + +BUG FIXES: + +* resource/aws_ssm_maintenance_window_task: Bypass `DoesNotExistException` error on deletion [GH-7823] ## 2.19.0 (July 11, 2019) From ccfd9575770d6aca8e255dea534d25c924f9d179 Mon Sep 17 00:00:00 2001 From: kondo takeshi Date: Tue, 16 Jul 2019 23:22:55 +0900 Subject: [PATCH 0241/1054] Use newer runtime for TestAccAWSLambdaFunction_updateRuntime ref: https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html Identifier: nodejs10.x can be used. --- aws/resource_aws_lambda_function_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws/resource_aws_lambda_function_test.go b/aws/resource_aws_lambda_function_test.go index 22f4acdc518b..78f7a25cc04e 100644 --- a/aws/resource_aws_lambda_function_test.go +++ b/aws/resource_aws_lambda_function_test.go @@ -279,7 +279,7 @@ func TestAccAWSLambdaFunction_updateRuntime(t *testing.T) { Config: testAccAWSLambdaConfigBasicUpdateRuntime(funcName, policyName, roleName, sgName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsLambdaFunctionExists("aws_lambda_function.lambda_function_test", funcName, &conf), - resource.TestCheckResourceAttr("aws_lambda_function.lambda_function_test", "runtime", "nodejs8.10"), + resource.TestCheckResourceAttr("aws_lambda_function.lambda_function_test", "runtime", "nodejs10.x"), ), }, }, @@ -1724,7 +1724,7 @@ resource "aws_lambda_function" "lambda_function_test" { function_name = "%s" role = "${aws_iam_role.iam_for_lambda.arn}" handler = "exports.example" - runtime = "nodejs8.10" + runtime = "nodejs10.x" } `, funcName) } From 95128f1568196332ae8fd16297269bb6be4c6bc8 Mon Sep 17 00:00:00 2001 From: kondo takeshi Date: Tue, 16 Jul 2019 23:24:51 +0900 Subject: [PATCH 0242/1054] Add second runtime for TestAccAWSLambdaLayerVersion_compatibleRuntimes --- aws/resource_aws_lambda_layer_version_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/resource_aws_lambda_layer_version_test.go b/aws/resource_aws_lambda_layer_version_test.go index d8c7c40ad238..378ce0250405 100644 --- a/aws/resource_aws_lambda_layer_version_test.go +++ b/aws/resource_aws_lambda_layer_version_test.go @@ -345,7 +345,7 @@ resource "aws_lambda_layer_version" "lambda_layer_test" { filename = "test-fixtures/lambdatest.zip" layer_name = "%s" - compatible_runtimes = ["nodejs8.10"] + compatible_runtimes = ["nodejs8.10", "nodejs10.x"] } `, layerName) } From 912b5074db01a49023bfbdf096770f79e74ec899 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 11:36:54 -0400 Subject: [PATCH 0243/1054] docs/resource/aws_ssm_maintenance_window_task: Provide examples of all four task types and add valid values for some task_invocation_parameters Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/4408 Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/5700 --- .../ssm_maintenance_window_task.html.markdown | 132 ++++++++++++++---- 1 file changed, 108 insertions(+), 24 deletions(-) diff --git a/website/docs/r/ssm_maintenance_window_task.html.markdown b/website/docs/r/ssm_maintenance_window_task.html.markdown index b5abe9e5c2d6..e9e287bcfdc4 100644 --- a/website/docs/r/ssm_maintenance_window_task.html.markdown +++ b/website/docs/r/ssm_maintenance_window_task.html.markdown @@ -12,40 +12,124 @@ Provides an SSM Maintenance Window Task resource ## Example Usage +### Automation Tasks + ```hcl -resource "aws_ssm_maintenance_window" "window" { - name = "maintenance-window-%s" - schedule = "cron(0 16 ? * TUE *)" - duration = 3 - cutoff = 1 +resource "aws_ssm_maintenance_window_task" "example" { + max_concurrency = 2 + max_errors = 1 + priority = 1 + service_role_arn = "${aws_iam_role.example.arn}" + task_arn = "AWS-RestartEC2Instance" + task_type = "AUTOMATION" + window_id = "${aws_ssm_maintenance_window.example.id}" + + targets { + key = "InstanceIds" + values = ["${aws_instance.example.id}"] + } + + task_invocation_parameters { + automation_parameters { + document_version = "$LATEST" + + parameter { + name = "InstanceId" + values = ["${aws_instance.example.id}"] + } + } + } } +``` -resource "aws_ssm_maintenance_window_task" "task" { - window_id = "${aws_ssm_maintenance_window.window.id}" - name = "maintenance-window-task" - description = "This is a maintenance window task" - task_type = "RUN_COMMAND" - task_arn = "AWS-RunShellScript" +### Lambda Tasks + +```hcl +resource "aws_ssm_maintenance_window_task" "example" { + max_concurrency = 2 + max_errors = 1 priority = 1 - service_role_arn = "arn:aws:iam::187416307283:role/service-role/AWS_Events_Invoke_Run_Command_112316643" - max_concurrency = "2" - max_errors = "1" + service_role_arn = "${aws_iam_role.example.arn}" + task_arn = "${aws_lambda_function.example.arn}" + task_type = "LAMBDA" + window_id = "${aws_ssm_maintenance_window.example.id}" targets { key = "InstanceIds" - values = ["${aws_instance.instance.id}"] + values = ["${aws_instance.example.id}"] } - task_parameters { - name = "commands" - values = ["pwd"] + task_invocation_parameters { + lambda_parameters { + client_context = "${base64encode("{\"key1\":\"value1\"}")}" + payload = "{\"key1\":\"value1\"}" + } } } +``` -resource "aws_instance" "instance" { - ami = "ami-4fccb37f" +### Run Command Tasks - instance_type = "m1.small" +```hcl +resource "aws_ssm_maintenance_window_task" "example" { + max_concurrency = 2 + max_errors = 1 + priority = 1 + service_role_arn = "${aws_iam_role.example.arn}" + task_arn = "AWS-RunShellScript" + task_type = "RUN_COMMAND" + window_id = "${aws_ssm_maintenance_window.example.id}" + + targets { + key = "InstanceIds" + values = ["${aws_instance.example.id}"] + } + + task_invocation_parameters { + run_command_parameters { + output_s3_bucket = "${aws_s3_bucket.example.bucket}" + output_s3_prefix = "output" + service_role_arn = "${aws_iam_role.example.arn}" + timeout_seconds = 600 + + notification_config { + notification_arn = "${aws_sns_topic.example.arn}" + notification_events = ["All"] + notification_type = ["Command"] + } + + parameter { + name = "commands" + values = ["date"] + } + } + } +} +``` + +### Step Function Tasks + +```hcl +resource "aws_ssm_maintenance_window_task" "example" { + max_concurrency = 2 + max_errors = 1 + priority = 1 + service_role_arn = "${aws_iam_role.example.arn}" + task_arn = "${aws_sfn_activity.example.id}" + task_type = "STEP_FUNCTIONS" + window_id = "${aws_ssm_maintenance_window.example.id}" + + targets { + key = "InstanceIds" + values = ["${aws_instance.example.id}"] + } + + task_invocation_parameters { + step_functions_parameters { + input = "{\"key1\":\"value1\"}" + name = "example" + } + } } ``` @@ -100,7 +184,7 @@ The following arguments are supported: * `comment` - (Optional) Information about the command(s) to execute. * `document_hash` - (Optional) The SHA-256 or SHA-1 hash created by the system when the document was created. SHA-1 hashes have been deprecated. -* `document_hash_type` - (Optional) SHA-256 or SHA-1. SHA-1 hashes have been deprecated. +* `document_hash_type` - (Optional) SHA-256 or SHA-1. SHA-1 hashes have been deprecated. Valid values: `Sha256` and `Sha1` * `notification_config` - (Optional) Configurations for sending notifications about command status changes on a per-instance basis. Documented below. * `output_s3_bucket` - (Optional) The name of the Amazon S3 bucket. * `output_s3_key_prefix` - (Optional) The Amazon S3 bucket subfolder. @@ -116,8 +200,8 @@ The following arguments are supported: `notification_config` supports the following: * `notification_arn` - (Optional) An Amazon Resource Name (ARN) for a Simple Notification Service (SNS) topic. Run Command pushes notifications about command status changes to this topic. -* `notification_events` - (Optional) The different events for which you can receive notifications. -* `notification_type` - (Optional) Command: Receive notification when the status of a command changes. Invocation: For commands sent to multiple instances, receive notification on a per-instance basis when the status of a command changes. +* `notification_events` - (Optional) The different events for which you can receive notifications. Valid values: `All`, `InProgress`, `Success`, `TimedOut`, `Cancelled`, and `Failed` +* `notification_type` - (Optional) When specified with `Command`, receive notification when the status of a command changes. When specified with `Invocation`, for commands sent to multiple instances, receive notification on a per-instance basis when the status of a command changes. Valid values: `Command` and `Invocation` `parameter` supports the following: From 31a7140a81726f5b3ab772646b4e17c15861f9f5 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 14:29:08 -0400 Subject: [PATCH 0244/1054] Update website/docs/r/emr_cluster.html.markdown Co-Authored-By: Wilken Rivera --- website/docs/r/emr_cluster.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/emr_cluster.html.markdown b/website/docs/r/emr_cluster.html.markdown index d288fffbabfa..4b161b5c640e 100644 --- a/website/docs/r/emr_cluster.html.markdown +++ b/website/docs/r/emr_cluster.html.markdown @@ -344,7 +344,7 @@ Supported nested arguments for the `master_instance_group` configuration block: * `instance_type` - (Required) EC2 instance type for all instances in the instance group. * `bid_price` - (Optional) Bid price for each EC2 instance in the instance group, expressed in USD. By setting this attribute, the instance group is being declared as a Spot Instance, and will implicitly create a Spot request. Leave this blank to use On-Demand Instances. * `ebs_config` - (Optional) Configuration block(s) for EBS volumes attached to each instance in the instance group. Detailed below. -* `instance_count` - (Optional) Target number of instances for the instance group. Must be 1 or 3. Defaults to 1. Launching with multiple master nodes is only supported in EMR version 5.23.0+, requires this resource's `core_instance_group` to be configured, and requires public (Internet accessible) VPC subnets to have map public IP on launch enabled. Termination protection is automatically enabled when launched with multiple master nodes and Terraform must have the `termination_protection = false` configuration applied before destroying this resource. +* `instance_count` - (Optional) Target number of instances for the instance group. Must be 1 or 3. Defaults to 1. Launching with multiple master nodes is only supported in EMR version 5.23.0+, and requires this resource's `core_instance_group` to be configured. Public (Internet accessible) instances must be created in VPC subnets that have [map public IP on launch](docs/providers/aws/r/subnet.html#map_public_ip_on_launch) enabled. Termination protection is automatically enabled when launched with multiple master nodes and Terraform must have the `termination_protection = false` configuration applied before destroying this resource. * `name` - (Optional) Friendly name given to the instance group. ## ebs_config From eeed649d311496be4f43b0ce20cf19da343ff38e Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 15:00:21 -0400 Subject: [PATCH 0245/1054] Update CHANGELOG for #9235 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1479b7f11d3..51dea6555edc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ENHANCEMENTS: * provider: Support for assuming role using credential process from the shared AWS configuration file [GH-9305] * resource/aws_autoscaling_lifecycle_hook: Support resource import [GH-9336] +* resource/aws_emr_cluster: Add `master_instance_group` configuration block `instance_count` argument (support multiple master nodes) [GH-9235] * resource/aws_ssm_maintenance_window_task: Support resource import and in-place updates [GH-7823] * resource/aws_ssm_maintenance_window_task: Add `task_invocation_parameters` configuration block and deprecate `logging_info` and `task_parameters` configuration blockss to match API [GH-7823] From d060a94e6b448d8143188381693b7e883d101665 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 15:03:29 -0400 Subject: [PATCH 0246/1054] Update aws/resource_aws_servicequotas_service_quota_test.go Co-Authored-By: Wilken Rivera --- aws/resource_aws_servicequotas_service_quota_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/resource_aws_servicequotas_service_quota_test.go b/aws/resource_aws_servicequotas_service_quota_test.go index 9be57f3bdf3e..21e943ef6c0c 100644 --- a/aws/resource_aws_servicequotas_service_quota_test.go +++ b/aws/resource_aws_servicequotas_service_quota_test.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" ) -// This resource different than many since quotas are pre-existing +// This resource is different than many since quotas are pre-existing // and the resource is only designed to help with increases. // In the basic case, we test that the resource can match the existing quota // without unexpected changes. From 5edfa775a610b944fcd7529056834bebe3cb2c77 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 15:07:59 -0400 Subject: [PATCH 0247/1054] resource/aws_servicequotas_service_quota: Adjust placement of requestID variable in Read function Reference: https://github.com/terraform-providers/terraform-provider-aws/pull/9192/files#r303913660 --- aws/resource_aws_servicequotas_service_quota.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_servicequotas_service_quota.go b/aws/resource_aws_servicequotas_service_quota.go index f0e5732f5d57..500672851985 100644 --- a/aws/resource_aws_servicequotas_service_quota.go +++ b/aws/resource_aws_servicequotas_service_quota.go @@ -116,7 +116,6 @@ func resourceAwsServiceQuotasServiceQuotaCreate(d *schema.ResourceData, meta int func resourceAwsServiceQuotasServiceQuotaRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).servicequotasconn - requestID := d.Get("request_id").(string) serviceCode, quotaCode, err := resourceAwsServiceQuotasServiceQuotaParseID(d.Id()) if err != nil { @@ -162,6 +161,8 @@ func resourceAwsServiceQuotasServiceQuotaRead(d *schema.ResourceData, meta inter d.Set("service_name", output.Quota.ServiceName) d.Set("value", output.Quota.Value) + requestID := d.Get("request_id").(string) + if requestID != "" { input := &servicequotas.GetRequestedServiceQuotaChangeInput{ RequestId: aws.String(requestID), From 6a6a759980c7d80976760e40c5b4509bd5b6b8d3 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 15:15:24 -0400 Subject: [PATCH 0248/1054] Update CHANGELOG for #9192 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51dea6555edc..a23681278827 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ NOTES: * resource/aws_ssm_maintenance_window_task: The `logging_info` and `task_parameters` configuration blocks have been deprecated in favor of a new `task_invocation_parameters` configuration block to match the API [GH-7823] +FEATURES: + +* **New Resource:** `aws_servicequotas_service_quota` [GH-9192] + ENHANCEMENTS: * provider: Support for assuming role using credential process from the shared AWS configuration file [GH-9305] From c935e6f49a2b964cb855a07b077bf6b7b41ac615 Mon Sep 17 00:00:00 2001 From: kondo takeshi Date: Wed, 17 Jul 2019 04:56:16 +0900 Subject: [PATCH 0249/1054] Add support for Lambda Permission --- aws/resource_aws_lambda_permission.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/aws/resource_aws_lambda_permission.go b/aws/resource_aws_lambda_permission.go index 1382612d9da9..53a64463f329 100644 --- a/aws/resource_aws_lambda_permission.go +++ b/aws/resource_aws_lambda_permission.go @@ -22,6 +22,9 @@ func resourceAwsLambdaPermission() *schema.Resource { Create: resourceAwsLambdaPermissionCreate, Read: resourceAwsLambdaPermissionRead, Delete: resourceAwsLambdaPermissionDelete, + Importer: &schema.ResourceImporter{ + State: resourceAwsLambdaPermissionImport, + }, Schema: map[string]*schema.Schema{ "action": { @@ -400,6 +403,29 @@ func getFunctionNameFromLambdaArn(arn string) (string, error) { return matches[5], nil } +func resourceAwsLambdaPermissionImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + idParts := strings.Split(d.Id(), "/") + if len(idParts) != 2 || idParts[0] == "" || idParts[1] == "" { + return nil, fmt.Errorf("Unexpected format of ID (%q), expected FUNCTION_NAME/STATEMENT_ID", d.Id()) + } + + functionName := idParts[0] + statement := idParts[1] + log.Printf("[DEBUG] Importing Lambda Permission %s for function name %s", statement, functionName) + + conn := meta.(*AWSClient).lambdaconn + + getFunctionOutput, err := conn.GetFunction(&lambda.GetFunctionInput{FunctionName: &functionName}) + if err != nil { + return nil, err + } + + d.Set("function_name", getFunctionOutput.Configuration.FunctionArn) + d.Set("statement_id", statement) + d.SetId(statement) + return []*schema.ResourceData{d}, nil +} + type LambdaPolicy struct { Version string Statement []LambdaPolicyStatement From 0626a0b1ba2fb35f6c9fd3dfb5e3a1051ae4864e Mon Sep 17 00:00:00 2001 From: kondo takeshi Date: Wed, 17 Jul 2019 04:59:10 +0900 Subject: [PATCH 0250/1054] Add document for lambda permission import --- website/docs/r/lambda_permission.html.markdown | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/website/docs/r/lambda_permission.html.markdown b/website/docs/r/lambda_permission.html.markdown index 6417ab3a5297..e891877c626c 100644 --- a/website/docs/r/lambda_permission.html.markdown +++ b/website/docs/r/lambda_permission.html.markdown @@ -151,3 +151,11 @@ resource "aws_lambda_permission" "lambda_permission" { * `statement_id_prefix` - (Optional) A statement identifier prefix. Terraform will generate a unique suffix. Conflicts with `statement_id`. [1]: https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#use-aws-cli + +## Import + +Lambda Function Aliases can be imported using the function_name/statement_id, e.g. + +``` +$ terraform import aws_lambda_function_permission.test_lambda_permission my_test_lambda_function/AllowExecutionFromCloudWatch +``` From 4468b8fa959016aad0e44b811ee343b814ca3096 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 16:50:47 -0400 Subject: [PATCH 0251/1054] resource/aws_api_gateway_domain_name: Minor docs and testing adjustments Output from acceptance testing: ``` --- PASS: TestAccAWSAPIGatewayDomainName_SecurityPolicy (66.49s) --- PASS: TestAccAWSAPIGatewayDomainName_RegionalCertificateArn (121.03s) ``` --- ...source_aws_api_gateway_domain_name_test.go | 98 +++++++++++++++---- .../r/api_gateway_domain_name.html.markdown | 2 +- 2 files changed, 80 insertions(+), 20 deletions(-) diff --git a/aws/resource_aws_api_gateway_domain_name_test.go b/aws/resource_aws_api_gateway_domain_name_test.go index b16d4f6086db..8666c7411936 100644 --- a/aws/resource_aws_api_gateway_domain_name_test.go +++ b/aws/resource_aws_api_gateway_domain_name_test.go @@ -45,7 +45,6 @@ func TestAccAWSAPIGatewayDomainName_CertificateArn(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "cloudfront_domain_name"), resource.TestCheckResourceAttr(resourceName, "cloudfront_zone_id", "Z2FDTNDATAQYW2"), resource.TestCheckResourceAttr(resourceName, "domain_name", rName), - resource.TestCheckResourceAttr(resourceName, "security_policy", "TLS_1_2"), ), }, }, @@ -106,16 +105,6 @@ func TestAccAWSAPIGatewayDomainName_CertificateName(t *testing.T) { } func TestAccAWSAPIGatewayDomainName_RegionalCertificateArn(t *testing.T) { - // For now, use an environment variable to limit running this test - regionalCertificateArn := os.Getenv("AWS_API_GATEWAY_DOMAIN_NAME_REGIONAL_CERTIFICATE_ARN") - if regionalCertificateArn == "" { - t.Skip( - "Environment variable AWS_API_GATEWAY_DOMAIN_NAME_REGIONAL_CERTIFICATE_ARN is not set. " + - "This environment variable must be set to the ARN of " + - "an ISSUED ACM certificate in the region where this test " + - "is running to enable the test.") - } - var domainName apigateway.DomainName resourceName := "aws_api_gateway_domain_name.test" rName := fmt.Sprintf("tf-acc-%s.terraformtest.com", acctest.RandString(8)) @@ -126,7 +115,7 @@ func TestAccAWSAPIGatewayDomainName_RegionalCertificateArn(t *testing.T) { CheckDestroy: testAccCheckAWSAPIGatewayDomainNameDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSAPIGatewayDomainNameConfig_RegionalCertificateArn(rName, regionalCertificateArn), + Config: testAccAWSAPIGatewayDomainNameConfig_RegionalCertificateArn(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAPIGatewayDomainNameExists(resourceName, &domainName), resource.TestCheckResourceAttr(resourceName, "domain_name", rName), @@ -183,6 +172,32 @@ func TestAccAWSAPIGatewayDomainName_RegionalCertificateName(t *testing.T) { }) } +func TestAccAWSAPIGatewayDomainName_SecurityPolicy(t *testing.T) { + var domainName apigateway.DomainName + resourceName := "aws_api_gateway_domain_name.test" + rName := fmt.Sprintf("tf-acc-%s.terraformtest.com", acctest.RandString(8)) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProvidersWithTLS, + CheckDestroy: testAccCheckAWSAPIGatewayDomainNameDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSAPIGatewayDomainNameConfig_SecurityPolicy(rName, apigateway.SecurityPolicyTls12), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayDomainNameExists(resourceName, &domainName), + resource.TestCheckResourceAttr(resourceName, "security_policy", apigateway.SecurityPolicyTls12), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccCheckAWSAPIGatewayDomainNameExists(n string, res *apigateway.DomainName) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -264,11 +279,12 @@ resource "tls_self_signed_cert" "ca" { } resource "tls_cert_request" "test" { + dns_names = [%[1]q] key_algorithm = "RSA" private_key_pem = "${tls_private_key.test.private_key_pem}" subject { - common_name = "%s" + common_name = %[1]q organization = "ACME Example Holdings, Inc" } } @@ -289,12 +305,42 @@ resource "tls_locally_signed_cert" "leaf" { `, commonName) } +func testAccAWSAPIGatewayDomainNameConfigAcmCertificateBase(commonName string) string { + return fmt.Sprintf(` +resource "tls_private_key" "test" { + algorithm = "RSA" +} + +resource "tls_self_signed_cert" "test" { + allowed_uses = [ + "key_encipherment", + "digital_signature", + "server_auth", + ] + + dns_names = [%[1]q] + key_algorithm = "RSA" + private_key_pem = "${tls_private_key.test.private_key_pem}" + validity_period_hours = 12 + + subject { + common_name = %[1]q + organization = "ACME Examples, Inc" + } +} + +resource "aws_acm_certificate" "test" { + certificate_body = "${tls_self_signed_cert.test.cert_pem}" + private_key = "${tls_private_key.test.private_key_pem}" +} +`, commonName) +} + func testAccAWSAPIGatewayDomainNameConfig_CertificateArn(domainName, certificateArn string) string { return fmt.Sprintf(` resource "aws_api_gateway_domain_name" "test" { domain_name = "%s" certificate_arn = "%s" - security_policy = "TLS_1_2" endpoint_configuration { types = ["EDGE"] @@ -318,17 +364,17 @@ resource "aws_api_gateway_domain_name" "test" { `, domainName, testAccAWSAPIGatewayCerts(commonName)) } -func testAccAWSAPIGatewayDomainNameConfig_RegionalCertificateArn(domainName, regionalCertificateArn string) string { - return fmt.Sprintf(` +func testAccAWSAPIGatewayDomainNameConfig_RegionalCertificateArn(domainName string) string { + return testAccAWSAPIGatewayDomainNameConfigAcmCertificateBase(domainName) + fmt.Sprintf(` resource "aws_api_gateway_domain_name" "test" { - domain_name = "%s" - regional_certificate_arn = "%s" + domain_name = %[1]q + regional_certificate_arn = "${aws_acm_certificate.test.arn}" endpoint_configuration { types = ["REGIONAL"] } } -`, domainName, regionalCertificateArn) +`, domainName) } func testAccAWSAPIGatewayDomainNameConfig_RegionalCertificateName(domainName, commonName string) string { @@ -349,3 +395,17 @@ resource "aws_api_gateway_domain_name" "test" { `, domainName, testAccAWSAPIGatewayCerts(commonName)) } + +func testAccAWSAPIGatewayDomainNameConfig_SecurityPolicy(domainName, securityPolicy string) string { + return testAccAWSAPIGatewayDomainNameConfigAcmCertificateBase(domainName) + fmt.Sprintf(` +resource "aws_api_gateway_domain_name" "test" { + domain_name = %[1]q + regional_certificate_arn = "${aws_acm_certificate.test.arn}" + security_policy = %[2]q + + endpoint_configuration { + types = ["REGIONAL"] + } +} +`, domainName, securityPolicy) +} diff --git a/website/docs/r/api_gateway_domain_name.html.markdown b/website/docs/r/api_gateway_domain_name.html.markdown index bcac998e4849..63c92fe690ce 100644 --- a/website/docs/r/api_gateway_domain_name.html.markdown +++ b/website/docs/r/api_gateway_domain_name.html.markdown @@ -148,7 +148,7 @@ The following arguments are supported: * `domain_name` - (Required) The fully-qualified domain name to register * `endpoint_configuration` - (Optional) Configuration block defining API endpoint information including type. Defined below. -* `security_policy` - (Optional) The Transport Layer Security (TLS) version + cipher suite for this DomainName. The valid values are `TLS_1_0` and `TLS_1_2`. +* `security_policy` - (Optional) The Transport Layer Security (TLS) version + cipher suite for this DomainName. The valid values are `TLS_1_0` and `TLS_1_2`. Must be configured to perform drift detection. When referencing an AWS-managed certificate, the following arguments are supported: From 494830299c31f0384a645c8ec201c8156937c262 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 16:52:02 -0400 Subject: [PATCH 0252/1054] docs/resource/aws_emr_cluster: Fix errant link --- website/docs/r/emr_cluster.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/emr_cluster.html.markdown b/website/docs/r/emr_cluster.html.markdown index 4b161b5c640e..96bf4c18a1e2 100644 --- a/website/docs/r/emr_cluster.html.markdown +++ b/website/docs/r/emr_cluster.html.markdown @@ -344,7 +344,7 @@ Supported nested arguments for the `master_instance_group` configuration block: * `instance_type` - (Required) EC2 instance type for all instances in the instance group. * `bid_price` - (Optional) Bid price for each EC2 instance in the instance group, expressed in USD. By setting this attribute, the instance group is being declared as a Spot Instance, and will implicitly create a Spot request. Leave this blank to use On-Demand Instances. * `ebs_config` - (Optional) Configuration block(s) for EBS volumes attached to each instance in the instance group. Detailed below. -* `instance_count` - (Optional) Target number of instances for the instance group. Must be 1 or 3. Defaults to 1. Launching with multiple master nodes is only supported in EMR version 5.23.0+, and requires this resource's `core_instance_group` to be configured. Public (Internet accessible) instances must be created in VPC subnets that have [map public IP on launch](docs/providers/aws/r/subnet.html#map_public_ip_on_launch) enabled. Termination protection is automatically enabled when launched with multiple master nodes and Terraform must have the `termination_protection = false` configuration applied before destroying this resource. +* `instance_count` - (Optional) Target number of instances for the instance group. Must be 1 or 3. Defaults to 1. Launching with multiple master nodes is only supported in EMR version 5.23.0+, and requires this resource's `core_instance_group` to be configured. Public (Internet accessible) instances must be created in VPC subnets that have [map public IP on launch](/docs/providers/aws/r/subnet.html#map_public_ip_on_launch) enabled. Termination protection is automatically enabled when launched with multiple master nodes and Terraform must have the `termination_protection = false` configuration applied before destroying this resource. * `name` - (Optional) Friendly name given to the instance group. ## ebs_config From f9451373d0064af1717b60e921f5724c7b9a95ec Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 16:54:09 -0400 Subject: [PATCH 0253/1054] Update CHANGELOG for #9128 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a23681278827..7801b85de57a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ FEATURES: ENHANCEMENTS: * provider: Support for assuming role using credential process from the shared AWS configuration file [GH-9305] +* resource/aws_api_gateway_domain_name: Add `security_policy` argument [GH-9128] * resource/aws_autoscaling_lifecycle_hook: Support resource import [GH-9336] * resource/aws_emr_cluster: Add `master_instance_group` configuration block `instance_count` argument (support multiple master nodes) [GH-9235] * resource/aws_ssm_maintenance_window_task: Support resource import and in-place updates [GH-7823] From 6977e9eda9a02bb85c5e8b9278dc865eaddf29cf Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 16 Jul 2019 17:48:28 -0400 Subject: [PATCH 0254/1054] resource/aws_db_event_subscription: Handle SubscriptionNotFound errors during Read and Deletion Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/9368 Previously (in us-gov-west-1 and us-east-1): ``` --- FAIL: TestAccAWSDBEventSubscription_basicUpdate (1228.44s) testing.go:629: Error destroying resource! WARNING: Dangling resources may exist. The full state and error is shown below. Error: errors during apply: error waiting for RDS Event Subscription (tf-acc-test-rds-event-subs-2201031712637090321) deletion: SubscriptionNotFound: Event Subscription tf-acc-test-rds-event-subs-2201031712637090321 not found. ``` Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSDBEventSubscription_withPrefix (535.76s) --- PASS: TestAccAWSDBEventSubscription_importBasic (537.39s) --- PASS: TestAccAWSDBEventSubscription_withSourceIds (539.77s) --- PASS: TestAccAWSDBEventSubscription_disappears (543.52s) --- PASS: TestAccAWSDBEventSubscription_categoryUpdate (944.42s) --- PASS: TestAccAWSDBEventSubscription_basicUpdate (945.75s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSDBEventSubscription_withPrefix (622.68s) --- PASS: TestAccAWSDBEventSubscription_importBasic (623.98s) --- PASS: TestAccAWSDBEventSubscription_withSourceIds (628.56s) --- PASS: TestAccAWSDBEventSubscription_disappears (631.20s) --- PASS: TestAccAWSDBEventSubscription_basicUpdate (978.81s) --- PASS: TestAccAWSDBEventSubscription_categoryUpdate (978.91s) ``` --- aws/resource_aws_db_event_subscription.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/aws/resource_aws_db_event_subscription.go b/aws/resource_aws_db_event_subscription.go index 1bad308ebdff..50385d58200f 100644 --- a/aws/resource_aws_db_event_subscription.go +++ b/aws/resource_aws_db_event_subscription.go @@ -155,6 +155,12 @@ func resourceAwsDbEventSubscriptionRead(d *schema.ResourceData, meta interface{} sub, err := resourceAwsDbEventSubscriptionRetrieve(d.Id(), conn) + if isAWSErr(err, rds.ErrCodeSubscriptionNotFoundFault, "") { + log.Printf("[WARN] RDS Event Subscription (%s) not found - removing from state", d.Id()) + d.SetId("") + return nil + } + if err != nil { return fmt.Errorf("error retrieving RDS Event Subscription (%s): %s", d.Id(), err) } @@ -386,6 +392,10 @@ func resourceAwsDbEventSubscriptionRefreshFunc(name string, conn *rds.RDS) resou return func() (interface{}, string, error) { sub, err := resourceAwsDbEventSubscriptionRetrieve(name, conn) + if isAWSErr(err, rds.ErrCodeSubscriptionNotFoundFault, "") { + return nil, "", nil + } + if err != nil { return nil, "", err } From 830588b4250d1e9e901ae967d5da9e478552f456 Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Tue, 16 Jul 2019 17:56:57 -0700 Subject: [PATCH 0255/1054] r/aws_rds_cluster: Add TimeoutAction support. --- aws/resource_aws_rds_cluster.go | 9 +++++++++ aws/resource_aws_rds_cluster_test.go | 11 +++++++---- aws/structure.go | 5 +++++ website/docs/r/rds_cluster.html.markdown | 2 ++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/aws/resource_aws_rds_cluster.go b/aws/resource_aws_rds_cluster.go index 6b82d8c63b6a..52070b3be6b3 100644 --- a/aws/resource_aws_rds_cluster.go +++ b/aws/resource_aws_rds_cluster.go @@ -188,6 +188,15 @@ func resourceAwsRDSCluster() *schema.Resource { Default: 300, ValidateFunc: validation.IntBetween(300, 86400), }, + "timeout_action": { + Type: schema.TypeString, + Optional: true, + Default: "RollbackCapacityChange", + ValidateFunc: validation.StringInSlice([]string{ + "ForceApplyCapacityChange", + "RollbackCapacityChange", + }, false), + }, }, }, }, diff --git a/aws/resource_aws_rds_cluster_test.go b/aws/resource_aws_rds_cluster_test.go index b3de30769c92..5223905c935d 100644 --- a/aws/resource_aws_rds_cluster_test.go +++ b/aws/resource_aws_rds_cluster_test.go @@ -1038,7 +1038,7 @@ func TestAccAWSRDSCluster_ScalingConfiguration(t *testing.T) { CheckDestroy: testAccCheckAWSClusterDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRDSClusterConfig_ScalingConfiguration(rName, false, 128, 4, 301), + Config: testAccAWSRDSClusterConfig_ScalingConfiguration(rName, false, 128, 4, 301, "RollbackCapacityChange"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSClusterExists(resourceName, &dbCluster), resource.TestCheckResourceAttr(resourceName, "scaling_configuration.#", "1"), @@ -1046,10 +1046,11 @@ func TestAccAWSRDSCluster_ScalingConfiguration(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "scaling_configuration.0.max_capacity", "128"), resource.TestCheckResourceAttr(resourceName, "scaling_configuration.0.min_capacity", "4"), resource.TestCheckResourceAttr(resourceName, "scaling_configuration.0.seconds_until_auto_pause", "301"), + resource.TestCheckResourceAttr(resourceName, "scaling_configuration.0.timeout_action", "RollbackCapacityChange"), ), }, { - Config: testAccAWSRDSClusterConfig_ScalingConfiguration(rName, true, 256, 8, 86400), + Config: testAccAWSRDSClusterConfig_ScalingConfiguration(rName, true, 256, 8, 86400, "ForceApplyCapacityChange"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSClusterExists(resourceName, &dbCluster), resource.TestCheckResourceAttr(resourceName, "scaling_configuration.#", "1"), @@ -1057,6 +1058,7 @@ func TestAccAWSRDSCluster_ScalingConfiguration(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "scaling_configuration.0.max_capacity", "256"), resource.TestCheckResourceAttr(resourceName, "scaling_configuration.0.min_capacity", "8"), resource.TestCheckResourceAttr(resourceName, "scaling_configuration.0.seconds_until_auto_pause", "86400"), + resource.TestCheckResourceAttr(resourceName, "scaling_configuration.0.timeout_action", "ForceApplyCapacityChange"), ), }, { @@ -2534,7 +2536,7 @@ resource "aws_rds_cluster" "test" { `, rName, rName, globalClusterIdentifierResourceName) } -func testAccAWSRDSClusterConfig_ScalingConfiguration(rName string, autoPause bool, maxCapacity, minCapacity, secondsUntilAutoPause int) string { +func testAccAWSRDSClusterConfig_ScalingConfiguration(rName string, autoPause bool, maxCapacity, minCapacity, secondsUntilAutoPause int, timeoutAction string) string { return fmt.Sprintf(` resource "aws_rds_cluster" "test" { cluster_identifier = %q @@ -2548,9 +2550,10 @@ resource "aws_rds_cluster" "test" { max_capacity = %d min_capacity = %d seconds_until_auto_pause = %d + timeout_action = "%s" } } -`, rName, autoPause, maxCapacity, minCapacity, secondsUntilAutoPause) +`, rName, autoPause, maxCapacity, minCapacity, secondsUntilAutoPause, timeoutAction) } func testAccAWSRDSClusterConfig_SnapshotIdentifier(rName string) string { diff --git a/aws/structure.go b/aws/structure.go index 72089911d7ac..af8d32ae94c2 100644 --- a/aws/structure.go +++ b/aws/structure.go @@ -4770,6 +4770,10 @@ func expandRdsScalingConfiguration(l []interface{}) *rds.ScalingConfiguration { SecondsUntilAutoPause: aws.Int64(int64(m["seconds_until_auto_pause"].(int))), } + if vTimeoutAction, ok := m["timeout_action"].(string); ok && vTimeoutAction != "" { + scalingConfiguration.TimeoutAction = aws.String(vTimeoutAction) + } + return scalingConfiguration } @@ -4783,6 +4787,7 @@ func flattenRdsScalingConfigurationInfo(scalingConfigurationInfo *rds.ScalingCon "max_capacity": aws.Int64Value(scalingConfigurationInfo.MaxCapacity), "min_capacity": aws.Int64Value(scalingConfigurationInfo.MinCapacity), "seconds_until_auto_pause": aws.Int64Value(scalingConfigurationInfo.SecondsUntilAutoPause), + "timeout_action": aws.StringValue(scalingConfigurationInfo.TimeoutAction), } return []interface{}{m} diff --git a/website/docs/r/rds_cluster.html.markdown b/website/docs/r/rds_cluster.html.markdown index fb214f5ca6e0..99666473deb1 100644 --- a/website/docs/r/rds_cluster.html.markdown +++ b/website/docs/r/rds_cluster.html.markdown @@ -169,6 +169,7 @@ resource "aws_rds_cluster" "example" { max_capacity = 256 min_capacity = 2 seconds_until_auto_pause = 300 + timeout_action = "ForceApplyCapacityChange" } } ``` @@ -177,6 +178,7 @@ resource "aws_rds_cluster" "example" { * `max_capacity` - (Optional) The maximum capacity. The maximum capacity must be greater than or equal to the minimum capacity. Valid capacity values are `1`, `2`, `4`, `8`, `16`, `32`, `64`, `128`, and `256`. Defaults to `16`. * `min_capacity` - (Optional) The minimum capacity. The minimum capacity must be lesser than or equal to the maximum capacity. Valid capacity values are `1`, `2`, `4`, `8`, `16`, `32`, `64`, `128`, and `256`. Defaults to `2`. * `seconds_until_auto_pause` - (Optional) The time, in seconds, before an Aurora DB cluster in serverless mode is paused. Valid values are `300` through `86400`. Defaults to `300`. +* `timeout_action` - (Optional) The action to take when the timeout is reached. Valid values: `ForceApplyCapacityChange`, `RollbackCapacityChange`. Defaults to `RollbackCapacityChange`. See [documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.how-it-works.html#aurora-serverless.how-it-works.timeout-action). ## Attributes Reference From 3bf1c52c80525a6a6410a68d00828ff1364ab118 Mon Sep 17 00:00:00 2001 From: kterada0509 Date: Wed, 17 Jul 2019 19:23:00 +0900 Subject: [PATCH 0256/1054] Add support resource tags for aws_media_store_container resource --- aws/resource_aws_media_store_container.go | 36 ++++- ...resource_aws_media_store_container_test.go | 59 ++++++++ aws/tagsMediaStore.go | 135 ++++++++++++++++++ aws/tagsMediaStore_test.go | 112 +++++++++++++++ .../r/media_store_container.html.markdown | 1 + 5 files changed, 342 insertions(+), 1 deletion(-) create mode 100644 aws/tagsMediaStore.go create mode 100644 aws/tagsMediaStore_test.go diff --git a/aws/resource_aws_media_store_container.go b/aws/resource_aws_media_store_container.go index ce76b6ad93ea..2ca5f58ea563 100644 --- a/aws/resource_aws_media_store_container.go +++ b/aws/resource_aws_media_store_container.go @@ -2,6 +2,7 @@ package aws import ( "fmt" + "log" "regexp" "time" @@ -16,6 +17,7 @@ func resourceAwsMediaStoreContainer() *schema.Resource { return &schema.Resource{ Create: resourceAwsMediaStoreContainerCreate, Read: resourceAwsMediaStoreContainerRead, + Update: resourceAwsMediaStoreContainerUpdate, Delete: resourceAwsMediaStoreContainerDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, @@ -35,6 +37,7 @@ func resourceAwsMediaStoreContainer() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "tags": tagsSchema(), }, } } @@ -44,6 +47,7 @@ func resourceAwsMediaStoreContainerCreate(d *schema.ResourceData, meta interface input := &mediastore.CreateContainerInput{ ContainerName: aws.String(d.Get("name").(string)), + Tags: tagsFromMapMediaStore(d.Get("tags").(map[string]interface{})), } _, err := conn.CreateContainer(input) @@ -75,15 +79,45 @@ func resourceAwsMediaStoreContainerRead(d *schema.ResourceData, meta interface{} ContainerName: aws.String(d.Id()), } resp, err := conn.DescribeContainer(input) + if isAWSErr(err, mediastore.ErrCodeContainerNotFoundException, "") { + log.Printf("[WARN] No Container found: %s, removing from state", d.Id()) + d.SetId("") + return nil + } if err != nil { - return err + return fmt.Errorf("Error describing media store container %s: %s", d.Id(), err) } d.Set("arn", resp.Container.ARN) d.Set("name", resp.Container.Name) d.Set("endpoint", resp.Container.Endpoint) + + if err := saveTagsMediaStore(conn, d, aws.StringValue(resp.Container.ARN)); err != nil { + if isAWSErr(err, mediastore.ErrCodeContainerNotFoundException, "") { + log.Printf("[WARN] No Container found: %s, removing from state", d.Id()) + d.SetId("") + return nil + } + return fmt.Errorf("Error setting tags for %s: %s", d.Id(), err) + } + return nil } +func resourceAwsMediaStoreContainerUpdate(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).mediastoreconn + + if err := setTagsMediaStore(conn, d, d.Get("arn").(string)); err != nil { + if isAWSErr(err, mediastore.ErrCodeContainerNotFoundException, "") { + log.Printf("[WARN] No Container found: %s, removing from state", d.Id()) + d.SetId("") + return nil + } + return fmt.Errorf("Error updating tags for %s: %s", d.Id(), err) + } + + return resourceAwsMediaStoreContainerRead(d, meta) +} + func resourceAwsMediaStoreContainerDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).mediastoreconn diff --git a/aws/resource_aws_media_store_container_test.go b/aws/resource_aws_media_store_container_test.go index ab609c14d1c9..d332db1136a8 100644 --- a/aws/resource_aws_media_store_container_test.go +++ b/aws/resource_aws_media_store_container_test.go @@ -27,6 +27,51 @@ func TestAccAWSMediaStoreContainer_basic(t *testing.T) { }) } +func TestAccAWSMediaStoreContainer_tags(t *testing.T) { + rName := acctest.RandString(5) + resourceName := "aws_media_store_container.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMediaStore(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsMediaStoreContainerDestroy, + Steps: []resource.TestStep{ + { + Config: testAccMediaStoreContainerConfigWithTags(rName, "foo", "bar", "fizz", "buzz"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsMediaStoreContainerExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "3"), + resource.TestCheckResourceAttr(resourceName, "tags.Name", fmt.Sprintf("tf_mediastore_%s", rName)), + resource.TestCheckResourceAttr(resourceName, "tags.foo", "bar"), + resource.TestCheckResourceAttr(resourceName, "tags.fizz", "buzz"), + ), + }, + { + Config: testAccMediaStoreContainerConfigWithTags(rName, "foo", "bar2", "fizz2", "buzz2"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsMediaStoreContainerExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "3"), + resource.TestCheckResourceAttr(resourceName, "tags.Name", fmt.Sprintf("tf_mediastore_%s", rName)), + resource.TestCheckResourceAttr(resourceName, "tags.foo", "bar2"), + resource.TestCheckResourceAttr(resourceName, "tags.fizz2", "buzz2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccMediaStoreContainerConfig(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsMediaStoreContainerExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + }, + }) +} + func TestAccAWSMediaStoreContainer_import(t *testing.T) { resourceName := "aws_media_store_container.test" @@ -116,3 +161,17 @@ resource "aws_media_store_container" "test" { } `, rName) } + +func testAccMediaStoreContainerConfigWithTags(rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { + return fmt.Sprintf(` +resource "aws_media_store_container" "test" { + name = "tf_mediastore_%[1]s" + + tags = { + Name = "tf_mediastore_%[1]s" + %[2]s = %[3]q + %[4]s = %[5]q + } +} +`, rName, tagKey1, tagValue1, tagKey2, tagValue2) +} diff --git a/aws/tagsMediaStore.go b/aws/tagsMediaStore.go new file mode 100644 index 000000000000..2683a0afcbbc --- /dev/null +++ b/aws/tagsMediaStore.go @@ -0,0 +1,135 @@ +package aws + +import ( + "log" + "regexp" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/mediastore" + "github.com/hashicorp/terraform/helper/schema" +) + +// setTags is a helper to set the tags for a resource. It expects the +// tags field to be named "tags" +func setTagsMediaStore(conn *mediastore.MediaStore, d *schema.ResourceData, arn string) error { + if d.HasChange("tags") { + oraw, nraw := d.GetChange("tags") + o := oraw.(map[string]interface{}) + n := nraw.(map[string]interface{}) + create, remove := diffTagsMediaStore(tagsFromMapMediaStore(o), tagsFromMapMediaStore(n)) + + // Set tags + if len(remove) > 0 { + log.Printf("[DEBUG] Removing tags: %s", remove) + k := make([]*string, len(remove)) + for i, t := range remove { + k[i] = t.Key + } + + _, err := conn.UntagResource(&mediastore.UntagResourceInput{ + Resource: aws.String(arn), + TagKeys: k, + }) + if err != nil { + return err + } + } + if len(create) > 0 { + log.Printf("[DEBUG] Creating tags: %s", create) + _, err := conn.TagResource(&mediastore.TagResourceInput{ + Resource: aws.String(arn), + Tags: create, + }) + if err != nil { + return err + } + } + } + + return nil +} + +// diffTags takes our tags locally and the ones remotely and returns +// the set of tags that must be created, and the set of tags that must +// be destroyed. +func diffTagsMediaStore(oldTags, newTags []*mediastore.Tag) ([]*mediastore.Tag, []*mediastore.Tag) { + // First, we're creating everything we have + create := make(map[string]interface{}) + for _, t := range newTags { + create[aws.StringValue(t.Key)] = aws.StringValue(t.Value) + } + + // Build the list of what to remove + var remove []*mediastore.Tag + for _, t := range oldTags { + old, ok := create[aws.StringValue(t.Key)] + if !ok || old != aws.StringValue(t.Value) { + // Delete it! + remove = append(remove, t) + } else if ok { + delete(create, aws.StringValue(t.Key)) + } + } + + return tagsFromMapMediaStore(create), remove +} + +// tagsFromMap returns the tags for the given map of data. +func tagsFromMapMediaStore(m map[string]interface{}) []*mediastore.Tag { + result := make([]*mediastore.Tag, 0, len(m)) + for k, v := range m { + t := &mediastore.Tag{ + Key: aws.String(k), + Value: aws.String(v.(string)), + } + if !tagIgnoredMediaStore(t) { + result = append(result, t) + } + } + + return result +} + +// tagsToMap turns the list of tags into a map. +func tagsToMapMediaStore(ts []*mediastore.Tag) map[string]string { + result := make(map[string]string) + for _, t := range ts { + if !tagIgnoredMediaStore(t) { + result[aws.StringValue(t.Key)] = aws.StringValue(t.Value) + } + } + + return result +} + +// compare a tag against a list of strings and checks if it should +// be ignored or not +func tagIgnoredMediaStore(t *mediastore.Tag) bool { + filter := []string{"^aws:"} + for _, v := range filter { + log.Printf("[DEBUG] Matching %v with %v\n", v, aws.StringValue(t.Key)) + r, _ := regexp.MatchString(v, aws.StringValue(t.Key)) + if r { + log.Printf("[DEBUG] Found AWS specific tag %s (val: %s), ignoring.\n", aws.StringValue(t.Key), aws.StringValue(t.Value)) + return true + } + } + return false +} + +func saveTagsMediaStore(conn *mediastore.MediaStore, d *schema.ResourceData, arn string) error { + resp, err := conn.ListTagsForResource(&mediastore.ListTagsForResourceInput{ + Resource: aws.String(arn), + }) + + if err != nil { + return err + } + + var dt []*mediastore.Tag + if len(resp.Tags) > 0 { + dt = resp.Tags + } + + return d.Set("tags", tagsToMapMediaStore(dt)) +} diff --git a/aws/tagsMediaStore_test.go b/aws/tagsMediaStore_test.go new file mode 100644 index 000000000000..29d0acba31e9 --- /dev/null +++ b/aws/tagsMediaStore_test.go @@ -0,0 +1,112 @@ +package aws + +import ( + "reflect" + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/mediastore" +) + +// go test -v -run="TestDiffMediaStoreTags" +func TestDiffMediaStoreTags(t *testing.T) { + cases := []struct { + Old, New map[string]interface{} + Create, Remove map[string]string + }{ + // Basic add/remove + { + Old: map[string]interface{}{ + "foo": "bar", + }, + New: map[string]interface{}{ + "bar": "baz", + }, + Create: map[string]string{ + "bar": "baz", + }, + Remove: map[string]string{ + "foo": "bar", + }, + }, + + // Modify + { + Old: map[string]interface{}{ + "foo": "bar", + }, + New: map[string]interface{}{ + "foo": "baz", + }, + Create: map[string]string{ + "foo": "baz", + }, + Remove: map[string]string{ + "foo": "bar", + }, + }, + + // Overlap + { + Old: map[string]interface{}{ + "foo": "bar", + "hello": "world", + }, + New: map[string]interface{}{ + "foo": "baz", + "hello": "world", + }, + Create: map[string]string{ + "foo": "baz", + }, + Remove: map[string]string{ + "foo": "bar", + }, + }, + + // Remove + { + Old: map[string]interface{}{ + "foo": "bar", + "bar": "baz", + }, + New: map[string]interface{}{ + "foo": "bar", + }, + Create: map[string]string{}, + Remove: map[string]string{ + "bar": "baz", + }, + }, + } + + for i, tc := range cases { + c, r := diffTagsMediaStore(tagsFromMapMediaStore(tc.Old), tagsFromMapMediaStore(tc.New)) + cm := tagsToMapMediaStore(c) + rm := tagsToMapMediaStore(r) + if !reflect.DeepEqual(cm, tc.Create) { + t.Fatalf("%d: bad create: %#v", i, cm) + } + if !reflect.DeepEqual(rm, tc.Remove) { + t.Fatalf("%d: bad remove: %#v", i, rm) + } + } +} + +// go test -v -run="TestIgnoringTagsMediaStore" +func TestIgnoringTagsMediaStore(t *testing.T) { + var ignoredTags []*mediastore.Tag + ignoredTags = append(ignoredTags, &mediastore.Tag{ + Key: aws.String("aws:cloudformation:logical-id"), + Value: aws.String("foo"), + }) + ignoredTags = append(ignoredTags, &mediastore.Tag{ + Key: aws.String("aws:foo:bar"), + Value: aws.String("baz"), + }) + for _, tag := range ignoredTags { + if !tagIgnoredMediaStore(tag) { + t.Fatalf("Tag %v with value %v not ignored, but should be!", *tag.Key, *tag.Value) + } + } +} diff --git a/website/docs/r/media_store_container.html.markdown b/website/docs/r/media_store_container.html.markdown index ff16d4580acf..65bdc615610c 100644 --- a/website/docs/r/media_store_container.html.markdown +++ b/website/docs/r/media_store_container.html.markdown @@ -23,6 +23,7 @@ resource "aws_media_store_container" "example" { The following arguments are supported: * `name` - (Required) The name of the container. Must contain alphanumeric characters or underscores. +* `tags` - (Optional) A mapping of tags to assign to the resource. ## Attributes Reference From 818c39d4bc3c003ec2c5574e583b20ba3e6ff849 Mon Sep 17 00:00:00 2001 From: Ryn Daniels Date: Wed, 17 Jul 2019 17:56:00 +0100 Subject: [PATCH 0257/1054] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7801b85de57a..35014d1c15cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,10 @@ ENHANCEMENTS: BUG FIXES: +* resource/aws_cloudwatch_event_permissions: Clean up error handling when reading event permissions [GH-9065] +* resource/aws_cloudwatch_event_rule: Retry error handling when creating and updating event rules [GH-9065] +* resource/aws_cloudwatch_log_destination: Clean up error handling when putting log destination [GH-9065] +* resource/aws_cloudwatch_log_subscription_filter: Clean up error handling when creating log subscription filter [GH-9065] * resource/aws_ssm_maintenance_window_task: Bypass `DoesNotExistException` error on deletion [GH-7823] ## 2.19.0 (July 11, 2019) From aa59c67bab3e9591f55136cf52b75f5abf10810b Mon Sep 17 00:00:00 2001 From: Rob H Date: Wed, 17 Jul 2019 18:27:44 +0100 Subject: [PATCH 0258/1054] Updated after initial Review --- ...=> data_source_aws_wafregional_web_acl.go} | 4 --- ...ta_source_aws_wafregional_web_acl_test.go} | 32 +++---------------- ...html => wafregional_web_acl.html.markdown} | 4 +-- 3 files changed, 7 insertions(+), 33 deletions(-) rename aws/{data_source_aws_waf_web_acl.go => data_source_aws_wafregional_web_acl.go} (94%) rename aws/{data_source_aws_waf_web_acl_test.go => data_source_aws_wafregional_web_acl_test.go} (70%) rename website/docs/d/{wafregional_web_acl.html => wafregional_web_acl.html.markdown} (90%) diff --git a/aws/data_source_aws_waf_web_acl.go b/aws/data_source_aws_wafregional_web_acl.go similarity index 94% rename from aws/data_source_aws_waf_web_acl.go rename to aws/data_source_aws_wafregional_web_acl.go index 266d376c77a4..585479a197aa 100644 --- a/aws/data_source_aws_waf_web_acl.go +++ b/aws/data_source_aws_wafregional_web_acl.go @@ -16,10 +16,6 @@ func dataSourceAwsWafRegionalWebAcl() *schema.Resource { Type: schema.TypeString, Required: true, }, - "id": { - Type: schema.TypeString, - Computed: true, - }, }, } } diff --git a/aws/data_source_aws_waf_web_acl_test.go b/aws/data_source_aws_wafregional_web_acl_test.go similarity index 70% rename from aws/data_source_aws_waf_web_acl_test.go rename to aws/data_source_aws_wafregional_web_acl_test.go index 8d2e5d690ef6..fe969cf84545 100644 --- a/aws/data_source_aws_waf_web_acl_test.go +++ b/aws/data_source_aws_wafregional_web_acl_test.go @@ -2,6 +2,7 @@ package aws import ( "fmt" + "github.com/hashicorp/terraform/helper/acctest" "regexp" "testing" @@ -9,7 +10,7 @@ import ( ) func TestAccDataSourceAwsWafRegionalWebAcl_Basic(t *testing.T) { - name := "tf-acc-test" + name := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_wafregional_web_acl.web_acl" datasourceName := "data.aws_wafregional_web_acl.web_acl" @@ -34,41 +35,18 @@ func TestAccDataSourceAwsWafRegionalWebAcl_Basic(t *testing.T) { func testAccDataSourceAwsWafRegionalWebAclConfig_Name(name string) string { return fmt.Sprintf(` -resource "aws_wafregional_rule" "wafrule" { - name = "%s" - metric_name = "WafruleTest" - predicate { - data_id = "${aws_wafregional_ipset.test.id}" - negated = false - type = "IPMatch" - } -} -resource "aws_wafregional_ipset" "test" { - name = "%s" - ip_set_descriptor { - type = "IPV4" - value = "10.0.0.0/8" - } -} resource "aws_wafregional_web_acl" "web_acl" { - name = "%s" + name = %[1]q metric_name = "tfWebACL" default_action { type = "ALLOW" } - rule { - action { - type = "BLOCK" - } - priority = 1 - rule_id = "${aws_wafregional_rule.wafrule.id}" - type = "REGULAR" - } } + data "aws_wafregional_web_acl" "web_acl" { name = "${aws_wafregional_web_acl.web_acl.name}" } -`, name, name, name) +`, name) } const testAccDataSourceAwsWafRegionalWebAclConfig_NonExistent = ` diff --git a/website/docs/d/wafregional_web_acl.html b/website/docs/d/wafregional_web_acl.html.markdown similarity index 90% rename from website/docs/d/wafregional_web_acl.html rename to website/docs/d/wafregional_web_acl.html.markdown index d3acc6344164..f4a6a83a78bf 100644 --- a/website/docs/d/wafregional_web_acl.html +++ b/website/docs/d/wafregional_web_acl.html.markdown @@ -3,7 +3,7 @@ page_title: "AWS: aws_wafregional_web_acl" sidebar_current: "docs-aws-datasource-wafregional-web-acl" description: |- -Retrieves a WAF Regional Web ACL id. + Retrieves a WAF Regional Web ACL id. --- # Data Source: aws_wafregional_web_acl @@ -14,7 +14,7 @@ ```hcl data "aws_wafregional_web_acl" "example" { -name = "tfWAFRule" + name = "tfWAFRule" } ``` From 3ede4a90e1e3931cf46733acfd53870a8e7ca85b Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 17 Jul 2019 20:04:07 +0000 Subject: [PATCH 0259/1054] Update module aws/aws-sdk-go to v1.20.21 --- go.mod | 2 +- go.sum | 4 +- .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../aws/aws-sdk-go/service/autoscaling/api.go | 317 +++++---- .../aws-sdk-go/service/configservice/api.go | 30 + .../service/databasemigrationservice/api.go | 623 +++++++++++------- .../databasemigrationservice/errors.go | 12 +- .../aws/aws-sdk-go/service/kafka/api.go | 2 +- vendor/modules.txt | 2 +- 9 files changed, 607 insertions(+), 387 deletions(-) diff --git a/go.mod b/go.mod index 74e0e59fd645..62fadcd9e870 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/terraform-providers/terraform-provider-aws require ( - github.com/aws/aws-sdk-go v1.20.20 + github.com/aws/aws-sdk-go v1.20.21 github.com/beevik/etree v1.1.0 github.com/bflad/tfproviderlint v0.4.0 github.com/client9/misspell v0.3.4 diff --git a/go.sum b/go.sum index 7a9ea2a7882f..400cb5dabb7e 100644 --- a/go.sum +++ b/go.sum @@ -53,8 +53,8 @@ github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3A github.com/aws/aws-sdk-go v1.16.36/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.20.4/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.20.20 h1:OAR/GtjMOhenkp1NNKr1N1FgIP3mQXHeGbRhvVIAQp0= -github.com/aws/aws-sdk-go v1.20.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.20.21 h1:22vHWL9rur+SRTYPHAXlxJMFIA9OSYsYDIAHFDhQ7Z0= +github.com/aws/aws-sdk-go v1.20.21/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs= github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A= diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index 55f246463940..af9549986d3b 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.20.20" +const SDKVersion = "1.20.21" diff --git a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go index a2f362cddac2..535667a0978a 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go @@ -1274,8 +1274,12 @@ func (c *AutoScaling) DeletePolicyRequest(input *DeletePolicyInput) (req *reques // // Deletes the specified scaling policy. // -// Deleting a policy deletes the underlying alarm action, but does not delete -// the alarm, even if it no longer has an associated action. +// Deleting either a step scaling policy or a simple scaling policy deletes +// the underlying alarm action, but does not delete the alarm, even if it no +// longer has an associated action. +// +// For more information, see Deleting a Scaling Policy (https://docs.aws.amazon.com/autoscaling/ec2/userguide/deleting-scaling-policy.html) +// in the Amazon EC2 Auto Scaling User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -3106,7 +3110,8 @@ func (c *AutoScaling) DescribeScheduledActionsRequest(input *DescribeScheduledAc // DescribeScheduledActions API operation for Auto Scaling. // // Describes the actions scheduled for your Auto Scaling group that haven't -// run. To describe the actions that have already run, use DescribeScalingActivities. +// run or that have not reached their end time. To describe the actions that +// have already run, use DescribeScalingActivities. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -5197,27 +5202,43 @@ func (c *AutoScaling) UpdateAutoScalingGroupRequest(input *UpdateAutoScalingGrou // // Updates the configuration for the specified Auto Scaling group. // -// The new settings take effect on any scaling activities after this call returns. -// Scaling activities that are currently in progress aren't affected. -// -// To update an Auto Scaling group with a launch configuration with InstanceMonitoring -// set to false, you must first disable the collection of group metrics. Otherwise, -// you get an error. If you have previously enabled the collection of group -// metrics, you can disable it using DisableMetricsCollection. -// -// Note the following: +// To update an Auto Scaling group, specify the name of the group and the parameter +// that you want to change. Any parameters that you don't specify are not changed +// by this update request. The new settings take effect on any scaling activities +// after this call returns. Scaling activities that are currently in progress +// aren't affected. +// +// If you associate a new launch configuration or template with an Auto Scaling +// group, all new instances will get the updated configuration, but existing +// instances continue to run with the configuration that they were originally +// launched with. When you update a group to specify a mixed instances policy +// instead of a launch configuration or template, existing instances may be +// replaced to match the new purchasing options that you specified in the policy. +// For example, if the group currently has 100% On-Demand capacity and the policy +// specifies 50% Spot capacity, this means that half of your instances will +// be gradually terminated and relaunched as Spot Instances. When replacing +// instances, Amazon EC2 Auto Scaling launches new instances before terminating +// the old ones, so that updating your group does not compromise the performance +// or availability of your application. +// +// Note the following about changing DesiredCapacity, MaxSize, or MinSize: +// +// * If a scale-in event occurs as a result of a new DesiredCapacity value +// that is lower than the current size of the group, the Auto Scaling group +// uses its termination policy to determine which instances to terminate. // // * If you specify a new value for MinSize without specifying a value for // DesiredCapacity, and the new MinSize is larger than the current size of -// the group, we implicitly call SetDesiredCapacity to set the size of the -// group to the new value of MinSize. +// the group, this sets the group's DesiredCapacity to the new MinSize value. // // * If you specify a new value for MaxSize without specifying a value for // DesiredCapacity, and the new MaxSize is smaller than the current size -// of the group, we implicitly call SetDesiredCapacity to set the size of -// the group to the new value of MaxSize. +// of the group, this sets the group's DesiredCapacity to the new MaxSize +// value. // -// * All other optional parameters are left unchanged if not specified. +// To see which parameters have been set, use DescribeAutoScalingGroups. You +// can also view the scaling policies for an Auto Scaling group using DescribePolicies. +// If the group has scaling policies, you can update them using PutScalingPolicy. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -6006,8 +6027,8 @@ func (s CompleteLifecycleActionOutput) GoString() string { type CreateAutoScalingGroupInput struct { _ struct{} `type:"structure"` - // The name of the Auto Scaling group. This name must be unique within the scope - // of your AWS account. + // The name of the Auto Scaling group. This name must be unique per Region per + // account. // // AutoScalingGroupName is a required field AutoScalingGroupName *string `min:"1" type:"string" required:"true"` @@ -6026,10 +6047,11 @@ type CreateAutoScalingGroupInput struct { // in the Amazon EC2 Auto Scaling User Guide. DefaultCooldown *int64 `type:"integer"` - // The number of EC2 instances that should be running in the group. This number - // must be greater than or equal to the minimum size of the group and less than - // or equal to the maximum size of the group. If you do not specify a desired - // capacity, the default is the minimum size of the group. + // The number of Amazon EC2 instances that the Auto Scaling group attempts to + // maintain. This number must be greater than or equal to the minimum size of + // the group and less than or equal to the maximum size of the group. If you + // do not specify a desired capacity, the default is the minimum size of the + // group. DesiredCapacity *int64 `type:"integer"` // The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before @@ -6053,8 +6075,6 @@ type CreateAutoScalingGroupInput struct { HealthCheckType *string `min:"1" type:"string"` // The ID of the instance used to create a launch configuration for the group. - // This parameter, a launch configuration, a launch template, or a mixed instances - // policy must be specified. // // When you specify an ID of an instance, Amazon EC2 Auto Scaling creates a // new launch configuration and associates it with the group. This launch configuration @@ -6064,31 +6084,39 @@ type CreateAutoScalingGroupInput struct { // For more information, see Create an Auto Scaling Group Using an EC2 Instance // (https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-asg-from-instance.html) // in the Amazon EC2 Auto Scaling User Guide. + // + // You must specify one of the following parameters in your request: LaunchConfigurationName, + // LaunchTemplate, InstanceId, or MixedInstancesPolicy. InstanceId *string `min:"1" type:"string"` - // The name of the launch configuration. This parameter, a launch template, - // a mixed instances policy, or an EC2 instance must be specified. + // The name of the launch configuration. // // For more information, see Creating an Auto Scaling Group Using a Launch Configuration // (https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-asg.html) in // the Amazon EC2 Auto Scaling User Guide. + // + // If you do not specify LaunchConfigurationName, you must specify one of the + // following parameters: InstanceId, LaunchTemplate, or MixedInstancesPolicy. LaunchConfigurationName *string `min:"1" type:"string"` - // The launch template to use to launch instances. This parameter, a launch - // configuration, a mixed instances policy, or an EC2 instance must be specified. + // The launch template to use to launch instances. // // For more information, see Creating an Auto Scaling Group Using a Launch Template // (https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-asg-launch-template.html) // in the Amazon EC2 Auto Scaling User Guide. + // + // If you do not specify LaunchTemplate, you must specify one of the following + // parameters: InstanceId, LaunchConfigurationName, or MixedInstancesPolicy. LaunchTemplate *LaunchTemplateSpecification `type:"structure"` // One or more lifecycle hooks. LifecycleHookSpecificationList []*LifecycleHookSpecification `type:"list"` - // One or more Classic Load Balancers. To specify an Application Load Balancer - // or a Network Load Balancer, use TargetGroupARNs instead. + // A list of Classic Load Balancers associated with this Auto Scaling group. + // For Application Load Balancers and Network Load Balancers, specify a list + // of target groups using the TargetGroupARNs property instead. // - // For more information, see Using a Load Balancer With an Auto Scaling Group + // For more information, see Using a Load Balancer with an Auto Scaling Group // (https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html) // in the Amazon EC2 Auto Scaling User Guide. LoadBalancerNames []*string `type:"list"` @@ -6103,12 +6131,22 @@ type CreateAutoScalingGroupInput struct { // MinSize is a required field MinSize *int64 `type:"integer" required:"true"` - // The mixed instances policy to use to launch instances. This parameter, a - // launch template, a launch configuration, or an EC2 instance must be specified. + // An embedded object that specifies a mixed instances policy. The required + // parameters must be specified. If optional parameters are unspecified, their + // default values are used. + // + // The policy includes parameters that not only define the distribution of On-Demand + // Instances and Spot Instances, the maximum price to pay for Spot instances, + // and how the Auto Scaling group allocates instance types to fulfill On-Demand + // and Spot capacity, but also the parameters that specify the instance configuration + // information—the launch template and instance types. // // For more information, see Auto Scaling Groups with Multiple Instance Types // and Purchase Options (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html) // in the Amazon EC2 Auto Scaling User Guide. + // + // You must specify one of the following parameters in your request: LaunchConfigurationName, + // LaunchTemplate, InstanceId, or MixedInstancesPolicy. MixedInstancesPolicy *MixedInstancesPolicy `type:"structure"` // Indicates whether newly launched instances are protected from termination @@ -6140,7 +6178,13 @@ type CreateAutoScalingGroupInput struct { // in the Amazon EC2 Auto Scaling User Guide. Tags []*Tag `type:"list"` - // The Amazon Resource Names (ARN) of the target groups. + // The Amazon Resource Names (ARN) of the target groups to associate with the + // Auto Scaling group. Instances are registered as targets in a target group, + // and traffic is routed to the target group. + // + // For more information, see Using a Load Balancer with an Auto Scaling Group + // (https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html) + // in the Amazon EC2 Auto Scaling User Guide. TargetGroupARNs []*string `type:"list"` // One or more termination policies used to select the instance to terminate. @@ -6438,8 +6482,8 @@ type CreateLaunchConfigurationInput struct { // EC2 instances launched with an IAM role automatically have AWS security credentials // available. You can use IAM roles with Amazon EC2 Auto Scaling to automatically // enable applications running on your EC2 instances to securely access other - // AWS resources. For more information, see Use an IAM Role for Applications - // That Run on Amazon EC2 Instances (https://docs.aws.amazon.com/autoscaling/ec2/userguide/us-iam-role.html) + // AWS resources. For more information, see IAM Role for Applications That Run + // on Amazon EC2 Instances (https://docs.aws.amazon.com/autoscaling/ec2/userguide/us-iam-role.html) // in the Amazon EC2 Auto Scaling User Guide. IamInstanceProfile *string `min:"1" type:"string"` @@ -6455,14 +6499,14 @@ type CreateLaunchConfigurationInput struct { // launch configuration derives attributes from the instance, except for the // block device mapping. // - // If you do not specify InstanceId, you must specify both ImageId and InstanceType. - // // To create a launch configuration with a block device mapping or override // any other instance attributes, specify them as part of the same request. // // For more information, see Create a Launch Configuration Using an EC2 Instance // (https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-lc-with-instanceID.html) // in the Amazon EC2 Auto Scaling User Guide. + // + // If you do not specify InstanceId, you must specify both ImageId and InstanceType. InstanceId *string `min:"1" type:"string"` // Enables detailed monitoring (true) or basic monitoring (false) for the Auto @@ -6471,11 +6515,11 @@ type CreateLaunchConfigurationInput struct { // The instance type of the EC2 instance. // - // If you do not specify InstanceId, you must specify InstanceType. - // // For information about available instance types, see Available Instance Types // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#AvailableInstanceTypes) // in the Amazon EC2 User Guide for Linux Instances. + // + // If you do not specify InstanceId, you must specify InstanceType. InstanceType *string `min:"1" type:"string"` // The ID of the kernel associated with the AMI. @@ -6486,8 +6530,8 @@ type CreateLaunchConfigurationInput struct { // in the Amazon EC2 User Guide for Linux Instances. KeyName *string `min:"1" type:"string"` - // The name of the launch configuration. This name must be unique within the - // scope of your AWS account. + // The name of the launch configuration. This name must be unique per Region + // per account. // // LaunchConfigurationName is a required field LaunchConfigurationName *string `min:"1" type:"string" required:"true"` @@ -6499,10 +6543,10 @@ type CreateLaunchConfigurationInput struct { // placement tenancy attribute set to default), you must set the value of this // parameter to dedicated. // - // If you specify this parameter, be sure to specify at least one subnet when + // If you specify PlacementTenancy, be sure to specify at least one subnet when // you create your group. // - // For more information, see Launching Auto Scaling Instances in a VPC (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-in-vpc.html) + // For more information, see Instance Placement Tenancy (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-in-vpc.html#as-vpc-tenancy) // in the Amazon EC2 Auto Scaling User Guide. // // Valid values: default | dedicated @@ -8990,37 +9034,56 @@ func (s DisableMetricsCollectionOutput) GoString() string { type Ebs struct { _ struct{} `type:"structure"` - // Indicates whether the volume is deleted on instance termination. The default - // value is true. + // Indicates whether the volume is deleted on instance termination. For Amazon + // EC2 Auto Scaling, the default value is true. DeleteOnTermination *bool `type:"boolean"` - // Specifies whether the volume should be encrypted. Encrypted EBS volumes must - // be attached to instances that support Amazon EBS encryption. Volumes that - // are created from encrypted snapshots are automatically encrypted. There is - // no way to create an encrypted volume from an unencrypted snapshot or an unencrypted - // volume from an encrypted snapshot. If your AMI uses encrypted volumes, you - // can only launch it on supported instance types. For more information, see - // Amazon EBS Encryption (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html) - // in the Amazon EC2 User Guide for Linux Instances. + // Specifies whether the volume should be encrypted. Encrypted EBS volumes can + // only be attached to instances that support Amazon EBS encryption. For more + // information, see Supported Instance Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances). + // If your AMI uses encrypted volumes, you can also only launch it on supported + // instance types. + // + // If you are creating a volume from a snapshot, you cannot specify an encryption + // value. Volumes that are created from encrypted snapshots are automatically + // encrypted, and volumes that are created from unencrypted snapshots are automatically + // unencrypted. By default, encrypted snapshots use the AWS managed CMK that + // is used for EBS encryption, but you can specify a custom CMK when you create + // the snapshot. The ability to encrypt a snapshot during copying also allows + // you to apply a new CMK to an already-encrypted snapshot. Volumes restored + // from the resulting copy are only accessible using the new CMK. + // + // Enabling encryption by default (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-by-default) + // results in all EBS volumes being encrypted with the AWS managed CMK or a + // customer managed CMK, whether or not the snapshot was encrypted. + // + // For more information, see Using Encryption with EBS-Backed AMIs (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIEncryption.html) + // in the Amazon EC2 User Guide for Linux Instances and Required CMK Key Policy + // for Use with Encrypted Volumes (https://docs.aws.amazon.com/autoscaling/ec2/userguide/key-policy-requirements-EBS-encryption.html) + // in the Amazon EC2 Auto Scaling User Guide. Encrypted *bool `type:"boolean"` // The number of I/O operations per second (IOPS) to provision for the volume. - // For more information, see Amazon EBS Volume Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) + // The maximum ratio of IOPS to volume size (in GiB) is 50:1. For more information, + // see Amazon EBS Volume Types (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) // in the Amazon EC2 User Guide for Linux Instances. // // Conditional: This parameter is required when the volume type is io1. (Not // used with standard, gp2, st1, or sc1 volumes.) Iops *int64 `min:"100" type:"integer"` - // The ID of the snapshot. This parameter is optional if you specify a volume - // size. + // The snapshot ID of the volume to use. + // + // Conditional: This parameter is optional if you specify a volume size. If + // you specify both SnapshotId and VolumeSize, VolumeSize must be equal or greater + // than the size of the snapshot. SnapshotId *string `min:"1" type:"string"` - // The volume size, in GiB. + // The volume size, in Gibibytes (GiB). // - // Constraints: 1-1,024 for standard, 4-16,384 for io1, 1-16,384 for gp2, and - // 500-16,384 for st1 and sc1. If you specify a snapshot, the volume size must - // be equal to or larger than the snapshot size. + // This can be a number from 1-1,024 for standard, 4-16,384 for io1, 1-16,384 + // for gp2, and 500-16,384 for st1 and sc1. If you specify a snapshot, the volume + // size must be equal to or larger than the snapshot size. // // Default: If you create a volume from a snapshot and you don't specify a volume // size, the default is the snapshot size. @@ -9356,7 +9419,7 @@ type ExecutePolicyInput struct { // Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to // complete before executing the policy. // - // This parameter is not supported if the policy type is StepScaling. + // This parameter is not supported if the policy type is StepScaling or TargetTrackingScaling. // // For more information, see Scaling Cooldowns (https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html) // in the Amazon EC2 Auto Scaling User Guide. @@ -10093,7 +10156,8 @@ func (s *InstanceMonitoring) SetEnabled(v bool) *InstanceMonitoring { // // The instances distribution specifies the distribution of On-Demand Instances // and Spot Instances, the maximum price to pay for Spot Instances, and how -// the Auto Scaling group allocates instance types. +// the Auto Scaling group allocates instance types to fulfill On-Demand and +// Spot capacity. type InstancesDistribution struct { _ struct{} `type:"structure"` @@ -10118,11 +10182,10 @@ type InstancesDistribution struct { OnDemandBaseCapacity *int64 `type:"integer"` // Controls the percentages of On-Demand Instances and Spot Instances for your - // additional capacity beyond OnDemandBaseCapacity. + // additional capacity beyond OnDemandBaseCapacity. The range is 0–100. // - // The range is 0–100. The default value is 100. If you leave this parameter - // set to 100, the percentages are 100% for On-Demand Instances and 0% for Spot - // Instances. + // The default value is 100. If you leave this parameter set to 100, the percentages + // are 100% for On-Demand Instances and 0% for Spot Instances. OnDemandPercentageAboveBaseCapacity *int64 `type:"integer"` // Indicates how to allocate Spot capacity across Spot pools. @@ -10134,9 +10197,9 @@ type InstancesDistribution struct { // The number of Spot pools to use to allocate your Spot capacity. The Spot // pools are determined from the different instance types in the Overrides array - // of LaunchTemplate. + // of LaunchTemplate. The range is 1–20. // - // The range is 1–20 and the default is 2. + // The default value is 2. SpotInstancePools *int64 `type:"integer"` // The maximum price per unit hour that you are willing to pay for a Spot Instance. @@ -10417,9 +10480,8 @@ type LaunchTemplate struct { LaunchTemplateSpecification *LaunchTemplateSpecification `type:"structure"` // Any parameters that you specify override the same parameters in the launch - // template. Currently, the only supported override is instance type. - // - // You must specify between 2 and 20 overrides. + // template. Currently, the only supported override is instance type. You must + // specify between 2 and 20 overrides. Overrides []*LaunchTemplateOverrides `type:"list"` } @@ -11085,27 +11147,27 @@ func (s *MetricGranularityType) SetGranularity(v string) *MetricGranularityType // Describes a mixed instances policy for an Auto Scaling group. With mixed // instances, your Auto Scaling group can provision a combination of On-Demand -// Instances and Spot Instances across multiple instance types. Used in combination -// with CreateAutoScalingGroup. For more information, see Auto Scaling Groups -// with Multiple Instance Types and Purchase Options (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html) +// Instances and Spot Instances across multiple instance types. For more information, +// see Auto Scaling Groups with Multiple Instance Types and Purchase Options +// (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html) // in the Amazon EC2 Auto Scaling User Guide. // -// When you create your Auto Scaling group, you can specify a launch configuration -// or template as a parameter for the top-level object, or you can specify a -// mixed instances policy, but not both at the same time. +// You can create a mixed instances policy for a new Auto Scaling group (CreateAutoScalingGroup), +// or you can create it for an existing group by updating the group (UpdateAutoScalingGroup) +// to specify MixedInstancesPolicy as the top-level parameter instead of a launch +// configuration or template. type MixedInstancesPolicy struct { _ struct{} `type:"structure"` // The instances distribution to use. // - // If you leave this parameter unspecified when creating the group, the default - // values are used. + // If you leave this parameter unspecified when creating a mixed instances policy, + // the default values are used. InstancesDistribution *InstancesDistribution `type:"structure"` - // The launch template and overrides. + // The launch template and instance types (overrides). // - // This parameter is required when creating an Auto Scaling group with a mixed - // instances policy, but is not required when updating the group. + // This parameter must be specified when creating a mixed instances policy. LaunchTemplate *LaunchTemplate `type:"structure"` } @@ -11222,7 +11284,7 @@ type PredefinedMetricSpecification struct { // interfaces by the Auto Scaling group. // // * ALBRequestCountPerTarget - Number of requests completed per target in - // an Application Load Balancer or a Network Load Balancer target group. + // an Application Load Balancer target group. // // For predefined metric types ASGAverageCPUUtilization, ASGAverageNetworkIn, // and ASGAverageNetworkOut, the parameter must not be specified as the resource @@ -11826,17 +11888,17 @@ type PutScheduledUpdateGroupActionInput struct { // AutoScalingGroupName is a required field AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - // The number of EC2 instances that should be running in the group. + // The number of EC2 instances that should be running in the Auto Scaling group. DesiredCapacity *int64 `type:"integer"` - // The time for the recurring schedule to end. Amazon EC2 Auto Scaling does - // not perform the action after this time. + // The date and time for the recurring schedule to end. Amazon EC2 Auto Scaling + // does not perform the action after this time. EndTime *time.Time `type:"timestamp"` - // The maximum size for the Auto Scaling group. + // The maximum number of instances in the Auto Scaling group. MaxSize *int64 `type:"integer"` - // The minimum size for the Auto Scaling group. + // The minimum number of instances in the Auto Scaling group. MinSize *int64 `type:"integer"` // The recurring schedule for this action, in Unix cron syntax format. This @@ -11844,6 +11906,9 @@ type PutScheduledUpdateGroupActionInput struct { // [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes // (for example, "30 0 1 1,6,12 *"). For more information about this format, // see Crontab (http://crontab.org). + // + // When StartTime and EndTime are specified with Recurrence, they form the boundaries + // of when the recurring action starts and stops. Recurrence *string `min:"1" type:"string"` // The name of this scaling action. @@ -11851,8 +11916,8 @@ type PutScheduledUpdateGroupActionInput struct { // ScheduledActionName is a required field ScheduledActionName *string `min:"1" type:"string" required:"true"` - // The time for this action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT - // only and in quotes (for example, "2019-06-01T00:00:00Z"). + // The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ format + // in UTC/GMT only and in quotes (for example, "2019-06-01T00:00:00Z"). // // If you specify Recurrence and StartTime, Amazon EC2 Auto Scaling performs // the action at this time, and then performs the action based on the specified @@ -12122,7 +12187,7 @@ type ScalingPolicy struct { // The name of the scaling policy. PolicyName *string `min:"1" type:"string"` - // The policy type. The valid values are SimpleScaling and StepScaling. + // The policy type. The valid values are SimpleScaling, StepScaling, and TargetTrackingScaling. PolicyType *string `min:"1" type:"string"` // The amount by which to scale, based on the specified adjustment type. A positive @@ -12309,16 +12374,20 @@ type ScheduledUpdateGroupAction struct { // The number of instances you prefer to maintain in the group. DesiredCapacity *int64 `type:"integer"` - // The date and time that the action is scheduled to end. + // The date and time in UTC for the recurring schedule to end. For example, + // "2019-06-01T00:00:00Z". EndTime *time.Time `type:"timestamp"` - // The maximum size of the group. + // The maximum number of instances in the Auto Scaling group. MaxSize *int64 `type:"integer"` - // The minimum size of the group. + // The minimum number of instances in the Auto Scaling group. MinSize *int64 `type:"integer"` - // The recurring schedule for the action. + // The recurring schedule for the action, in Unix cron syntax format. + // + // When StartTime and EndTime are specified with Recurrence, they form the boundaries + // of when the recurring action starts and stops. Recurrence *string `min:"1" type:"string"` // The Amazon Resource Name (ARN) of the scheduled action. @@ -12327,10 +12396,7 @@ type ScheduledUpdateGroupAction struct { // The name of the scheduled action. ScheduledActionName *string `min:"1" type:"string"` - // The date and time that the action is scheduled to begin. - // - // When StartTime and EndTime are specified with Recurrence, they form the boundaries - // of when the recurring action starts and stops. + // The date and time in UTC for this action to start. For example, "2019-06-01T00:00:00Z". StartTime *time.Time `type:"timestamp"` // This parameter is deprecated. @@ -12418,20 +12484,23 @@ type ScheduledUpdateGroupActionRequest struct { // The number of EC2 instances that should be running in the group. DesiredCapacity *int64 `type:"integer"` - // The time for the recurring schedule to end. Amazon EC2 Auto Scaling does - // not perform the action after this time. + // The date and time for the recurring schedule to end. Amazon EC2 Auto Scaling + // does not perform the action after this time. EndTime *time.Time `type:"timestamp"` - // The maximum size of the group. + // The maximum number of instances in the Auto Scaling group. MaxSize *int64 `type:"integer"` - // The minimum size of the group. + // The minimum number of instances in the Auto Scaling group. MinSize *int64 `type:"integer"` // The recurring schedule for the action, in Unix cron syntax format. This format // consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] // [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example, // "30 0 1 1,6,12 *"). For more information about this format, see Crontab (http://crontab.org). + // + // When StartTime and EndTime are specified with Recurrence, they form the boundaries + // of when the recurring action starts and stops. Recurrence *string `min:"1" type:"string"` // The name of the scaling action. @@ -12439,8 +12508,8 @@ type ScheduledUpdateGroupActionRequest struct { // ScheduledActionName is a required field ScheduledActionName *string `min:"1" type:"string" required:"true"` - // The time for the action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT - // only and in quotes (for example, "2019-06-01T00:00:00Z"). + // The date and time for the action to start, in YYYY-MM-DDThh:mm:ssZ format + // in UTC/GMT only and in quotes (for example, "2019-06-01T00:00:00Z"). // // If you specify Recurrence and StartTime, Amazon EC2 Auto Scaling performs // the action at this time, and then performs the action based on the specified @@ -13065,17 +13134,17 @@ func (s *TagDescription) SetValue(v string) *TagDescription { type TargetTrackingConfiguration struct { _ struct{} `type:"structure"` - // A customized metric. You can specify either a predefined metric or a customized + // A customized metric. You must specify either a predefined metric or a customized // metric. CustomizedMetricSpecification *CustomizedMetricSpecification `type:"structure"` // Indicates whether scaling in by the target tracking scaling policy is disabled. // If scaling in is disabled, the target tracking scaling policy doesn't remove // instances from the Auto Scaling group. Otherwise, the target tracking scaling - // policy can remove instances from the Auto Scaling group. The default is disabled. + // policy can remove instances from the Auto Scaling group. The default is false. DisableScaleIn *bool `type:"boolean"` - // A predefined metric. You can specify either a predefined metric or a customized + // A predefined metric. You must specify either a predefined metric or a customized // metric. PredefinedMetricSpecification *PredefinedMetricSpecification `type:"structure"` @@ -13233,9 +13302,12 @@ type UpdateAutoScalingGroupInput struct { AvailabilityZones []*string `min:"1" type:"list"` // The amount of time, in seconds, after a scaling activity completes before - // another scaling activity can start. The default value is 300. + // another scaling activity can start. The default value is 300. This cooldown + // period is not used when a scaling-specific cooldown is specified. // - // For more information, see Scaling Cooldowns (https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html) + // Cooldown periods are not supported for target tracking scaling policies, + // step scaling policies, or scheduled scaling. For more information, see Scaling + // Cooldowns (https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html) // in the Amazon EC2 Auto Scaling User Guide. DefaultCooldown *int64 `type:"integer"` @@ -13260,13 +13332,18 @@ type UpdateAutoScalingGroupInput struct { // balancer health checks. HealthCheckType *string `min:"1" type:"string"` - // The name of the launch configuration. If you specify this parameter, you - // can't specify a launch template or a mixed instances policy. + // The name of the launch configuration. If you specify LaunchConfigurationName + // in your update request, you can't specify LaunchTemplate or MixedInstancesPolicy. + // + // To update an Auto Scaling group with a launch configuration with InstanceMonitoring + // set to false, you must first disable the collection of group metrics. Otherwise, + // you get an error. If you have previously enabled the collection of group + // metrics, you can disable it using DisableMetricsCollection. LaunchConfigurationName *string `min:"1" type:"string"` // The launch template and version to use to specify the updates. If you specify - // this parameter, you can't specify a launch configuration or a mixed instances - // policy. + // LaunchTemplate in your update request, you can't specify LaunchConfigurationName + // or MixedInstancesPolicy. LaunchTemplate *LaunchTemplateSpecification `type:"structure"` // The maximum size of the Auto Scaling group. @@ -13275,8 +13352,10 @@ type UpdateAutoScalingGroupInput struct { // The minimum size of the Auto Scaling group. MinSize *int64 `type:"integer"` - // The mixed instances policy to use to specify the updates. If you specify - // this parameter, you can't specify a launch configuration or a launch template. + // An embedded object that specifies a mixed instances policy. + // + // In your call to UpdateAutoScalingGroup, you can make changes to the policy + // that is specified. All optional parameters are left unchanged if not specified. // // For more information, see Auto Scaling Groups with Multiple Instance Types // and Purchase Options (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html) @@ -13313,7 +13392,7 @@ type UpdateAutoScalingGroupInput struct { // in the Amazon EC2 Auto Scaling User Guide. TerminationPolicies []*string `type:"list"` - // A comma-separated list of subnet IDs, if you are launching into a VPC. + // A comma-separated list of subnet IDs for virtual private cloud (VPC). // // If you specify VPCZoneIdentifier with AvailabilityZones, the subnets that // you specify for this parameter must reside in those Availability Zones. diff --git a/vendor/github.com/aws/aws-sdk-go/service/configservice/api.go b/vendor/github.com/aws/aws-sdk-go/service/configservice/api.go index 3c4a48e0aa72..0a10c5088d5b 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/configservice/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/configservice/api.go @@ -771,6 +771,9 @@ func (c *ConfigService) DeleteOrganizationConfigRuleRequest(input *DeleteOrganiz // The rule is currently being deleted or the rule is deleting your evaluation // results. Try your request again later. // +// * ErrCodeOrganizationAccessDeniedException "OrganizationAccessDeniedException" +// No permission to call the EnableAWSServiceAccess API. +// // See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DeleteOrganizationConfigRule func (c *ConfigService) DeleteOrganizationConfigRule(input *DeleteOrganizationConfigRuleInput) (*DeleteOrganizationConfigRuleOutput, error) { req, out := c.DeleteOrganizationConfigRuleRequest(input) @@ -2291,6 +2294,9 @@ func (c *ConfigService) DescribeOrganizationConfigRuleStatusesRequest(input *Des // The specified next token is invalid. Specify the nextToken string that was // returned in the previous response to get the next page of results. // +// * ErrCodeOrganizationAccessDeniedException "OrganizationAccessDeniedException" +// No permission to call the EnableAWSServiceAccess API. +// // See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeOrganizationConfigRuleStatuses func (c *ConfigService) DescribeOrganizationConfigRuleStatuses(input *DescribeOrganizationConfigRuleStatusesInput) (*DescribeOrganizationConfigRuleStatusesOutput, error) { req, out := c.DescribeOrganizationConfigRuleStatusesRequest(input) @@ -2374,6 +2380,9 @@ func (c *ConfigService) DescribeOrganizationConfigRulesRequest(input *DescribeOr // * ErrCodeInvalidLimitException "InvalidLimitException" // The specified limit is outside the allowable range. // +// * ErrCodeOrganizationAccessDeniedException "OrganizationAccessDeniedException" +// No permission to call the EnableAWSServiceAccess API. +// // See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeOrganizationConfigRules func (c *ConfigService) DescribeOrganizationConfigRules(input *DescribeOrganizationConfigRulesInput) (*DescribeOrganizationConfigRulesOutput, error) { req, out := c.DescribeOrganizationConfigRulesRequest(input) @@ -3670,6 +3679,9 @@ func (c *ConfigService) GetOrganizationConfigRuleDetailedStatusRequest(input *Ge // The specified next token is invalid. Specify the nextToken string that was // returned in the previous response to get the next page of results. // +// * ErrCodeOrganizationAccessDeniedException "OrganizationAccessDeniedException" +// No permission to call the EnableAWSServiceAccess API. +// // See also, https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/GetOrganizationConfigRuleDetailedStatus func (c *ConfigService) GetOrganizationConfigRuleDetailedStatus(input *GetOrganizationConfigRuleDetailedStatusInput) (*GetOrganizationConfigRuleDetailedStatusOutput, error) { req, out := c.GetOrganizationConfigRuleDetailedStatusRequest(input) @@ -14824,6 +14836,15 @@ const ( // MemberAccountRuleStatusCreateFailed is a MemberAccountRuleStatus enum value MemberAccountRuleStatusCreateFailed = "CREATE_FAILED" + // MemberAccountRuleStatusUpdateSuccessful is a MemberAccountRuleStatus enum value + MemberAccountRuleStatusUpdateSuccessful = "UPDATE_SUCCESSFUL" + + // MemberAccountRuleStatusUpdateFailed is a MemberAccountRuleStatus enum value + MemberAccountRuleStatusUpdateFailed = "UPDATE_FAILED" + + // MemberAccountRuleStatusUpdateInProgress is a MemberAccountRuleStatus enum value + MemberAccountRuleStatusUpdateInProgress = "UPDATE_IN_PROGRESS" + // MemberAccountRuleStatusDeleteSuccessful is a MemberAccountRuleStatus enum value MemberAccountRuleStatusDeleteSuccessful = "DELETE_SUCCESSFUL" @@ -14869,6 +14890,15 @@ const ( // OrganizationRuleStatusCreateFailed is a OrganizationRuleStatus enum value OrganizationRuleStatusCreateFailed = "CREATE_FAILED" + // OrganizationRuleStatusUpdateSuccessful is a OrganizationRuleStatus enum value + OrganizationRuleStatusUpdateSuccessful = "UPDATE_SUCCESSFUL" + + // OrganizationRuleStatusUpdateFailed is a OrganizationRuleStatus enum value + OrganizationRuleStatusUpdateFailed = "UPDATE_FAILED" + + // OrganizationRuleStatusUpdateInProgress is a OrganizationRuleStatus enum value + OrganizationRuleStatusUpdateInProgress = "UPDATE_IN_PROGRESS" + // OrganizationRuleStatusDeleteSuccessful is a OrganizationRuleStatus enum value OrganizationRuleStatusDeleteSuccessful = "DELETE_SUCCESSFUL" diff --git a/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/api.go b/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/api.go index cfeb6733316a..1ca26344376a 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/api.go @@ -231,7 +231,7 @@ func (c *DatabaseMigrationService) CreateEndpointRequest(input *CreateEndpointIn // // Returned Error Codes: // * ErrCodeKMSKeyNotAccessibleFault "KMSKeyNotAccessibleFault" -// AWS DMS cannot access the KMS key. +// AWS DMS cannot access the AWS KMS key. // // * ErrCodeResourceAlreadyExistsFault "ResourceAlreadyExistsFault" // The resource you are attempting to create already exists. @@ -358,20 +358,20 @@ func (c *DatabaseMigrationService) CreateEventSubscriptionRequest(input *CreateE // You are not authorized for the SNS subscription. // // * ErrCodeKMSAccessDeniedFault "KMSAccessDeniedFault" -// The ciphertext references a key that doesn't exist or DMS account doesn't -// have an access to +// The ciphertext references a key that doesn't exist or that the DMS account +// doesn't have access to. // // * ErrCodeKMSDisabledFault "KMSDisabledFault" // The specified master key (CMK) isn't enabled. // // * ErrCodeKMSInvalidStateFault "KMSInvalidStateFault" -// The state of the specified KMS resource isn't valid for this request. +// The state of the specified AWS KMS resource isn't valid for this request. // // * ErrCodeKMSNotFoundFault "KMSNotFoundFault" -// The specified KMS entity or resource can't be found. +// The specified AWS KMS entity or resource can't be found. // // * ErrCodeKMSThrottlingFault "KMSThrottlingFault" -// This request triggered KMS request throttling. +// This request triggered AWS KMS request throttling. // // See also, https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/CreateEventSubscription func (c *DatabaseMigrationService) CreateEventSubscription(input *CreateEventSubscriptionInput) (*CreateEventSubscriptionOutput, error) { @@ -480,7 +480,7 @@ func (c *DatabaseMigrationService) CreateReplicationInstanceRequest(input *Creat // The subnet provided is invalid. // // * ErrCodeKMSKeyNotAccessibleFault "KMSKeyNotAccessibleFault" -// AWS DMS cannot access the KMS key. +// AWS DMS cannot access the AWS KMS key. // // See also, https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/CreateReplicationInstance func (c *DatabaseMigrationService) CreateReplicationInstance(input *CreateReplicationInstanceInput) (*CreateReplicationInstanceOutput, error) { @@ -669,7 +669,7 @@ func (c *DatabaseMigrationService) CreateReplicationTaskRequest(input *CreateRep // The resource could not be found. // // * ErrCodeKMSKeyNotAccessibleFault "KMSKeyNotAccessibleFault" -// AWS DMS cannot access the KMS key. +// AWS DMS cannot access the AWS KMS key. // // * ErrCodeResourceQuotaExceededFault "ResourceQuotaExceededFault" // The quota for this resource quota has been exceeded. @@ -1245,10 +1245,13 @@ func (c *DatabaseMigrationService) DescribeAccountAttributesRequest(input *Descr // DescribeAccountAttributes API operation for AWS Database Migration Service. // -// Lists all of the AWS DMS attributes for a customer account. The attributes -// include AWS DMS quotas for the account, such as the number of replication -// instances allowed. The description for a quota includes the quota name, current -// usage toward that quota, and the quota's maximum value. +// Lists all of the AWS DMS attributes for a customer account. These attributes +// include AWS DMS quotas for the account and a unique account identifier in +// a particular DMS region. DMS quotas include a list of resource quotas supported +// by the account, such as the number of replication instances allowed. The +// description for each resource quota, includes the quota name, current usage +// toward that quota, and the quota's maximum value. DMS uses the unique account +// identifier to name each artifact used by DMS in the given region. // // This command does not take any parameters. // @@ -3709,7 +3712,7 @@ func (c *DatabaseMigrationService) ModifyEndpointRequest(input *ModifyEndpointIn // The resource you are attempting to create already exists. // // * ErrCodeKMSKeyNotAccessibleFault "KMSKeyNotAccessibleFault" -// AWS DMS cannot access the KMS key. +// AWS DMS cannot access the AWS KMS key. // // * ErrCodeAccessDeniedFault "AccessDeniedFault" // AWS DMS was denied access to the endpoint. Check that the role is correctly @@ -3804,20 +3807,20 @@ func (c *DatabaseMigrationService) ModifyEventSubscriptionRequest(input *ModifyE // You are not authorized for the SNS subscription. // // * ErrCodeKMSAccessDeniedFault "KMSAccessDeniedFault" -// The ciphertext references a key that doesn't exist or DMS account doesn't -// have an access to +// The ciphertext references a key that doesn't exist or that the DMS account +// doesn't have access to. // // * ErrCodeKMSDisabledFault "KMSDisabledFault" // The specified master key (CMK) isn't enabled. // // * ErrCodeKMSInvalidStateFault "KMSInvalidStateFault" -// The state of the specified KMS resource isn't valid for this request. +// The state of the specified AWS KMS resource isn't valid for this request. // // * ErrCodeKMSNotFoundFault "KMSNotFoundFault" -// The specified KMS entity or resource can't be found. +// The specified AWS KMS entity or resource can't be found. // // * ErrCodeKMSThrottlingFault "KMSThrottlingFault" -// This request triggered KMS request throttling. +// This request triggered AWS KMS request throttling. // // See also, https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/ModifyEventSubscription func (c *DatabaseMigrationService) ModifyEventSubscription(input *ModifyEventSubscriptionInput) (*ModifyEventSubscriptionOutput, error) { @@ -4112,7 +4115,7 @@ func (c *DatabaseMigrationService) ModifyReplicationTaskRequest(input *ModifyRep // The resource you are attempting to create already exists. // // * ErrCodeKMSKeyNotAccessibleFault "KMSKeyNotAccessibleFault" -// AWS DMS cannot access the KMS key. +// AWS DMS cannot access the AWS KMS key. // // See also, https://docs.aws.amazon.com/goto/WebAPI/dms-2016-01-01/ModifyReplicationTask func (c *DatabaseMigrationService) ModifyReplicationTask(input *ModifyReplicationTaskInput) (*ModifyReplicationTaskOutput, error) { @@ -4284,7 +4287,7 @@ func (c *DatabaseMigrationService) RefreshSchemasRequest(input *RefreshSchemasIn // The resource could not be found. // // * ErrCodeKMSKeyNotAccessibleFault "KMSKeyNotAccessibleFault" -// AWS DMS cannot access the KMS key. +// AWS DMS cannot access the AWS KMS key. // // * ErrCodeResourceQuotaExceededFault "ResourceQuotaExceededFault" // The quota for this resource quota has been exceeded. @@ -4794,7 +4797,7 @@ func (c *DatabaseMigrationService) TestConnectionRequest(input *TestConnectionIn // migration. // // * ErrCodeKMSKeyNotAccessibleFault "KMSKeyNotAccessibleFault" -// AWS DMS cannot access the KMS key. +// AWS DMS cannot access the AWS KMS key. // // * ErrCodeResourceQuotaExceededFault "ResourceQuotaExceededFault" // The quota for this resource quota has been exceeded. @@ -4864,17 +4867,20 @@ func (s *AccountQuota) SetUsed(v int64) *AccountQuota { return s } +// Associates a set of tags with an AWS DMS resource. type AddTagsToResourceInput struct { _ struct{} `type:"structure"` - // The Amazon Resource Name (ARN) of the AWS DMS resource the tag is to be added - // to. AWS DMS resources include a replication instance, endpoint, and a replication + // Identifies the AWS DMS resource to which tags should be added. The value + // for this parameter is an Amazon Resource Name (ARN). + // + // For AWS DMS, you can tag a replication instance, an endpoint, or a replication // task. // // ResourceArn is a required field ResourceArn *string `type:"string" required:"true"` - // The tag to be assigned to the DMS resource. + // One or more tags to be assigned to the resource. // // Tags is a required field Tags []*Tag `type:"list" required:"true"` @@ -4941,7 +4947,7 @@ type ApplyPendingMaintenanceActionInput struct { ApplyAction *string `type:"string" required:"true"` // A value that specifies the type of opt-in request, or undoes an opt-in request. - // An opt-in request of type immediate cannot be undone. + // You can't undo an opt-in request of type immediate. // // Valid values: // @@ -5067,17 +5073,18 @@ type Certificate struct { // The date that the certificate was created. CertificateCreationDate *time.Time `type:"timestamp"` - // The customer-assigned name of the certificate. Valid characters are A-z and - // 0-9. + // A customer-assigned name for the certificate. Identifiers must begin with + // a letter; must contain only ASCII letters, digits, and hyphens; and must + // not end with a hyphen or contain two consecutive hyphens. CertificateIdentifier *string `type:"string"` // The owner of the certificate. CertificateOwner *string `type:"string"` - // The contents of the .pem X.509 certificate file for the certificate. + // The contents of a .pem file, which contains an X.509 certificate. CertificatePem *string `type:"string"` - // The location of the imported Oracle Wallet certificate for use with SSL. + // The location of an imported Oracle Wallet certificate for use with SSL. // // CertificateWallet is automatically base64 encoded/decoded by the SDK. CertificateWallet []byte `type:"blob"` @@ -5283,12 +5290,12 @@ type CreateEndpointInput struct { // EndpointIdentifier is a required field EndpointIdentifier *string `type:"string" required:"true"` - // The type of endpoint. + // The type of endpoint. Valid values are source and target. // // EndpointType is a required field EndpointType *string `type:"string" required:"true" enum:"ReplicationEndpointTypeValue"` - // The type of engine for the endpoint. Valid values, depending on the EndPointType + // The type of engine for the endpoint. Valid values, depending on the EndpointType // value, include mysql, oracle, postgres, mariadb, aurora, aurora-postgresql, // redshift, s3, db2, azuredb, sybase, dynamodb, mongodb, and sqlserver. // @@ -5298,7 +5305,12 @@ type CreateEndpointInput struct { // The external table definition. ExternalTableDefinition *string `type:"string"` - // Additional attributes associated with the connection. + // Additional attributes associated with the connection. Each attribute is specified + // as a name-value pair associated by an equal sign (=). Multiple attributes + // are separated by a semicolon (;) with no additional white space. For information + // on the attributes available for connecting your source or target endpoint, + // see Working with AWS DMS Endpoints (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Endpoints.html) + // in the AWS Database Migration Service User Guide. ExtraConnectionAttributes *string `type:"string"` // Settings in JSON format for the target Amazon Kinesis Data Streams endpoint. @@ -5307,11 +5319,14 @@ type CreateEndpointInput struct { // in the AWS Database Migration User Guide. KinesisSettings *KinesisSettings `type:"structure"` - // The AWS KMS key identifier to use to encrypt the connection parameters. If - // you don't specify a value for the KmsKeyId parameter, then AWS DMS uses your - // default encryption key. AWS KMS creates the default encryption key for your - // AWS account. Your AWS account has a different default encryption key for - // each AWS Region. + // An AWS KMS key identifier that is used to encrypt the connection parameters + // for the endpoint. + // + // If you don't specify a value for the KmsKeyId parameter, then AWS DMS uses + // your default encryption key. + // + // AWS KMS creates the default encryption key for your AWS account. Your AWS + // account has a different default encryption key for each AWS Region. KmsKeyId *string `type:"string"` // Settings in JSON format for the source MongoDB endpoint. For more information @@ -5341,12 +5356,11 @@ type CreateEndpointInput struct { // to use to create the endpoint. ServiceAccessRoleArn *string `type:"string"` - // The Secure Sockets Layer (SSL) mode to use for the SSL connection. The SSL - // mode can be one of four values: none, require, verify-ca, verify-full. The - // default value is none. + // The Secure Sockets Layer (SSL) mode to use for the SSL connection. The default + // is none SslMode *string `type:"string" enum:"DmsSslModeValue"` - // Tags to be added to the endpoint. + // One or more tags to be assigned to the endpoint. Tags []*Tag `type:"list"` // The user name to be used to log in to the endpoint database. @@ -5555,10 +5569,8 @@ type CreateEventSubscriptionInput struct { Enabled *bool `type:"boolean"` // A list of event categories for a source type that you want to subscribe to. - // You can see a list of the categories for a given source type by calling the - // DescribeEventCategories action or in the topic Working with Events and Notifications - // (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Events.html) in the - // AWS Database Migration Service User Guide. + // For more information, see Working with Events and Notifications (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Events.html) + // in the AWS Database Migration Service User Guide. EventCategories []*string `type:"list"` // The Amazon Resource Name (ARN) of the Amazon SNS topic created for event @@ -5568,10 +5580,13 @@ type CreateEventSubscriptionInput struct { // SnsTopicArn is a required field SnsTopicArn *string `type:"string" required:"true"` - // The list of identifiers of the event sources for which events will be returned. - // If not specified, then all sources are included in the response. An identifier - // must begin with a letter and must contain only ASCII letters, digits, and - // hyphens; it cannot end with a hyphen or contain two consecutive hyphens. + // A list of identifiers for which AWS DMS provides notification events. + // + // If you don't specify a value, notifications are provided for all sources. + // + // If you specify multiple values, they must be of the same type. For example, + // if you specify a database instance ID, then all of the other values must + // be database instance IDs. SourceIds []*string `type:"list"` // The type of AWS DMS resource that generates the events. For example, if you @@ -5579,17 +5594,16 @@ type CreateEventSubscriptionInput struct { // this parameter to replication-instance. If this value is not specified, all // events are returned. // - // Valid values: replication-instance | migration-task + // Valid values: replication-instance | replication-task SourceType *string `type:"string"` - // The name of the AWS DMS event notification subscription. - // - // Constraints: The name must be less than 255 characters. + // The name of the AWS DMS event notification subscription. This name must be + // less than 255 characters. // // SubscriptionName is a required field SubscriptionName *string `type:"string" required:"true"` - // A tag to be attached to the event subscription. + // One or more tags to be assigned to the event subscription. Tags []*Tag `type:"list"` } @@ -5691,17 +5705,16 @@ type CreateReplicationInstanceInput struct { // instance. AllocatedStorage *int64 `type:"integer"` - // Indicates that minor engine upgrades will be applied automatically to the - // replication instance during the maintenance window. + // Indicates whether minor engine upgrades will be applied automatically to + // the replication instance during the maintenance window. This parameter defaults + // to true. // // Default: true AutoMinorVersionUpgrade *bool `type:"boolean"` - // The EC2 Availability Zone that the replication instance will be created in. - // - // Default: A random, system-chosen Availability Zone in the endpoint's region. - // - // Example: us-east-1d + // The AWS Availability Zone where the replication instance will be created. + // The default value is a random, system-chosen Availability Zone in the endpoint's + // AWS Region, for example: us-east-1d AvailabilityZone *string `type:"string"` // A list of DNS name servers supported for the replication instance. @@ -5710,15 +5723,19 @@ type CreateReplicationInstanceInput struct { // The engine version number of the replication instance. EngineVersion *string `type:"string"` - // The AWS KMS key identifier that is used to encrypt the content on the replication - // instance. If you don't specify a value for the KmsKeyId parameter, then AWS - // DMS uses your default encryption key. AWS KMS creates the default encryption - // key for your AWS account. Your AWS account has a different default encryption - // key for each AWS Region. + // An AWS KMS key identifier that is used to encrypt the data on the replication + // instance. + // + // If you don't specify a value for the KmsKeyId parameter, then AWS DMS uses + // your default encryption key. + // + // AWS KMS creates the default encryption key for your AWS account. Your AWS + // account has a different default encryption key for each AWS Region. KmsKeyId *string `type:"string"` - // Specifies if the replication instance is a Multi-AZ deployment. You cannot - // set the AvailabilityZone parameter if the Multi-AZ parameter is set to true. + // Specifies whether the replication instance is a Multi-AZ deployment. You + // cannot set the AvailabilityZone parameter if the Multi-AZ parameter is set + // to true. MultiAZ *bool `type:"boolean"` // The weekly time range during which system maintenance can occur, in Universal @@ -5727,7 +5744,7 @@ type CreateReplicationInstanceInput struct { // Format: ddd:hh24:mi-ddd:hh24:mi // // Default: A 30-minute window selected at random from an 8-hour block of time - // per region, occurring on a random day of the week. + // per AWS Region, occurring on a random day of the week. // // Valid Days: Mon, Tue, Wed, Thu, Fri, Sat, Sun // @@ -5767,7 +5784,7 @@ type CreateReplicationInstanceInput struct { // A subnet group to associate with the replication instance. ReplicationSubnetGroupIdentifier *string `type:"string"` - // Tags to be associated with the replication instance. + // One or more tags to be assigned to the replication instance. Tags []*Tag `type:"list"` // Specifies the VPC security group to be used with the replication instance. @@ -5928,12 +5945,12 @@ type CreateReplicationSubnetGroupInput struct { // ReplicationSubnetGroupIdentifier is a required field ReplicationSubnetGroupIdentifier *string `type:"string" required:"true"` - // The EC2 subnet IDs for the subnet group. + // One or more subnet IDs to be assigned to the subnet group. // // SubnetIds is a required field SubnetIds []*string `type:"list" required:"true"` - // The tag to be assigned to the subnet group. + // One or more tags to be assigned to the subnet group. Tags []*Tag `type:"list"` } @@ -6045,17 +6062,17 @@ type CreateReplicationTaskInput struct { // “ CdcStopPosition *string `type:"string"` - // The migration type. + // The migration type. Valid values: full-load | cdc | full-load-and-cdc // // MigrationType is a required field MigrationType *string `type:"string" required:"true" enum:"MigrationTypeValue"` - // The Amazon Resource Name (ARN) of the replication instance. + // The Amazon Resource Name (ARN) of a replication instance. // // ReplicationInstanceArn is a required field ReplicationInstanceArn *string `type:"string" required:"true"` - // The replication task identifier. + // An identifier for the replication task. // // Constraints: // @@ -6068,30 +6085,27 @@ type CreateReplicationTaskInput struct { // ReplicationTaskIdentifier is a required field ReplicationTaskIdentifier *string `type:"string" required:"true"` - // Settings for the task, such as target metadata settings. For a complete list - // of task settings, see Task Settings for AWS Database Migration Service Tasks - // (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TaskSettings.html) + // Overall settings for the task, in JSON format. For more information, see + // Task Settings (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TaskSettings.html) // in the AWS Database Migration User Guide. ReplicationTaskSettings *string `type:"string"` - // The Amazon Resource Name (ARN) string that uniquely identifies the endpoint. + // An Amazon Resource Name (ARN) that uniquely identifies the source endpoint. // // SourceEndpointArn is a required field SourceEndpointArn *string `type:"string" required:"true"` - // When using the AWS CLI or boto3, provide the path of the JSON file that contains - // the table mappings. Precede the path with "file://". When working with the - // DMS API, provide the JSON as the parameter value. - // - // For example, --table-mappings file://mappingfile.json + // The table mappings for the task, in JSON format. For more information, see + // Table Mapping (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TableMapping.html) + // in the AWS Database Migration User Guide. // // TableMappings is a required field TableMappings *string `type:"string" required:"true"` - // Tags to be added to the replication instance. + // One or more tags to be assigned to the replication task. Tags []*Tag `type:"list"` - // The Amazon Resource Name (ARN) string that uniquely identifies the endpoint. + // An Amazon Resource Name (ARN) that uniquely identifies the target endpoint. // // TargetEndpointArn is a required field TargetEndpointArn *string `type:"string" required:"true"` @@ -6600,6 +6614,17 @@ type DescribeAccountAttributesOutput struct { // Account quota information. AccountQuotas []*AccountQuota `type:"list"` + + // A unique AWS DMS identifier for an account in a particular AWS Region. The + // value of this identifier has the following format: c99999999999. DMS uses + // this identifier to name artifacts. For example, DMS uses this identifier + // to name the default Amazon S3 bucket for storing task assessment reports + // in a given AWS Region. The format of this S3 bucket name is the following: + // dms-AccountNumber-UniqueAccountIdentifier. Here is an example name for this + // default S3 bucket: dms-111122223333-c44445555666. + // + // AWS DMS supports UniqueAccountIdentifier in versions 3.1.4 and later. + UniqueAccountIdentifier *string `type:"string"` } // String returns the string representation @@ -6618,6 +6643,12 @@ func (s *DescribeAccountAttributesOutput) SetAccountQuotas(v []*AccountQuota) *D return s } +// SetUniqueAccountIdentifier sets the UniqueAccountIdentifier field's value. +func (s *DescribeAccountAttributesOutput) SetUniqueAccountIdentifier(v string) *DescribeAccountAttributesOutput { + s.UniqueAccountIdentifier = &v + return s +} + type DescribeCertificatesInput struct { _ struct{} `type:"structure"` @@ -6626,7 +6657,7 @@ type DescribeCertificatesInput struct { // An optional pagination token provided by a previous request. If this parameter // is specified, the response includes only records beyond the marker, up to - // the value specified by MaxRecords. + // the vlue specified by MaxRecords. Marker *string `type:"string"` // The maximum number of records to include in the response. If more records @@ -6902,7 +6933,7 @@ type DescribeEndpointTypesOutput struct { // the value specified by MaxRecords. Marker *string `type:"string"` - // The type of endpoints that are supported. + // The types of endpoints that are supported. SupportedEndpointTypes []*SupportedEndpointType `type:"list"` } @@ -7041,7 +7072,7 @@ type DescribeEventCategoriesInput struct { // The type of AWS DMS resource that generates events. // - // Valid values: replication-instance | migration-task + // Valid values: replication-instance | replication-task SourceType *string `type:"string"` } @@ -7231,7 +7262,7 @@ type DescribeEventsInput struct { // The end time for the events to be listed. EndTime *time.Time `type:"timestamp"` - // A list of event categories for a source type that you want to subscribe to. + // A list of event categories for the source type that you've chosen. EventCategories []*string `type:"list"` // Filters applied to the action. @@ -7251,14 +7282,12 @@ type DescribeEventsInput struct { // Constraints: Minimum 20, maximum 100. MaxRecords *int64 `type:"integer"` - // The identifier of the event source. An identifier must begin with a letter - // and must contain only ASCII letters, digits, and hyphens. It cannot end with - // a hyphen or contain two consecutive hyphens. + // The identifier of an event source. SourceIdentifier *string `type:"string"` // The type of AWS DMS resource that generates events. // - // Valid values: replication-instance | migration-task + // Valid values: replication-instance | replication-task SourceType *string `type:"string" enum:"SourceType"` // The start time for the events to be listed. @@ -7476,7 +7505,7 @@ type DescribePendingMaintenanceActionsInput struct { // Constraints: Minimum 20, maximum 100. MaxRecords *int64 `type:"integer"` - // The ARN of the replication instance. + // The Amazon Resource Name (ARN) of the replication instance. ReplicationInstanceArn *string `type:"string"` } @@ -8063,9 +8092,9 @@ type DescribeReplicationTasksInput struct { // Constraints: Minimum 20, maximum 100. MaxRecords *int64 `type:"integer"` - // Set this flag to avoid returning setting information. Use this to reduce - // overhead when settings are too large. Choose TRUE to use this flag, otherwise - // choose FALSE (default). + // An option to set to avoid returning information about settings. Use this + // to reduce overhead when setting information is too large. To use this option, + // choose true; otherwise, choose false (the default). WithoutSettings *bool `type:"boolean"` } @@ -8460,7 +8489,7 @@ func (s *DynamoDbSettings) SetServiceAccessRoleArn(v string) *DynamoDbSettings { type ElasticsearchSettings struct { _ struct{} `type:"structure"` - // The endpoint for the ElasticSearch cluster. + // The endpoint for the Elasticsearch cluster. // // EndpointUri is a required field EndpointUri *string `type:"string" required:"true"` @@ -8573,16 +8602,16 @@ type Endpoint struct { // hyphen or contain two consecutive hyphens. EndpointIdentifier *string `type:"string"` - // The type of endpoint. + // The type of endpoint. Valid values are source and target. EndpointType *string `type:"string" enum:"ReplicationEndpointTypeValue"` // The expanded name for the engine name. For example, if the EngineName parameter // is "aurora," this value would be "Amazon Aurora MySQL." EngineDisplayName *string `type:"string"` - // The database engine name. Valid values, depending on the EndPointType, include + // The database engine name. Valid values, depending on the EndpointType, include // mysql, oracle, postgres, mariadb, aurora, aurora-postgresql, redshift, s3, - // db2, azuredb, sybase, sybase, dynamodb, mongodb, and sqlserver. + // db2, azuredb, sybase, dynamodb, mongodb, and sqlserver. EngineName *string `type:"string"` // Value returned by a call to CreateEndpoint that can be used for cross-account @@ -8600,11 +8629,14 @@ type Endpoint struct { // see the KinesisSettings structure. KinesisSettings *KinesisSettings `type:"structure"` - // The AWS KMS key identifier that is used to encrypt the content on the replication - // instance. If you don't specify a value for the KmsKeyId parameter, then AWS - // DMS uses your default encryption key. AWS KMS creates the default encryption - // key for your AWS account. Your AWS account has a different default encryption - // key for each AWS Region. + // An AWS KMS key identifier that is used to encrypt the connection parameters + // for the endpoint. + // + // If you don't specify a value for the KmsKeyId parameter, then AWS DMS uses + // your default encryption key. + // + // AWS KMS creates the default encryption key for your AWS account. Your AWS + // account has a different default encryption key for each AWS Region. KmsKeyId *string `type:"string"` // The settings for the MongoDB source endpoint. For more information, see the @@ -8614,7 +8646,7 @@ type Endpoint struct { // The port value used to access the endpoint. Port *int64 `type:"integer"` - // Settings for the Amazon Redshift endpoint + // Settings for the Amazon Redshift endpoint. RedshiftSettings *RedshiftSettings `type:"structure"` // The settings for the S3 target endpoint. For more information, see the S3Settings @@ -8627,11 +8659,7 @@ type Endpoint struct { // The Amazon Resource Name (ARN) used by the service access IAM role. ServiceAccessRoleArn *string `type:"string"` - // The SSL mode used to connect to the endpoint. - // - // SSL mode can be one of four values: none, require, verify-ca, verify-full. - // - // The default value is none. + // The SSL mode used to connect to the endpoint. The default value is none. SslMode *string `type:"string" enum:"DmsSslModeValue"` // The status of the endpoint. @@ -8807,16 +8835,12 @@ type Event struct { // The event message. Message *string `type:"string"` - // The identifier of the event source. An identifier must begin with a letter - // and must contain only ASCII letters, digits, and hyphens; it cannot end with - // a hyphen or contain two consecutive hyphens. - // - // Constraints:replication instance, endpoint, migration task + // The identifier of an event source. SourceIdentifier *string `type:"string"` // The type of AWS DMS resource that generates events. // - // Valid values: replication-instance | endpoint | migration-task + // Valid values: replication-instance | endpoint | replication-task SourceType *string `type:"string" enum:"SourceType"` } @@ -8863,13 +8887,13 @@ func (s *Event) SetSourceType(v string) *Event { type EventCategoryGroup struct { _ struct{} `type:"structure"` - // A list of event categories for a SourceType that you want to subscribe to. + // A list of event categories from a source type that you've chosen. EventCategories []*string `type:"list"` // The type of AWS DMS resource that generates events. // // Valid values: replication-instance | replication-server | security-group - // | migration-task + // | replication-task SourceType *string `type:"string"` } @@ -8919,7 +8943,7 @@ type EventSubscription struct { // The type of AWS DMS resource that generates events. // // Valid values: replication-instance | replication-server | security-group - // | migration-task + // | replication-task SourceType *string `type:"string"` // The status of the AWS DMS event notification subscription. @@ -9057,16 +9081,17 @@ func (s *Filter) SetValues(v []*string) *Filter { type ImportCertificateInput struct { _ struct{} `type:"structure"` - // The customer-assigned name of the certificate. Valid characters are A-z and - // 0-9. + // A customer-assigned name for the certificate. Identifiers must begin with + // a letter; must contain only ASCII letters, digits, and hyphens; and must + // not end with a hyphen or contain two consecutive hyphens. // // CertificateIdentifier is a required field CertificateIdentifier *string `type:"string" required:"true"` - // The contents of the .pem X.509 certificate file for the certificate. + // The contents of a .pem file, which contains an X.509 certificate. CertificatePem *string `type:"string"` - // The location of the imported Oracle Wallet certificate for use with SSL. + // The location of an imported Oracle Wallet certificate for use with SSL. // // CertificateWallet is automatically base64 encoded/decoded by the SDK. CertificateWallet []byte `type:"blob"` @@ -9302,12 +9327,12 @@ type ModifyEndpointInput struct { // hyphen or contain two consecutive hyphens. EndpointIdentifier *string `type:"string"` - // The type of endpoint. + // The type of endpoint. Valid values are source and target. EndpointType *string `type:"string" enum:"ReplicationEndpointTypeValue"` - // The type of engine for the endpoint. Valid values, depending on the EndPointType, + // The type of engine for the endpoint. Valid values, depending on the EndpointType, // include mysql, oracle, postgres, mariadb, aurora, aurora-postgresql, redshift, - // s3, db2, azuredb, sybase, sybase, dynamodb, mongodb, and sqlserver. + // s3, db2, azuredb, sybase, dynamodb, mongodb, and sqlserver. EngineName *string `type:"string"` // The external table definition. @@ -9350,11 +9375,7 @@ type ModifyEndpointInput struct { // to modify the endpoint. ServiceAccessRoleArn *string `type:"string"` - // The SSL mode to be used. - // - // SSL mode can be one of four values: none, require, verify-ca, verify-full. - // - // The default value is none. + // The SSL mode used to connect to the endpoint. The default value is none. SslMode *string `type:"string" enum:"DmsSslModeValue"` // The user name to be used to login to the endpoint database. @@ -9561,7 +9582,7 @@ type ModifyEventSubscriptionInput struct { // The type of AWS DMS resource that generates the events you want to subscribe // to. // - // Valid values: replication-instance | migration-task + // Valid values: replication-instance | replication-task SourceType *string `type:"string"` // The name of the AWS DMS event notification subscription to be modified. @@ -9654,12 +9675,12 @@ type ModifyReplicationInstanceInput struct { AllocatedStorage *int64 `type:"integer"` // Indicates that major version upgrades are allowed. Changing this parameter - // does not result in an outage and the change is asynchronously applied as + // does not result in an outage, and the change is asynchronously applied as // soon as possible. // - // Constraints: This parameter must be set to true when specifying a value for - // the EngineVersion parameter that is a different major version than the replication - // instance's current version. + // This parameter must be set to true when specifying a value for the EngineVersion + // parameter that is a different major version than the replication instance's + // current version. AllowMajorVersionUpgrade *bool `type:"boolean"` // Indicates whether the changes should be applied immediately or during the @@ -9678,8 +9699,9 @@ type ModifyReplicationInstanceInput struct { // The engine version number of the replication instance. EngineVersion *string `type:"string"` - // Specifies if the replication instance is a Multi-AZ deployment. You cannot - // set the AvailabilityZone parameter if the Multi-AZ parameter is set to true. + // Specifies whether the replication instance is a Multi-AZ deployment. You + // cannot set the AvailabilityZone parameter if the Multi-AZ parameter is set + // to true. MultiAZ *bool `type:"boolean"` // The weekly time range (in UTC) during which system maintenance can occur, @@ -9834,7 +9856,7 @@ func (s *ModifyReplicationInstanceOutput) SetReplicationInstance(v *ReplicationI type ModifyReplicationSubnetGroupInput struct { _ struct{} `type:"structure"` - // The description of the replication instance subnet group. + // A description for the replication instance subnet group. ReplicationSubnetGroupDescription *string `type:"string"` // The name of the replication instance subnet group. @@ -9947,9 +9969,7 @@ type ModifyReplicationTaskInput struct { // “ CdcStopPosition *string `type:"string"` - // The migration type. - // - // Valid values: full-load | cdc | full-load-and-cdc + // The migration type. Valid values: full-load | cdc | full-load-and-cdc MigrationType *string `type:"string" enum:"MigrationTypeValue"` // The Amazon Resource Name (ARN) of the replication task. @@ -9972,10 +9992,9 @@ type ModifyReplicationTaskInput struct { ReplicationTaskSettings *string `type:"string"` // When using the AWS CLI or boto3, provide the path of the JSON file that contains - // the table mappings. Precede the path with "file://". When working with the - // DMS API, provide the JSON as the parameter value. - // - // For example, --table-mappings file://mappingfile.json + // the table mappings. Precede the path with file://. When working with the + // DMS API, provide the JSON as the parameter value, for example: --table-mappings + // file://mappingfile.json TableMappings *string `type:"string"` } @@ -10225,7 +10244,7 @@ func (s *MongoDbSettings) SetUsername(v string) *MongoDbSettings { type OrderableReplicationInstance struct { _ struct{} `type:"structure"` - // List of availability zones for this replication instance. + // List of Availability Zones for this replication instance. AvailabilityZones []*string `type:"list"` // The default amount of storage (in gigabytes) that is allocated for the replication @@ -10247,6 +10266,12 @@ type OrderableReplicationInstance struct { // replication instance. MinAllocatedStorage *int64 `type:"integer"` + // The value returned when the specified EngineVersion of the replication instance + // is in Beta or test mode. This indicates some features might not work as expected. + // + // AWS DMS supports ReleaseStatus in versions 3.1.4 and later. + ReleaseStatus *string `type:"string" enum:"ReleaseStatusValues"` + // The compute and memory capacity of the replication instance. // // Valid Values: dms.t2.micro | dms.t2.small | dms.t2.medium | dms.t2.large @@ -10303,6 +10328,12 @@ func (s *OrderableReplicationInstance) SetMinAllocatedStorage(v int64) *Orderabl return s } +// SetReleaseStatus sets the ReleaseStatus field's value. +func (s *OrderableReplicationInstance) SetReleaseStatus(v string) *OrderableReplicationInstance { + s.ReleaseStatus = &v + return s +} + // SetReplicationInstanceClass sets the ReplicationInstanceClass field's value. func (s *OrderableReplicationInstance) SetReplicationInstanceClass(v string) *OrderableReplicationInstance { s.ReplicationInstanceClass = &v @@ -10467,65 +10498,69 @@ func (s *RebootReplicationInstanceOutput) SetReplicationInstance(v *ReplicationI type RedshiftSettings struct { _ struct{} `type:"structure"` - // Allows any date format, including invalid formats such as 00/00/00 00:00:00, - // to be loaded without generating an error. You can choose TRUE or FALSE (default). + // A value that indicates to allow any date format, including invalid formats + // such as 00/00/00 00:00:00, to be loaded without generating an error. You + // can choose true or false (the default). // // This parameter applies only to TIMESTAMP and DATE columns. Always use ACCEPTANYDATE - // with the DATEFORMAT parameter. If the date format for the data does not match + // with the DATEFORMAT parameter. If the date format for the data doesn't match // the DATEFORMAT specification, Amazon Redshift inserts a NULL value into that // field. AcceptAnyDate *bool `type:"boolean"` - // Code to run after connecting. This should be the code, not a filename. + // Code to run after connecting. This parameter should contain the code itself, + // not the name of a file containing the code. AfterConnectScript *string `type:"string"` - // The location where the CSV files are stored before being uploaded to the - // S3 bucket. + // The location where the comma-separated value (.csv) files are stored before + // being uploaded to the S3 bucket. BucketFolder *string `type:"string"` // The name of the S3 bucket you want to use BucketName *string `type:"string"` - // Sets the amount of time to wait (in milliseconds) before timing out, beginning - // from when you initially establish a connection. + // A value that sets the amount of time to wait (in milliseconds) before timing + // out, beginning from when you initially establish a connection. ConnectionTimeout *int64 `type:"integer"` - // The name of the Amazon Redshift data warehouse (service) you are working + // The name of the Amazon Redshift data warehouse (service) that you are working // with. DatabaseName *string `type:"string"` - // The date format you are using. Valid values are auto (case-sensitive), your - // date format string enclosed in quotes, or NULL. If this is left unset (NULL), - // it defaults to a format of 'YYYY-MM-DD'. Using auto recognizes most strings, - // even some that are not supported when you use a date format string. + // The date format that you are using. Valid values are auto (case-sensitive), + // your date format string enclosed in quotes, or NULL. If this parameter is + // left unset (NULL), it defaults to a format of 'YYYY-MM-DD'. Using auto recognizes + // most strings, even some that aren't supported when you use a date format + // string. // // If your date and time values use formats different from each other, set this // to auto. DateFormat *string `type:"string"` - // Specifies whether AWS DMS should migrate empty CHAR and VARCHAR fields as - // NULL. A value of TRUE sets empty CHAR and VARCHAR fields to null. The default - // is FALSE. + // A value that specifies whether AWS DMS should migrate empty CHAR and VARCHAR + // fields as NULL. A value of true sets empty CHAR and VARCHAR fields to null. + // The default is false. EmptyAsNull *bool `type:"boolean"` - // The type of server side encryption you want to use for your data. This is - // part of the endpoint settings or the extra connections attributes for Amazon - // S3. You can choose either SSE_S3 (default) or SSE_KMS. To use SSE_S3, create - // an IAM role with a policy that allows "arn:aws:s3:::*" to use the following - // actions: "s3:PutObject", "s3:ListBucket". + // The type of server-side encryption that you want to use for your data. This + // encryption type is part of the endpoint settings or the extra connections + // attributes for Amazon S3. You can choose either SSE_S3 (the default) or SSE_KMS. + // To use SSE_S3, create an AWS Identity and Access Management (IAM) role with + // a policy that allows "arn:aws:s3:::*" to use the following actions: "s3:PutObject", + // "s3:ListBucket" EncryptionMode *string `type:"string" enum:"EncryptionModeValue"` - // Specifies the number of threads used to upload a single file. This accepts - // a value between 1 and 64. It defaults to 10. + // The number of threads used to upload a single file. This parameter accepts + // a value from 1 through 64. It defaults to 10. FileTransferUploadStreams *int64 `type:"integer"` - // Sets the amount of time to wait (in milliseconds) before timing out, beginning + // The amount of time to wait (in milliseconds) before timing out, beginning // from when you begin loading. LoadTimeout *int64 `type:"integer"` - // Specifies the maximum size (in KB) of any CSV file used to transfer data - // to Amazon Redshift. This accepts a value between 1 and 1048576. It defaults - // to 32768 KB (32 MB). + // The maximum size (in KB) of any .csv file used to transfer data to Amazon + // Redshift. This accepts a value from 1 through 1,048,576. It defaults to 32,768 + // KB (32 MB). MaxFileSize *int64 `type:"integer"` // The password for the user named in the username property. @@ -10534,54 +10569,56 @@ type RedshiftSettings struct { // The port number for Amazon Redshift. The default value is 5439. Port *int64 `type:"integer"` - // Removes surrounding quotation marks from strings in the incoming data. All - // characters within the quotation marks, including delimiters, are retained. - // Choose TRUE to remove quotation marks. The default is FALSE. + // A value that specifies to remove surrounding quotation marks from strings + // in the incoming data. All characters within the quotation marks, including + // delimiters, are retained. Choose true to remove quotation marks. The default + // is false. RemoveQuotes *bool `type:"boolean"` - // Replaces invalid characters specified in ReplaceInvalidChars, substituting - // the specified value instead. The default is "?". + // A value that specifies to replaces the invalid characters specified in ReplaceInvalidChars, + // substituting the specified characters instead. The default is "?". ReplaceChars *string `type:"string"` - // A list of chars you want to replace. Use with ReplaceChars. + // A list of characters that you want to replace. Use with ReplaceChars. ReplaceInvalidChars *string `type:"string"` // The name of the Amazon Redshift cluster you are using. ServerName *string `type:"string"` - // If you are using SSE_KMS for the EncryptionMode, provide the KMS Key ID. - // The key you use needs an attached policy that enables IAM user permissions - // and allows use of the key. + // The AWS KMS key ID. If you are using SSE_KMS for the EncryptionMode, provide + // this key ID. The key that you use needs an attached policy that enables IAM + // user permissions and allows use of the key. ServerSideEncryptionKmsKeyId *string `type:"string"` - // The ARN of the role that has access to the Redshift service. + // The Amazon Resource Name (ARN) of the IAM role that has access to the Amazon + // Redshift service. ServiceAccessRoleArn *string `type:"string"` - // The time format you want to use. Valid values are auto (case-sensitive), + // The time format that you want to use. Valid values are auto (case-sensitive), // 'timeformat_string', 'epochsecs', or 'epochmillisecs'. It defaults to 10. - // Using auto recognizes most strings, even some that are not supported when + // Using auto recognizes most strings, even some that aren't supported when // you use a time format string. // // If your date and time values use formats different from each other, set this - // to auto. + // parameter to auto. TimeFormat *string `type:"string"` - // Removes the trailing white space characters from a VARCHAR string. This parameter - // applies only to columns with a VARCHAR data type. Choose TRUE to remove unneeded - // white space. The default is FALSE. + // A value that specifies to remove the trailing white space characters from + // a VARCHAR string. This parameter applies only to columns with a VARCHAR data + // type. Choose true to remove unneeded white space. The default is false. TrimBlanks *bool `type:"boolean"` - // Truncates data in columns to the appropriate number of characters, so that - // it fits in the column. Applies only to columns with a VARCHAR or CHAR data - // type, and rows with a size of 4 MB or less. Choose TRUE to truncate data. - // The default is FALSE. + // A value that specifies to truncate data in columns to the appropriate number + // of characters, so that the data fits in the column. This parameter applies + // only to columns with a VARCHAR or CHAR data type, and rows with a size of + // 4 MB or less. Choose true to truncate data. The default is false. TruncateColumns *bool `type:"boolean"` // An Amazon Redshift user name for a registered user. Username *string `type:"string"` - // The size of the write buffer to use in rows. Valid values range from 1 to - // 2048. Defaults to 1024. Use this setting to tune performance. + // The size of the write buffer to use in rows. Valid values range from 1 through + // 2,048. The default is 1,024. Use this setting to tune performance. WriteBufferSize *int64 `type:"integer"` } @@ -10969,11 +11006,12 @@ func (s *ReloadTablesOutput) SetReplicationTaskArn(v string) *ReloadTablesOutput return s } +// Removes one or more tags from an AWS DMS resource. type RemoveTagsFromResourceInput struct { _ struct{} `type:"structure"` - // >The Amazon Resource Name (ARN) of the AWS DMS resource the tag is to be - // removed from. + // An AWS DMS resource from which you want to remove tag(s). The value for this + // parameter is an Amazon Resource Name (ARN). // // ResourceArn is a required field ResourceArn *string `type:"string" required:"true"` @@ -11063,15 +11101,19 @@ type ReplicationInstance struct { // The time the replication instance was created. InstanceCreateTime *time.Time `type:"timestamp"` - // The AWS KMS key identifier that is used to encrypt the content on the replication - // instance. If you don't specify a value for the KmsKeyId parameter, then AWS - // DMS uses your default encryption key. AWS KMS creates the default encryption - // key for your AWS account. Your AWS account has a different default encryption - // key for each AWS Region. + // An AWS KMS key identifier that is used to encrypt the data on the replication + // instance. + // + // If you don't specify a value for the KmsKeyId parameter, then AWS DMS uses + // your default encryption key. + // + // AWS KMS creates the default encryption key for your AWS account. Your AWS + // account has a different default encryption key for each AWS Region. KmsKeyId *string `type:"string"` - // Specifies if the replication instance is a Multi-AZ deployment. You cannot - // set the AvailabilityZone parameter if the Multi-AZ parameter is set to true. + // Specifies whether the replication instance is a Multi-AZ deployment. You + // cannot set the AvailabilityZone parameter if the Multi-AZ parameter is set + // to true. MultiAZ *bool `type:"boolean"` // The pending modification values. @@ -11113,7 +11155,7 @@ type ReplicationInstance struct { // Deprecated: ReplicationInstancePrivateIpAddress has been deprecated ReplicationInstancePrivateIpAddress *string `deprecated:"true" type:"string"` - // The private IP address of the replication instance. + // One or more private IP addresses for the replication instance. ReplicationInstancePrivateIpAddresses []*string `type:"list"` // The public IP address of the replication instance. @@ -11121,7 +11163,7 @@ type ReplicationInstance struct { // Deprecated: ReplicationInstancePublicIpAddress has been deprecated ReplicationInstancePublicIpAddress *string `deprecated:"true" type:"string"` - // The public IP address of the replication instance. + // One or more public IP addresses for the replication instance. ReplicationInstancePublicIpAddresses []*string `type:"list"` // The status of the replication instance. @@ -11337,8 +11379,9 @@ type ReplicationPendingModifiedValues struct { // The engine version number of the replication instance. EngineVersion *string `type:"string"` - // Specifies if the replication instance is a Multi-AZ deployment. You cannot - // set the AvailabilityZone parameter if the Multi-AZ parameter is set to true. + // Specifies whether the replication instance is a Multi-AZ deployment. You + // cannot set the AvailabilityZone parameter if the Multi-AZ parameter is set + // to true. MultiAZ *bool `type:"boolean"` // The compute and memory capacity of the replication instance. @@ -11385,7 +11428,7 @@ func (s *ReplicationPendingModifiedValues) SetReplicationInstanceClass(v string) type ReplicationSubnetGroup struct { _ struct{} `type:"structure"` - // The description of the replication subnet group. + // A description for the replication subnet group. ReplicationSubnetGroupDescription *string `type:"string"` // The identifier of the replication instance subnet group. @@ -11445,8 +11488,8 @@ type ReplicationTask struct { _ struct{} `type:"structure"` // Indicates when you want a change data capture (CDC) operation to start. Use - // either CdcStartPosition or CdcStartTime to specify when you want a CDC operation - // to start. Specifying both values results in an error. + // either CdcStartPosition or CdcStartTime to specify when you want the CDC + // operation to start. Specifying both values results in an error. // // The value can be in date, checkpoint, or LSN/SCN format. // @@ -11790,7 +11833,7 @@ type ResourcePendingMaintenanceActions struct { // The Amazon Resource Name (ARN) of the DMS resource that the pending maintenance // action applies to. For information about creating an ARN, see Constructing - // an Amazon Resource Name (ARN) (https://docs.aws.amazon.com/dms/latest/UserGuide/USER_Tagging.html#USER_Tagging.ARN) + // an Amazon Resource Name (ARN) for AWS DMS (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Introduction.AWS.ARN.html) // in the DMS documentation. ResourceIdentifier *string `type:"string"` } @@ -11822,24 +11865,37 @@ type S3Settings struct { _ struct{} `type:"structure"` // An optional parameter to set a folder name in the S3 bucket. If provided, - // tables are created in the path ///. - // If this parameter is not specified, then the path used is //. + // tables are created in the path bucketFolder/schema_name/table_name/. If this + // parameter is not specified, then the path used is schema_name/table_name/. BucketFolder *string `type:"string"` // The name of the S3 bucket. BucketName *string `type:"string"` - // Option to write only INSERT operations to the comma-separated value (CSV) - // output files. By default, the first field in a CSV record contains the letter - // I (insert), U (update) or D (delete) to indicate whether the row was inserted, - // updated, or deleted at the source database. If cdcInsertsOnly is set to true, - // then only INSERTs are recorded in the CSV file, without the I annotation - // on each line. Valid values are TRUE and FALSE. + // A value that enables a change data capture (CDC) load to write only INSERT + // operations to .csv or columnar storage (.parquet) output files. By default + // (the false setting), the first field in a .csv or .parquet record contains + // the letter I (INSERT), U (UPDATE), or D (DELETE). These values indicate whether + // the row was inserted, updated, or deleted at the source database for a CDC + // load to the target. + // + // If cdcInsertsOnly is set to true or y, only INSERTs from the source database + // are migrated to the .csv or .parquet file. For .csv format only, how these + // INSERTs are recorded depends on the value of IncludeOpForFullLoad. If IncludeOpForFullLoad + // is set to true, the first field of every CDC record is set to I to indicate + // the INSERT operation at the source. If IncludeOpForFullLoad is set to false, + // every CDC record is written without a first field to indicate the INSERT + // operation at the source. For more information about how these settings work + // together, see Indicating Source DB Operations in Migrated S3 Data (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.S3.html#CHAP_Target.S3.Configuring.InsertOps) + // in the AWS Database Migration Service User Guide.. + // + // AWS DMS supports this interaction between CdcInsertsOnly and IncludeOpForFullLoad + // in versions 3.1.4 and later. CdcInsertsOnly *bool `type:"boolean"` // An optional parameter to use GZIP to compress the target files. Set to GZIP // to compress the target files. Set to NONE (the default) or do not use to - // leave the files uncompressed. Applies to both CSV and PARQUET data formats. + // leave the files uncompressed. Applies to both .csv and .parquet file formats. CompressionType *string `type:"string" enum:"CompressionTypeValue"` // The delimiter used to separate columns in the source files. The default is @@ -11850,47 +11906,49 @@ type S3Settings struct { // carriage return (\n). CsvRowDelimiter *string `type:"string"` - // The format of the data which you want to use for output. You can choose one + // The format of the data that you want to use for output. You can choose one // of the following: // - // * CSV : This is a row-based format with comma-separated values. + // * csv : This is a row-based file format with comma-separated values (.csv). // - // * PARQUET : Apache Parquet is a columnar storage format that features - // efficient compression and provides faster query response. + // * parquet : Apache Parquet (.parquet) is a columnar storage file format + // that features efficient compression and provides faster query response. DataFormat *string `type:"string" enum:"DataFormatValue"` - // The size of one data page in bytes. Defaults to 1024 * 1024 bytes (1MiB). - // For PARQUET format only. + // The size of one data page in bytes. This parameter defaults to 1024 * 1024 + // bytes (1 MiB). This number is used for .parquet file format only. DataPageSize *int64 `type:"integer"` // The maximum size of an encoded dictionary page of a column. If the dictionary // page exceeds this, this column is stored using an encoding type of PLAIN. - // Defaults to 1024 * 1024 bytes (1MiB), the maximum size of a dictionary page - // before it reverts to PLAIN encoding. For PARQUET format only. + // This parameter defaults to 1024 * 1024 bytes (1 MiB), the maximum size of + // a dictionary page before it reverts to PLAIN encoding. This size is used + // for .parquet file format only. DictPageSizeLimit *int64 `type:"integer"` - // Enables statistics for Parquet pages and rowGroups. Choose TRUE to enable - // statistics, choose FALSE to disable. Statistics include NULL, DISTINCT, MAX, - // and MIN values. Defaults to TRUE. For PARQUET format only. + // A value that enables statistics for Parquet pages and row groups. Choose + // true to enable statistics, false to disable. Statistics include NULL, DISTINCT, + // MAX, and MIN values. This parameter defaults to true. This value is used + // for .parquet file format only. EnableStatistics *bool `type:"boolean"` - // The type of encoding you are using: RLE_DICTIONARY (default), PLAIN, or PLAIN_DICTIONARY. + // The type of encoding you are using: // // * RLE_DICTIONARY uses a combination of bit-packing and run-length encoding - // to store repeated values more efficiently. + // to store repeated values more efficiently. This is the default. // - // * PLAIN does not use encoding at all. Values are stored as they are. + // * PLAIN doesn't use encoding at all. Values are stored as they are. // // * PLAIN_DICTIONARY builds a dictionary of the values encountered in a // given column. The dictionary is stored in a dictionary page for each column // chunk. EncodingType *string `type:"string" enum:"EncodingTypeValue"` - // The type of server side encryption you want to use for your data. This is - // part of the endpoint settings or the extra connections attributes for Amazon - // S3. You can choose either SSE_S3 (default) or SSE_KMS. To use SSE_S3, you - // need an IAM role with permission to allow "arn:aws:s3:::dms-*" to use the - // following actions: + // The type of server-side encryption that you want to use for your data. This + // encryption type is part of the endpoint settings or the extra connections + // attributes for Amazon S3. You can choose either SSE_S3 (the default) or SSE_KMS. + // To use SSE_S3, you need an AWS Identity and Access Management (IAM) role + // with permission to allow "arn:aws:s3:::dms-*" to use the following actions: // // * s3:CreateBucket // @@ -11918,28 +11976,64 @@ type S3Settings struct { // The external table definition. ExternalTableDefinition *string `type:"string"` - // The version of Apache Parquet format you want to use: PARQUET_1_0 (default) - // or PARQUET_2_0. + // A value that enables a full load to write INSERT operations to the comma-separated + // value (.csv) output files only to indicate how the rows were added to the + // source database. + // + // AWS DMS supports IncludeOpForFullLoad in versions 3.1.4 and later. + // + // For full load, records can only be inserted. By default (the false setting), + // no information is recorded in these output files for a full load to indicate + // that the rows were inserted at the source database. If IncludeOpForFullLoad + // is set to true or y, the INSERT is recorded as an I annotation in the first + // field of the .csv file. This allows the format of your target records from + // a full load to be consistent with the target records from a CDC load. + // + // This setting works together with CdcInsertsOnly for output to .csv files + // only. For more information about how these settings work together, see Indicating + // Source DB Operations in Migrated S3 Data (https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.S3.html#CHAP_Target.S3.Configuring.InsertOps) + // in the AWS Database Migration Service User Guide.. + IncludeOpForFullLoad *bool `type:"boolean"` + + // The version of the Apache Parquet format that you want to use: parquet_1_0 + // (the default) or parquet_2_0. ParquetVersion *string `type:"string" enum:"ParquetVersionValue"` // The number of rows in a row group. A smaller row group size provides faster - // reads. But as the number of row groups grows, the slower writes become. Defaults - // to 10,000 (ten thousand) rows. For PARQUET format only. + // reads. But as the number of row groups grows, the slower writes become. This + // parameter defaults to 10,000 rows. This number is used for .parquet file + // format only. // // If you choose a value larger than the maximum, RowGroupLength is set to the // max row group length in bytes (64 * 1024 * 1024). RowGroupLength *int64 `type:"integer"` - // If you are using SSE_KMS for the EncryptionMode, provide the KMS Key ID. - // The key you use needs an attached policy that enables IAM user permissions - // and allows use of the key. + // If you are using SSE_KMS for the EncryptionMode, provide the AWS KMS key + // ID. The key that you use needs an attached policy that enables AWS Identity + // and Access Management (IAM) user permissions and allows use of the key. // - // Here is a CLI example: aws dms create-endpoint --endpoint-identifier - // --endpoint-type target --engine-name s3 --s3-settings ServiceAccessRoleArn=,BucketFolder=,BucketName=,EncryptionMode=SSE_KMS,ServerSideEncryptionKmsKeyId= + // Here is a CLI example: aws dms create-endpoint --endpoint-identifier value + // --endpoint-type target --engine-name s3 --s3-settings ServiceAccessRoleArn=value,BucketFolder=value,BucketName=value,EncryptionMode=SSE_KMS,ServerSideEncryptionKmsKeyId=value ServerSideEncryptionKmsKeyId *string `type:"string"` // The Amazon Resource Name (ARN) used by the service access IAM role. ServiceAccessRoleArn *string `type:"string"` + + // A value that includes a timestamp column in the Amazon S3 target endpoint + // data. AWS DMS includes an additional column in the migrated data when you + // set timestampColumnName to a non-blank value. + // + // AWS DMS supports TimestampColumnName in versions 3.1.4 and later. + // + // For a full load, each row of the timestamp column contains a timestamp for + // when the data was transferred from the source to the target by DMS. For a + // CDC load, each row of the timestamp column contains the timestamp for the + // commit of that row in the source database. The format for the timestamp column + // value is yyyy-MM-dd HH:mm:ss.SSSSSS. For CDC, the microsecond precision depends + // on the commit timestamp supported by DMS for the source database. When the + // AddColumnName setting is set to true, DMS also includes the name for the + // timestamp column that you set as the nonblank value of timestampColumnName. + TimestampColumnName *string `type:"string"` } // String returns the string representation @@ -12030,6 +12124,12 @@ func (s *S3Settings) SetExternalTableDefinition(v string) *S3Settings { return s } +// SetIncludeOpForFullLoad sets the IncludeOpForFullLoad field's value. +func (s *S3Settings) SetIncludeOpForFullLoad(v bool) *S3Settings { + s.IncludeOpForFullLoad = &v + return s +} + // SetParquetVersion sets the ParquetVersion field's value. func (s *S3Settings) SetParquetVersion(v string) *S3Settings { s.ParquetVersion = &v @@ -12054,6 +12154,12 @@ func (s *S3Settings) SetServiceAccessRoleArn(v string) *S3Settings { return s } +// SetTimestampColumnName sets the TimestampColumnName field's value. +func (s *S3Settings) SetTimestampColumnName(v string) *S3Settings { + s.TimestampColumnName = &v + return s +} + type StartReplicationTaskAssessmentInput struct { _ struct{} `type:"structure"` @@ -12342,16 +12448,16 @@ func (s *Subnet) SetSubnetStatus(v string) *Subnet { type SupportedEndpointType struct { _ struct{} `type:"structure"` - // The type of endpoint. + // The type of endpoint. Valid values are source and target. EndpointType *string `type:"string" enum:"ReplicationEndpointTypeValue"` // The expanded name for the engine name. For example, if the EngineName parameter // is "aurora," this value would be "Amazon Aurora MySQL." EngineDisplayName *string `type:"string"` - // The database engine name. Valid values, depending on the EndPointType, include + // The database engine name. Valid values, depending on the EndpointType, include // mysql, oracle, postgres, mariadb, aurora, aurora-postgresql, redshift, s3, - // db2, azuredb, sybase, sybase, dynamodb, mongodb, and sqlserver. + // db2, azuredb, sybase, dynamodb, mongodb, and sqlserver. EngineName *string `type:"string"` // Indicates if Change Data Capture (CDC) is supported. @@ -12868,6 +12974,11 @@ const ( RefreshSchemasStatusTypeValueRefreshing = "refreshing" ) +const ( + // ReleaseStatusValuesBeta is a ReleaseStatusValues enum value + ReleaseStatusValuesBeta = "beta" +) + const ( // ReloadOptionValueDataReload is a ReloadOptionValue enum value ReloadOptionValueDataReload = "data-reload" diff --git a/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/errors.go b/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/errors.go index 9527c97f7617..35ed259eb45f 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/databasemigrationservice/errors.go @@ -39,8 +39,8 @@ const ( // ErrCodeKMSAccessDeniedFault for service response error code // "KMSAccessDeniedFault". // - // The ciphertext references a key that doesn't exist or DMS account doesn't - // have an access to + // The ciphertext references a key that doesn't exist or that the DMS account + // doesn't have access to. ErrCodeKMSAccessDeniedFault = "KMSAccessDeniedFault" // ErrCodeKMSDisabledFault for service response error code @@ -52,25 +52,25 @@ const ( // ErrCodeKMSInvalidStateFault for service response error code // "KMSInvalidStateFault". // - // The state of the specified KMS resource isn't valid for this request. + // The state of the specified AWS KMS resource isn't valid for this request. ErrCodeKMSInvalidStateFault = "KMSInvalidStateFault" // ErrCodeKMSKeyNotAccessibleFault for service response error code // "KMSKeyNotAccessibleFault". // - // AWS DMS cannot access the KMS key. + // AWS DMS cannot access the AWS KMS key. ErrCodeKMSKeyNotAccessibleFault = "KMSKeyNotAccessibleFault" // ErrCodeKMSNotFoundFault for service response error code // "KMSNotFoundFault". // - // The specified KMS entity or resource can't be found. + // The specified AWS KMS entity or resource can't be found. ErrCodeKMSNotFoundFault = "KMSNotFoundFault" // ErrCodeKMSThrottlingFault for service response error code // "KMSThrottlingFault". // - // This request triggered KMS request throttling. + // This request triggered AWS KMS request throttling. ErrCodeKMSThrottlingFault = "KMSThrottlingFault" // ErrCodeReplicationSubnetGroupDoesNotCoverEnoughAZs for service response error code diff --git a/vendor/github.com/aws/aws-sdk-go/service/kafka/api.go b/vendor/github.com/aws/aws-sdk-go/service/kafka/api.go index bef73a71c736..28b8752e5dd6 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/kafka/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/kafka/api.go @@ -2683,7 +2683,7 @@ type CreateClusterInput struct { // KafkaVersion is a required field KafkaVersion *string `locationName:"kafkaVersion" min:"1" type:"string" required:"true"` - // The number of Kafka broker nodes in the Amazon MSK cluster. + // The number of broker nodes in the cluster. // // NumberOfBrokerNodes is a required field NumberOfBrokerNodes *int64 `locationName:"numberOfBrokerNodes" min:"1" type:"integer" required:"true"` diff --git a/vendor/modules.txt b/vendor/modules.txt index 406b618975da..03aaeeb018df 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -21,7 +21,7 @@ github.com/apparentlymart/go-cidr/cidr github.com/apparentlymart/go-textseg/textseg # github.com/armon/go-radix v1.0.0 github.com/armon/go-radix -# github.com/aws/aws-sdk-go v1.20.20 +# github.com/aws/aws-sdk-go v1.20.21 github.com/aws/aws-sdk-go/aws github.com/aws/aws-sdk-go/aws/arn github.com/aws/aws-sdk-go/aws/awserr From b68a26ea1b17013cd8e0291857f8e8db9368bc6a Mon Sep 17 00:00:00 2001 From: Rob H Date: Wed, 17 Jul 2019 21:22:57 +0100 Subject: [PATCH 0260/1054] Removed ID from schemea & changed test --- aws/data_source_aws_waf_web_acl.go | 4 --- aws/data_source_aws_waf_web_acl_test.go | 34 +++---------------------- 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/aws/data_source_aws_waf_web_acl.go b/aws/data_source_aws_waf_web_acl.go index f99513cc3120..d9536433fb19 100644 --- a/aws/data_source_aws_waf_web_acl.go +++ b/aws/data_source_aws_waf_web_acl.go @@ -16,10 +16,6 @@ func dataSourceAwsWafWebAcl() *schema.Resource { Type: schema.TypeString, Required: true, }, - "id": { - Type: schema.TypeString, - Computed: true, - }, }, } } diff --git a/aws/data_source_aws_waf_web_acl_test.go b/aws/data_source_aws_waf_web_acl_test.go index 0fa0f978cc7e..961d792bc8bc 100644 --- a/aws/data_source_aws_waf_web_acl_test.go +++ b/aws/data_source_aws_waf_web_acl_test.go @@ -2,6 +2,7 @@ package aws import ( "fmt" + "github.com/hashicorp/terraform/helper/acctest" "regexp" "testing" @@ -9,7 +10,7 @@ import ( ) func TestAccDataSourceAwsWafWebAcl_Basic(t *testing.T) { - name := "tf-acc-test" + name := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_waf_web_acl.web_acl" datasourceName := "data.aws_waf_web_acl.web_acl" @@ -34,47 +35,20 @@ func TestAccDataSourceAwsWafWebAcl_Basic(t *testing.T) { func testAccDataSourceAwsWafWebAclConfig_Name(name string) string { return fmt.Sprintf(` -resource "aws_waf_rule" "wafrule" { - name = "%s" - metric_name = "WafruleTest" - predicates { - data_id = "${aws_waf_ipset.test.id}" - negated = false - type = "IPMatch" - } -} -resource "aws_waf_ipset" "test" { - name = "%s" - ip_set_descriptors { - type = "IPV4" - value = "10.0.0.0/8" - } -} - resource "aws_waf_web_acl" "web_acl" { - name = "%s" + name = "%[1]q" metric_name = "tfWebACL" default_action { type = "ALLOW" } - - rules { - action { - type = "BLOCK" - } - - priority = 1 - rule_id = "${aws_waf_rule.wafrule.id}" - type = "REGULAR" - } } data "aws_waf_web_acl" "web_acl" { name = "${aws_waf_web_acl.web_acl.name}" } -`, name, name, name) +`, name) } const testAccDataSourceAwsWafWebAclConfig_NonExistent = ` From cabf7234a85ce53d90c5ae6a4d076600effe561c Mon Sep 17 00:00:00 2001 From: Rob H Date: Wed, 17 Jul 2019 21:26:24 +0100 Subject: [PATCH 0261/1054] Removed quotes from name attribute in test --- aws/data_source_aws_waf_web_acl_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/data_source_aws_waf_web_acl_test.go b/aws/data_source_aws_waf_web_acl_test.go index 961d792bc8bc..697e8ebfb5cf 100644 --- a/aws/data_source_aws_waf_web_acl_test.go +++ b/aws/data_source_aws_waf_web_acl_test.go @@ -36,7 +36,7 @@ func TestAccDataSourceAwsWafWebAcl_Basic(t *testing.T) { func testAccDataSourceAwsWafWebAclConfig_Name(name string) string { return fmt.Sprintf(` resource "aws_waf_web_acl" "web_acl" { - name = "%[1]q" + name = %[1]q metric_name = "tfWebACL" default_action { From 1ef746d2b0458029e77fb9373944ac59e321bb75 Mon Sep 17 00:00:00 2001 From: Rob H Date: Wed, 17 Jul 2019 21:36:42 +0100 Subject: [PATCH 0262/1054] Changed tests and removed ID from schema --- aws/data_source_aws_waf_rule.go | 4 ---- aws/data_source_aws_waf_rule_test.go | 22 ++++------------------ 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/aws/data_source_aws_waf_rule.go b/aws/data_source_aws_waf_rule.go index fcdd0f14af9f..8ab7a2658f6b 100644 --- a/aws/data_source_aws_waf_rule.go +++ b/aws/data_source_aws_waf_rule.go @@ -16,10 +16,6 @@ func dataSourceAwsWafRule() *schema.Resource { Type: schema.TypeString, Required: true, }, - "id": { - Type: schema.TypeString, - Computed: true, - }, }, } } diff --git a/aws/data_source_aws_waf_rule_test.go b/aws/data_source_aws_waf_rule_test.go index 8b10265276e3..7b0b0448829f 100644 --- a/aws/data_source_aws_waf_rule_test.go +++ b/aws/data_source_aws_waf_rule_test.go @@ -2,6 +2,7 @@ package aws import ( "fmt" + "github.com/hashicorp/terraform/helper/acctest" "regexp" "testing" @@ -9,7 +10,7 @@ import ( ) func TestAccDataSourceAwsWafRule_Basic(t *testing.T) { - name := "tf-acc-test" + name := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_waf_rule.wafrule" datasourceName := "data.aws_waf_rule.wafrule" @@ -35,29 +36,14 @@ func TestAccDataSourceAwsWafRule_Basic(t *testing.T) { func testAccDataSourceAwsWafRuleConfig_Name(name string) string { return fmt.Sprintf(` resource "aws_waf_rule" "wafrule" { - name = "%s" + name = %[1]q metric_name = "WafruleTest" - - predicates { - data_id = "${aws_waf_ipset.test.id}" - negated = false - type = "IPMatch" - } -} - -resource "aws_waf_ipset" "test" { - name = "%s" - - ip_set_descriptors { - type = "IPV4" - value = "10.0.0.0/8" - } } data "aws_waf_rule" "wafrule" { name = "${aws_waf_rule.wafrule.name}" } -`, name, name) +`, name) } const testAccDataSourceAwsWafRuleConfig_NonExistent = ` From 5f2f529cc26d35cdb8ab9e61d19a6c32c840b7b2 Mon Sep 17 00:00:00 2001 From: Rob H Date: Wed, 17 Jul 2019 21:46:30 +0100 Subject: [PATCH 0263/1054] Changed tests and removed ID from schema --- aws/data_source_aws_wafregional_rule.go | 4 ---- aws/data_source_aws_wafregional_rule_test.go | 22 ++++---------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/aws/data_source_aws_wafregional_rule.go b/aws/data_source_aws_wafregional_rule.go index 4e3cb4e1fa08..5cb47605aec0 100644 --- a/aws/data_source_aws_wafregional_rule.go +++ b/aws/data_source_aws_wafregional_rule.go @@ -17,10 +17,6 @@ func dataSourceAwsWafRegionalRule() *schema.Resource { Type: schema.TypeString, Required: true, }, - "id": { - Type: schema.TypeString, - Computed: true, - }, }, } } diff --git a/aws/data_source_aws_wafregional_rule_test.go b/aws/data_source_aws_wafregional_rule_test.go index 83fadd17b159..4427a0bba460 100644 --- a/aws/data_source_aws_wafregional_rule_test.go +++ b/aws/data_source_aws_wafregional_rule_test.go @@ -2,6 +2,7 @@ package aws import ( "fmt" + "github.com/hashicorp/terraform/helper/acctest" "regexp" "testing" @@ -9,7 +10,7 @@ import ( ) func TestAccDataSourceAwsWafRegionalRule_Basic(t *testing.T) { - name := "tf-acc-test" + name := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_wafregional_rule.wafrule" datasourceName := "data.aws_wafregional_rule.wafrule" @@ -35,29 +36,14 @@ func TestAccDataSourceAwsWafRegionalRule_Basic(t *testing.T) { func testAccDataSourceAwsWafRegionalRuleConfig_Name(name string) string { return fmt.Sprintf(` resource "aws_wafregional_rule" "wafrule" { - name = "%s" + name = %[1]q metric_name = "WafruleTest" - - predicate { - data_id = "${aws_wafregional_ipset.test.id}" - negated = false - type = "IPMatch" - } -} - -resource "aws_wafregional_ipset" "test" { - name = "%s" - - ip_set_descriptor { - type = "IPV4" - value = "10.0.0.0/8" - } } data "aws_wafregional_rule" "wafrule" { name = "${aws_wafregional_rule.wafrule.name}" } -`, name, name) +`, name) } const testAccDataSourceAwsWafRegionalRuleConfig_NonExistent = ` From dc3f3f8acbb61da1b004132bb3d9a1e23167960c Mon Sep 17 00:00:00 2001 From: Miles Budnek Date: Wed, 17 Jul 2019 18:25:45 -0400 Subject: [PATCH 0264/1054] Send all attributes when updating a cognito_identity_pool resource The UpdateIdentityPool API expects all attributes to be present. It treats missing attributes as a request to remove those attributes from the identity pool. --- aws/resource_aws_cognito_identity_pool.go | 20 +++--- ...resource_aws_cognito_identity_pool_test.go | 61 +++++++++++++++++++ 2 files changed, 71 insertions(+), 10 deletions(-) diff --git a/aws/resource_aws_cognito_identity_pool.go b/aws/resource_aws_cognito_identity_pool.go index bc043d111c95..f863f51e5e7f 100644 --- a/aws/resource_aws_cognito_identity_pool.go +++ b/aws/resource_aws_cognito_identity_pool.go @@ -198,24 +198,24 @@ func resourceAwsCognitoIdentityPoolUpdate(d *schema.ResourceData, meta interface IdentityPoolName: aws.String(d.Get("identity_pool_name").(string)), } - if d.HasChange("developer_provider_name") { - params.DeveloperProviderName = aws.String(d.Get("developer_provider_name").(string)) + if v, ok := d.GetOk("developer_provider_name"); ok { + params.DeveloperProviderName = aws.String(v.(string)) } - if d.HasChange("cognito_identity_providers") { - params.CognitoIdentityProviders = expandCognitoIdentityProviders(d.Get("cognito_identity_providers").(*schema.Set)) + if v, ok := d.GetOk("cognito_identity_providers"); ok { + params.CognitoIdentityProviders = expandCognitoIdentityProviders(v.(*schema.Set)) } - if d.HasChange("supported_login_providers") { - params.SupportedLoginProviders = expandCognitoSupportedLoginProviders(d.Get("supported_login_providers").(map[string]interface{})) + if v, ok := d.GetOk("supported_login_providers"); ok { + params.SupportedLoginProviders = expandCognitoSupportedLoginProviders(v.(map[string]interface{})) } - if d.HasChange("openid_connect_provider_arns") { - params.OpenIdConnectProviderARNs = expandStringList(d.Get("openid_connect_provider_arns").([]interface{})) + if v, ok := d.GetOk("openid_connect_provider_arns"); ok { + params.OpenIdConnectProviderARNs = expandStringList(v.([]interface{})) } - if d.HasChange("saml_provider_arns") { - params.SamlProviderARNs = expandStringList(d.Get("saml_provider_arns").([]interface{})) + if v, ok := d.GetOk("saml_provider_arns"); ok { + params.SamlProviderARNs = expandStringList(v.([]interface{})) } _, err := conn.UpdateIdentityPool(params) diff --git a/aws/resource_aws_cognito_identity_pool_test.go b/aws/resource_aws_cognito_identity_pool_test.go index b5bdd88c7c25..3df1de9bc8dc 100644 --- a/aws/resource_aws_cognito_identity_pool_test.go +++ b/aws/resource_aws_cognito_identity_pool_test.go @@ -215,6 +215,44 @@ func TestAccAWSCognitoIdentityPool_cognitoIdentityProviders(t *testing.T) { }) } +func TestAccAWSCognitoIdentityPool_addingNewProviderKeepsOldProvider(t *testing.T) { + name := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentity(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSCognitoIdentityPoolDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSCognitoIdentityPoolConfig_cognitoIdentityProviders(name), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"), + resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)), + resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "cognito_identity_providers.#", "2"), + ), + }, + { + Config: testAccAWSCognitoIdentityPoolConfig_cognitoIdentityProvidersAndOpenidConnectProviderArns(name), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"), + resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)), + resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "cognito_identity_providers.#", "2"), + resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "openid_connect_provider_arns.#", "1"), + ), + }, + { + Config: testAccAWSCognitoIdentityPoolConfig_basic(name), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSCognitoIdentityPoolExists("aws_cognito_identity_pool.main"), + resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "identity_pool_name", fmt.Sprintf("identity pool %s", name)), + resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "cognito_identity_providers.#", "0"), + resource.TestCheckResourceAttr("aws_cognito_identity_pool.main", "openid_connect_provider_arns.#", "0"), + ), + }, + }, + }) +} + func testAccCheckAWSCognitoIdentityPoolExists(n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -408,3 +446,26 @@ resource "aws_cognito_identity_pool" "main" { } `, name) } + +func testAccAWSCognitoIdentityPoolConfig_cognitoIdentityProvidersAndOpenidConnectProviderArns(name string) string { + return fmt.Sprintf(` +resource "aws_cognito_identity_pool" "main" { + identity_pool_name = "identity pool %s" + allow_unauthenticated_identities = false + + cognito_identity_providers { + client_id = "7lhlkkfbfb4q5kpp90urffao" + provider_name = "cognito-idp.us-east-1.amazonaws.com/us-east-1_Ab129faBb" + server_side_token_check = false + } + + cognito_identity_providers { + client_id = "7lhlkkfbfb4q5kpp90urffao" + provider_name = "cognito-idp.us-east-1.amazonaws.com/us-east-1_Zr231apJu" + server_side_token_check = false + } + + openid_connect_provider_arns = ["arn:aws:iam::123456789012:oidc-provider/server.example.com"] +} +`, name) +} From 09b4a71b2406482ad4a38cdf637ef081bd915366 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 17 Jul 2019 18:55:12 -0400 Subject: [PATCH 0265/1054] resource/aws_elasticsearch_domain: Finish implementation for ZoneAwarenessConfig Output from acceptance testing: ``` --- PASS: TestAccAWSElasticSearchDomain_ClusterConfig_ZoneAwarenessConfig (5351.81s) ``` --- aws/resource_aws_elasticsearch_domain.go | 18 +++- aws/resource_aws_elasticsearch_domain_test.go | 94 ++++++++++++------- aws/structure.go | 43 +++++++-- .../docs/r/elasticsearch_domain.html.markdown | 7 +- 4 files changed, 115 insertions(+), 47 deletions(-) diff --git a/aws/resource_aws_elasticsearch_domain.go b/aws/resource_aws_elasticsearch_domain.go index 0acc238bd33b..80343ede4527 100644 --- a/aws/resource_aws_elasticsearch_domain.go +++ b/aws/resource_aws_elasticsearch_domain.go @@ -190,12 +190,22 @@ func resourceAwsElasticSearchDomain() *schema.Resource { Optional: true, Default: "m3.medium.elasticsearch", }, - "zone_awareness_enabled": { - Type: schema.TypeBool, + "zone_awareness_config": { + Type: schema.TypeList, Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "availability_zone_count": { + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.IntInSlice([]int{2, 3}), + }, + }, + }, }, - "zone_awareness_count": { - Type: schema.TypeInt, + "zone_awareness_enabled": { + Type: schema.TypeBool, Optional: true, }, }, diff --git a/aws/resource_aws_elasticsearch_domain_test.go b/aws/resource_aws_elasticsearch_domain_test.go index 1ac45d2666b7..48942a83ac6e 100644 --- a/aws/resource_aws_elasticsearch_domain_test.go +++ b/aws/resource_aws_elasticsearch_domain_test.go @@ -77,9 +77,10 @@ func TestAccAWSElasticSearchDomain_basic(t *testing.T) { }) } -func TestAccAWSElasticSearchDomain_ZoneAwareness(t *testing.T) { - var domain elasticsearch.ElasticsearchDomainStatus - ri := acctest.RandInt() +func TestAccAWSElasticSearchDomain_ClusterConfig_ZoneAwarenessConfig(t *testing.T) { + var domain1, domain2, domain3, domain4 elasticsearch.ElasticsearchDomainStatus + rName := acctest.RandomWithPrefix("tf-acc-test")[:28] + resourceName := "aws_elasticsearch_domain.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -87,43 +88,46 @@ func TestAccAWSElasticSearchDomain_ZoneAwareness(t *testing.T) { CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ { - Config: testAccESDomainConfig_ZoneAwareness(ri, 3, false), + Config: testAccESDomainConfig_ClusterConfig_ZoneAwarenessConfig_AvailabilityZoneCount(rName, 3), Check: resource.ComposeTestCheckFunc( - testAccCheckESDomainExists("aws_elasticsearch_domain.example", &domain), - resource.TestCheckResourceAttr("aws_elasticsearch_domain.example", "cluster_config.0.zone_awareness_enabled", "false"), - resource.TestCheckResourceAttr("aws_elasticsearch_domain.example", "cluster_config.0.zone_awareness_count", "3"), + testAccCheckESDomainExists(resourceName, &domain1), + resource.TestCheckResourceAttr(resourceName, "cluster_config.0.zone_awareness_config.#", "1"), + resource.TestCheckResourceAttr(resourceName, "cluster_config.0.zone_awareness_config.0.availability_zone_count", "3"), + resource.TestCheckResourceAttr(resourceName, "cluster_config.0.zone_awareness_enabled", "true"), ), }, { - Config: testAccESDomainConfig_ZoneAwareness(ri, 3, true), - Check: resource.ComposeTestCheckFunc( - testAccCheckESDomainExists("aws_elasticsearch_domain.example", &domain), - resource.TestCheckResourceAttr("aws_elasticsearch_domain.example", "cluster_config.0.zone_awareness_enabled", "true"), - resource.TestCheckResourceAttr("aws_elasticsearch_domain.example", "cluster_config.0.zone_awareness_count", "3"), - ), + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, }, { - Config: testAccESDomainConfig_ZoneAwareness(ri, 3, false), + Config: testAccESDomainConfig_ClusterConfig_ZoneAwarenessConfig_AvailabilityZoneCount(rName, 2), Check: resource.ComposeTestCheckFunc( - testAccCheckESDomainExists("aws_elasticsearch_domain.example", &domain), - resource.TestCheckResourceAttr("aws_elasticsearch_domain.example", "cluster_config.0.zone_awareness_enabled", "false"), - resource.TestCheckResourceAttr("aws_elasticsearch_domain.example", "cluster_config.0.zone_awareness_count", "3"), + testAccCheckESDomainExists(resourceName, &domain2), + testAccCheckAWSESDomainNotRecreated(&domain1, &domain2), + resource.TestCheckResourceAttr(resourceName, "cluster_config.0.zone_awareness_config.#", "1"), + resource.TestCheckResourceAttr(resourceName, "cluster_config.0.zone_awareness_config.0.availability_zone_count", "2"), + resource.TestCheckResourceAttr(resourceName, "cluster_config.0.zone_awareness_enabled", "true"), ), }, { - Config: testAccESDomainConfig_ZoneAwareness(ri, 2, true), + Config: testAccESDomainConfig_ClusterConfig_ZoneAwarenessEnabled(rName, false), Check: resource.ComposeTestCheckFunc( - testAccCheckESDomainExists("aws_elasticsearch_domain.example", &domain), - resource.TestCheckResourceAttr("aws_elasticsearch_domain.example", "cluster_config.0.zone_awareness_enabled", "true"), - resource.TestCheckResourceAttr("aws_elasticsearch_domain.example", "cluster_config.0.zone_awareness_count", "2"), + testAccCheckESDomainExists(resourceName, &domain3), + testAccCheckAWSESDomainNotRecreated(&domain2, &domain3), + resource.TestCheckResourceAttr(resourceName, "cluster_config.0.zone_awareness_enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "cluster_config.0.zone_awareness_config.#", "0"), ), }, { - Config: testAccESDomainConfig_ZoneAwareness(ri, 3, true), + Config: testAccESDomainConfig_ClusterConfig_ZoneAwarenessConfig_AvailabilityZoneCount(rName, 3), Check: resource.ComposeTestCheckFunc( - testAccCheckESDomainExists("aws_elasticsearch_domain.example", &domain), - resource.TestCheckResourceAttr("aws_elasticsearch_domain.example", "cluster_config.0.zone_awareness_enabled", "true"), - resource.TestCheckResourceAttr("aws_elasticsearch_domain.example", "cluster_config.0.zone_awareness_count", "3"), + testAccCheckESDomainExists(resourceName, &domain4), + testAccCheckAWSESDomainNotRecreated(&domain3, &domain4), + resource.TestCheckResourceAttr(resourceName, "cluster_config.0.zone_awareness_config.#", "1"), + resource.TestCheckResourceAttr(resourceName, "cluster_config.0.zone_awareness_config.0.availability_zone_count", "3"), + resource.TestCheckResourceAttr(resourceName, "cluster_config.0.zone_awareness_enabled", "true"), ), }, }, @@ -802,24 +806,46 @@ resource "aws_elasticsearch_domain" "example" { `, randInt) } -func testAccESDomainConfig_ZoneAwareness(randInt int, azcount int, enabled bool) string { +func testAccESDomainConfig_ClusterConfig_ZoneAwarenessConfig_AvailabilityZoneCount(rName string, availabilityZoneCount int) string { return fmt.Sprintf(` -resource "aws_elasticsearch_domain" "example" { - domain_name = "tf-test-%d" +resource "aws_elasticsearch_domain" "test" { + domain_name = %[1]q + + cluster_config { + instance_type = "t2.micro.elasticsearch" + instance_count = 6 + zone_awareness_enabled = true + + zone_awareness_config { + availability_zone_count = %[2]d + } + } ebs_options { ebs_enabled = true volume_size = 10 } - +} +`, rName, availabilityZoneCount) +} + +func testAccESDomainConfig_ClusterConfig_ZoneAwarenessEnabled(rName string, zoneAwarenessEnabled bool) string { + return fmt.Sprintf(` +resource "aws_elasticsearch_domain" "test" { + domain_name = %[1]q + cluster_config { - instance_type = "t2.micro.elasticsearch" - instance_count = "6" - zone_awareness_enabled = %t - zone_awareness_count = "%d" + instance_type = "t2.micro.elasticsearch" + instance_count = 6 + zone_awareness_enabled = %[2]t + } + + ebs_options { + ebs_enabled = true + volume_size = 10 } } -`, randInt, enabled, azcount) +`, rName, zoneAwarenessEnabled) } func testAccESDomainConfig_WithDedicatedClusterMaster(randInt int, enabled bool) string { diff --git a/aws/structure.go b/aws/structure.go index 7b1549974261..2629437faa35 100644 --- a/aws/structure.go +++ b/aws/structure.go @@ -1205,9 +1205,10 @@ func expandESClusterConfig(m map[string]interface{}) *elasticsearch.Elasticsearc if v, ok := m["zone_awareness_enabled"]; ok { isEnabled := v.(bool) config.ZoneAwarenessEnabled = aws.Bool(isEnabled) + if isEnabled { - if v, ok := m["zone_awareness_count"]; ok { - config.ZoneAwarenessConfig = &elasticsearch.ZoneAwarenessConfig{AvailabilityZoneCount: aws.Int64(int64(v.(int)))} + if v, ok := m["zone_awareness_config"]; ok { + config.ZoneAwarenessConfig = expandElasticsearchZoneAwarenessConfig(v.([]interface{})) } } } @@ -1215,8 +1216,27 @@ func expandESClusterConfig(m map[string]interface{}) *elasticsearch.Elasticsearc return &config } +func expandElasticsearchZoneAwarenessConfig(l []interface{}) *elasticsearch.ZoneAwarenessConfig { + if len(l) == 0 || l[0] == nil { + return nil + } + + m := l[0].(map[string]interface{}) + + zoneAwarenessConfig := &elasticsearch.ZoneAwarenessConfig{} + + if v, ok := m["availability_zone_count"]; ok && v.(int) > 0 { + zoneAwarenessConfig.AvailabilityZoneCount = aws.Int64(int64(v.(int))) + } + + return zoneAwarenessConfig +} + func flattenESClusterConfig(c *elasticsearch.ElasticsearchClusterConfig) []map[string]interface{} { - m := map[string]interface{}{} + m := map[string]interface{}{ + "zone_awareness_config": flattenElasticsearchZoneAwarenessConfig(c.ZoneAwarenessConfig), + "zone_awareness_enabled": aws.BoolValue(c.ZoneAwarenessEnabled), + } if c.DedicatedMasterCount != nil { m["dedicated_master_count"] = *c.DedicatedMasterCount @@ -1233,13 +1253,20 @@ func flattenESClusterConfig(c *elasticsearch.ElasticsearchClusterConfig) []map[s if c.InstanceType != nil { m["instance_type"] = *c.InstanceType } - if c.ZoneAwarenessEnabled != nil { - m["zone_awareness_enabled"] = *c.ZoneAwarenessEnabled + + return []map[string]interface{}{m} +} + +func flattenElasticsearchZoneAwarenessConfig(zoneAwarenessConfig *elasticsearch.ZoneAwarenessConfig) []interface{} { + if zoneAwarenessConfig == nil { + return []interface{}{} } - if c.ZoneAwarenessConfig != nil && c.ZoneAwarenessConfig.AvailabilityZoneCount != nil { - m["zone_awareness_count"] = *c.ZoneAwarenessConfig.AvailabilityZoneCount + + m := map[string]interface{}{ + "availability_zone_count": aws.Int64Value(zoneAwarenessConfig.AvailabilityZoneCount), } - return []map[string]interface{}{m} + + return []interface{}{m} } func expandESCognitoOptions(c []interface{}) *elasticsearch.CognitoOptions { diff --git a/website/docs/r/elasticsearch_domain.html.markdown b/website/docs/r/elasticsearch_domain.html.markdown index c3b376908ac8..95217d031614 100644 --- a/website/docs/r/elasticsearch_domain.html.markdown +++ b/website/docs/r/elasticsearch_domain.html.markdown @@ -247,7 +247,12 @@ The following arguments are supported: * `dedicated_master_enabled` - (Optional) Indicates whether dedicated master nodes are enabled for the cluster. * `dedicated_master_type` - (Optional) Instance type of the dedicated master nodes in the cluster. * `dedicated_master_count` - (Optional) Number of dedicated master nodes in the cluster -* `zone_awareness_enabled` - (Optional) Indicates whether zone awareness is enabled. +* `zone_awareness_config` - (Optional) Configuration block containing zone awareness settings. Documented below. +* `zone_awareness_enabled` - (Optional) Indicates whether zone awareness is enabled. To enable awareness with three Availability Zones, the `availability_zone_count` within the `zone_awareness_config` must be set to `3`. + +**zone_awareness_config** supports the following attributes: + +* `availability_zone_count` - (Required) Number of Availability Zones for the domain to use when `zone_awareness_config` is enabled. Valid values: `2` or `3`. **node_to_node_encryption** supports the following attributes: From 0446bf09f382eda096290c7fe7f351cf85fa8bcc Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 17 Jul 2019 19:50:09 -0400 Subject: [PATCH 0266/1054] Update CHANGELOG for #9396 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35014d1c15cd..4d4292b59a6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ BUG FIXES: * resource/aws_cloudwatch_event_rule: Retry error handling when creating and updating event rules [GH-9065] * resource/aws_cloudwatch_log_destination: Clean up error handling when putting log destination [GH-9065] * resource/aws_cloudwatch_log_subscription_filter: Clean up error handling when creating log subscription filter [GH-9065] +* resource/aws_cognito_identity_provider: Properly pass all attributes during update [GH-9396] * resource/aws_ssm_maintenance_window_task: Bypass `DoesNotExistException` error on deletion [GH-7823] ## 2.19.0 (July 11, 2019) From c13a1ab639695f7dbdb924f3ff79730cd87887cc Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 17 Jul 2019 20:00:43 -0400 Subject: [PATCH 0267/1054] resource/aws_elasticsearch_domain: Set availability_zone_count Default to 2 to match API --- aws/resource_aws_elasticsearch_domain.go | 10 ++++++---- website/docs/r/elasticsearch_domain.html.markdown | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/aws/resource_aws_elasticsearch_domain.go b/aws/resource_aws_elasticsearch_domain.go index 80343ede4527..3c11c779e956 100644 --- a/aws/resource_aws_elasticsearch_domain.go +++ b/aws/resource_aws_elasticsearch_domain.go @@ -191,14 +191,16 @@ func resourceAwsElasticSearchDomain() *schema.Resource { Default: "m3.medium.elasticsearch", }, "zone_awareness_config": { - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + DiffSuppressFunc: suppressMissingOptionalConfigurationBlock, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "availability_zone_count": { Type: schema.TypeInt, - Required: true, + Optional: true, + Default: 2, ValidateFunc: validation.IntInSlice([]int{2, 3}), }, }, diff --git a/website/docs/r/elasticsearch_domain.html.markdown b/website/docs/r/elasticsearch_domain.html.markdown index 95217d031614..d77c6f8bf0be 100644 --- a/website/docs/r/elasticsearch_domain.html.markdown +++ b/website/docs/r/elasticsearch_domain.html.markdown @@ -252,7 +252,7 @@ The following arguments are supported: **zone_awareness_config** supports the following attributes: -* `availability_zone_count` - (Required) Number of Availability Zones for the domain to use when `zone_awareness_config` is enabled. Valid values: `2` or `3`. +* `availability_zone_count` - (Optional) Number of Availability Zones for the domain to use with `zone_awareness_enabled`. Defaults to `2`. Valid values: `2` or `3`. **node_to_node_encryption** supports the following attributes: From 663321782576dcaf4b3b6307c3a33e1e8137df03 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 17 Jul 2019 21:41:16 -0400 Subject: [PATCH 0268/1054] Update CHANGELOG for #9379 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d4292b59a6b..2d9bde6f4edc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ ENHANCEMENTS: * resource/aws_api_gateway_domain_name: Add `security_policy` argument [GH-9128] * resource/aws_autoscaling_lifecycle_hook: Support resource import [GH-9336] * resource/aws_emr_cluster: Add `master_instance_group` configuration block `instance_count` argument (support multiple master nodes) [GH-9235] +* resource/aws_media_store_container: Add `tags` argument [GH-9379] * resource/aws_ssm_maintenance_window_task: Support resource import and in-place updates [GH-7823] * resource/aws_ssm_maintenance_window_task: Add `task_invocation_parameters` configuration block and deprecate `logging_info` and `task_parameters` configuration blockss to match API [GH-7823] From 135254eeffb0f280914a8c11c983483a27634637 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 17 Jul 2019 22:02:10 -0400 Subject: [PATCH 0269/1054] tests/resource/aws_elasticsearch_domain: Add ImportStateId for ZoneAwarenessConfig import testing The resource ID is an ARN and when used during import, returns an error that cannot be parsed by the AWS Go SDK: ``` --- FAIL: TestAccAWSElasticSearchDomain_ClusterConfig_ZoneAwarenessConfig (1020.88s) testing.go:568: Step 1 error: SerializationError: failed to unmarshal response error status code: 400, request id: caused by: UnmarshalError: error message missing ``` Instead, set the import test ID to the match domain name. --- aws/resource_aws_elasticsearch_domain_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/aws/resource_aws_elasticsearch_domain_test.go b/aws/resource_aws_elasticsearch_domain_test.go index 48942a83ac6e..c177326735b5 100644 --- a/aws/resource_aws_elasticsearch_domain_test.go +++ b/aws/resource_aws_elasticsearch_domain_test.go @@ -99,6 +99,7 @@ func TestAccAWSElasticSearchDomain_ClusterConfig_ZoneAwarenessConfig(t *testing. { ResourceName: resourceName, ImportState: true, + ImportStateId: rName, ImportStateVerify: true, }, { From aeaa1440b220e00c182082e64dfd33f44c5ab5ab Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Thu, 18 Jul 2019 00:36:16 -0400 Subject: [PATCH 0270/1054] Update CHANGELOG for #9374 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d9bde6f4edc..b2e8cbf1f967 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ ENHANCEMENTS: * resource/aws_autoscaling_lifecycle_hook: Support resource import [GH-9336] * resource/aws_emr_cluster: Add `master_instance_group` configuration block `instance_count` argument (support multiple master nodes) [GH-9235] * resource/aws_media_store_container: Add `tags` argument [GH-9379] +* resource/aws_rds_cluster: Support `scaling_configuration` configuration block `timeout_action` argument [GH-9374] * resource/aws_ssm_maintenance_window_task: Support resource import and in-place updates [GH-7823] * resource/aws_ssm_maintenance_window_task: Add `task_invocation_parameters` configuration block and deprecate `logging_info` and `task_parameters` configuration blockss to match API [GH-7823] From 46fceb85cd548a4db03f81f2e39465e65ad48134 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Thu, 18 Jul 2019 00:50:20 -0400 Subject: [PATCH 0271/1054] Update CHANGELOG for #7544 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2e8cbf1f967..9ee21c94dc0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ ENHANCEMENTS: * resource/aws_emr_cluster: Add `master_instance_group` configuration block `instance_count` argument (support multiple master nodes) [GH-9235] * resource/aws_media_store_container: Add `tags` argument [GH-9379] * resource/aws_rds_cluster: Support `scaling_configuration` configuration block `timeout_action` argument [GH-9374] +* resource/aws_s3_bucket_object: Allow empty object [GH-7544] * resource/aws_ssm_maintenance_window_task: Support resource import and in-place updates [GH-7823] * resource/aws_ssm_maintenance_window_task: Add `task_invocation_parameters` configuration block and deprecate `logging_info` and `task_parameters` configuration blockss to match API [GH-7823] From ee54c16972dea43104f1ce3759c40043c5cb069d Mon Sep 17 00:00:00 2001 From: kterada0509 Date: Sat, 6 Apr 2019 22:20:52 +0900 Subject: [PATCH 0272/1054] Add aws_quicksight_group resource --- aws/provider.go | 1 + aws/resource_aws_quicksight_group.go | 187 ++++++++++++++ aws/resource_aws_quicksight_group_test.go | 235 ++++++++++++++++++ website/aws.erb | 9 + website/docs/r/quicksight_group.html.markdown | 42 ++++ 5 files changed, 474 insertions(+) create mode 100644 aws/resource_aws_quicksight_group.go create mode 100644 aws/resource_aws_quicksight_group_test.go create mode 100644 website/docs/r/quicksight_group.html.markdown diff --git a/aws/provider.go b/aws/provider.go index 16cab81d82a6..4868e6a50bef 100644 --- a/aws/provider.go +++ b/aws/provider.go @@ -616,6 +616,7 @@ func Provider() terraform.ResourceProvider { "aws_organizations_organizational_unit": resourceAwsOrganizationsOrganizationalUnit(), "aws_placement_group": resourceAwsPlacementGroup(), "aws_proxy_protocol_policy": resourceAwsProxyProtocolPolicy(), + "aws_quicksight_group": resourceAwsQuickSightGroup(), "aws_ram_principal_association": resourceAwsRamPrincipalAssociation(), "aws_ram_resource_association": resourceAwsRamResourceAssociation(), "aws_ram_resource_share": resourceAwsRamResourceShare(), diff --git a/aws/resource_aws_quicksight_group.go b/aws/resource_aws_quicksight_group.go new file mode 100644 index 000000000000..d9f394c29b0a --- /dev/null +++ b/aws/resource_aws_quicksight_group.go @@ -0,0 +1,187 @@ +package aws + +import ( + "fmt" + "log" + "strings" + + "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/helper/validation" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/quicksight" +) + +func resourceAwsQuickSightGroup() *schema.Resource { + return &schema.Resource{ + Create: resourceAwsQuickSightGroupCreate, + Read: resourceAwsQuickSightGroupRead, + Update: resourceAwsQuickSightGroupUpdate, + Delete: resourceAwsQuickSightGroupDelete, + + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + + "aws_account_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + + "description": { + Type: schema.TypeString, + Optional: true, + }, + + "group_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "namespace": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Default: "default", + ValidateFunc: validation.StringInSlice([]string{ + "default", + }, false), + }, + }, + } +} + +func resourceAwsQuickSightGroupCreate(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).quicksightconn + + awsAccountID := meta.(*AWSClient).accountid + namespace := d.Get("namespace").(string) + + if v, ok := d.GetOk("aws_account_id"); ok { + awsAccountID = v.(string) + } + + createOpts := &quicksight.CreateGroupInput{ + AwsAccountId: aws.String(awsAccountID), + Namespace: aws.String(namespace), + GroupName: aws.String(d.Get("group_name").(string)), + } + + if v, ok := d.GetOk("description"); ok { + createOpts.Description = aws.String(v.(string)) + } + + resp, err := conn.CreateGroup(createOpts) + if err != nil { + return fmt.Errorf("Error creating Quick Sight Group: %s", err) + } + + d.SetId(fmt.Sprintf("%s/%s/%s", awsAccountID, namespace, aws.StringValue(resp.Group.GroupName))) + + return resourceAwsQuickSightGroupRead(d, meta) +} + +func resourceAwsQuickSightGroupRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).quicksightconn + + awsAccountID, namespace, groupName, err := resourceAwsQuickSightGroupParseID(d.Id()) + if err != nil { + return err + } + + descOpts := &quicksight.DescribeGroupInput{ + AwsAccountId: aws.String(awsAccountID), + Namespace: aws.String(namespace), + GroupName: aws.String(groupName), + } + + resp, err := conn.DescribeGroup(descOpts) + if isAWSErr(err, quicksight.ErrCodeResourceNotFoundException, "") { + log.Printf("[WARN] Quick Sight Group %s is already gone", d.Id()) + d.SetId("") + return nil + } + if err != nil { + return fmt.Errorf("Error describing Quick Sight Group (%s): %s", d.Id(), err) + } + + d.Set("arn", resp.Group.Arn) + d.Set("aws_account_id", awsAccountID) + d.Set("group_name", resp.Group.GroupName) + d.Set("description", resp.Group.Description) + d.Set("namespace", namespace) + + return nil +} + +func resourceAwsQuickSightGroupUpdate(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).quicksightconn + + awsAccountID, namespace, groupName, err := resourceAwsQuickSightGroupParseID(d.Id()) + if err != nil { + return err + } + + updateOpts := &quicksight.UpdateGroupInput{ + AwsAccountId: aws.String(awsAccountID), + Namespace: aws.String(namespace), + GroupName: aws.String(groupName), + } + + if v, ok := d.GetOk("description"); ok { + updateOpts.Description = aws.String(v.(string)) + } + + _, err = conn.UpdateGroup(updateOpts) + if isAWSErr(err, quicksight.ErrCodeResourceNotFoundException, "") { + log.Printf("[WARN] Quick Sight Group %s is already gone", d.Id()) + d.SetId("") + return nil + } + if err != nil { + return fmt.Errorf("Error updating Quick Sight Group %s: %s", d.Id(), err) + } + + return resourceAwsQuickSightGroupRead(d, meta) +} + +func resourceAwsQuickSightGroupDelete(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).quicksightconn + + awsAccountID, namespace, groupName, err := resourceAwsQuickSightGroupParseID(d.Id()) + if err != nil { + return err + } + + deleteOpts := &quicksight.DeleteGroupInput{ + AwsAccountId: aws.String(awsAccountID), + Namespace: aws.String(namespace), + GroupName: aws.String(groupName), + } + + if _, err := conn.DeleteGroup(deleteOpts); err != nil { + if isAWSErr(err, quicksight.ErrCodeResourceNotFoundException, "") { + return nil + } + return fmt.Errorf("Error deleting Quick Sight Group %s: %s", d.Id(), err) + } + + return nil +} + +func resourceAwsQuickSightGroupParseID(id string) (string, string, string, error) { + parts := strings.SplitN(id, "/", 3) + if len(parts) < 3 || parts[0] == "" || parts[1] == "" || parts[2] == "" { + return "", "", "", fmt.Errorf("unexpected format of ID (%s), expected AWS_ACCOUNT_ID/NAMESPACE/GROUP_NAME", id) + } + return parts[0], parts[1], parts[2], nil +} diff --git a/aws/resource_aws_quicksight_group_test.go b/aws/resource_aws_quicksight_group_test.go new file mode 100644 index 000000000000..994ea2ffdfe8 --- /dev/null +++ b/aws/resource_aws_quicksight_group_test.go @@ -0,0 +1,235 @@ +package aws + +import ( + "fmt" + "os" + "strings" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/arn" + "github.com/aws/aws-sdk-go/service/quicksight" +) + +func TestAccAWSQuickSightGroup_basic(t *testing.T) { + oldvar := os.Getenv("AWS_DEFAULT_REGION") + os.Setenv("AWS_DEFAULT_REGION", "us-east-1") + defer os.Setenv("AWS_DEFAULT_REGION", oldvar) + + var group quicksight.Group + resourceName := "aws_quicksight_group.default" + rName1 := acctest.RandomWithPrefix("tf-acc-test") + rName2 := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckQuickSightGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSQuickSightGroupConfig(rName1), + Check: resource.ComposeTestCheckFunc( + testAccCheckQuickSightGroupExists(resourceName, &group), + resource.TestCheckResourceAttr(resourceName, "group_name", rName1), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "quicksight", fmt.Sprintf("group/default/%s", rName1)), + ), + }, + { + Config: testAccAWSQuickSightGroupConfig(rName2), + Check: resource.ComposeTestCheckFunc( + testAccCheckQuickSightGroupExists(resourceName, &group), + resource.TestCheckResourceAttr(resourceName, "group_name", rName2), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "quicksight", fmt.Sprintf("group/default/%s", rName2)), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSQuickSightGroup_withDescription(t *testing.T) { + oldvar := os.Getenv("AWS_DEFAULT_REGION") + os.Setenv("AWS_DEFAULT_REGION", "us-east-1") + defer os.Setenv("AWS_DEFAULT_REGION", oldvar) + + var group quicksight.Group + resourceName := "aws_quicksight_group.default" + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckQuickSightGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSQuickSightGroupConfigWithDescription(rName, "Description 1"), + Check: resource.ComposeTestCheckFunc( + testAccCheckQuickSightGroupExists(resourceName, &group), + resource.TestCheckResourceAttr(resourceName, "description", "Description 1"), + ), + }, + { + Config: testAccAWSQuickSightGroupConfigWithDescription(rName, "Description 2"), + Check: resource.ComposeTestCheckFunc( + testAccCheckQuickSightGroupExists(resourceName, &group), + resource.TestCheckResourceAttr(resourceName, "description", "Description 2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSQuickSightGroup_disappears(t *testing.T) { + oldvar := os.Getenv("AWS_DEFAULT_REGION") + os.Setenv("AWS_DEFAULT_REGION", "us-east-1") + defer os.Setenv("AWS_DEFAULT_REGION", oldvar) + + var group quicksight.Group + resourceName := "aws_quicksight_group.default" + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckQuickSightGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSQuickSightGroupConfig(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckQuickSightGroupExists(resourceName, &group), + testAccCheckQuickSightGroupDisappears(&group), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + +func testAccCheckQuickSightGroupExists(resourceName string, group *quicksight.Group) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return fmt.Errorf("Not found: %s", resourceName) + } + + awsAccountID, namespace, groupName, err := resourceAwsQuickSightGroupParseID(rs.Primary.ID) + if err != nil { + return err + } + + conn := testAccProvider.Meta().(*AWSClient).quicksightconn + + input := &quicksight.DescribeGroupInput{ + AwsAccountId: aws.String(awsAccountID), + Namespace: aws.String(namespace), + GroupName: aws.String(groupName), + } + + output, err := conn.DescribeGroup(input) + + if err != nil { + return err + } + + if output == nil || output.Group == nil { + return fmt.Errorf("Quick Sight Group (%s) not found", rs.Primary.ID) + } + + *group = *output.Group + + return nil + } +} + +func testAccCheckQuickSightGroupDestroy(s *terraform.State) error { + conn := testAccProvider.Meta().(*AWSClient).quicksightconn + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_quicksight_group" { + continue + } + + awsAccountID, namespace, groupName, err := resourceAwsQuickSightGroupParseID(rs.Primary.ID) + if err != nil { + return err + } + + _, err = conn.DescribeGroup(&quicksight.DescribeGroupInput{ + AwsAccountId: aws.String(awsAccountID), + Namespace: aws.String(namespace), + GroupName: aws.String(groupName), + }) + if isAWSErr(err, quicksight.ErrCodeResourceNotFoundException, "") { + continue + } + + if err != nil { + return err + } + + return fmt.Errorf("Quick Sight Group '%s' was not deleted properly", rs.Primary.ID) + } + + return nil +} + +func testAccCheckQuickSightGroupDisappears(v *quicksight.Group) resource.TestCheckFunc { + return func(s *terraform.State) error { + conn := testAccProvider.Meta().(*AWSClient).quicksightconn + + arn, err := arn.Parse(aws.StringValue(v.Arn)) + if err != nil { + return err + } + + parts := strings.SplitN(arn.Resource, "/", 3) + + input := &quicksight.DeleteGroupInput{ + AwsAccountId: aws.String(arn.AccountID), + Namespace: aws.String(parts[1]), + GroupName: v.GroupName, + } + + if _, err := conn.DeleteGroup(input); err != nil { + return err + } + + return nil + } +} + +func testAccAWSQuickSightGroupConfig(rName string) string { + return fmt.Sprintf(` +resource "aws_quicksight_group" "default" { + group_name = "%[1]s" +} + +`, rName) + +} + +func testAccAWSQuickSightGroupConfigWithDescription(rName, description string) string { + return fmt.Sprintf(` +data "aws_caller_identity" "current" {} + +resource "aws_quicksight_group" "default" { + aws_account_id = "${data.aws_caller_identity.current.account_id}" + group_name = "%[1]s" + description = "%[2]s" +} + +`, rName, description) + +} diff --git a/website/aws.erb b/website/aws.erb index cda0effc88cd..4fbb787ee369 100644 --- a/website/aws.erb +++ b/website/aws.erb @@ -2133,6 +2133,15 @@ +
  • + QuickSight Resources + +
  • +
  • RAM Resources From 46a710bd8a3f32a876a129590535827b6aa1da9e Mon Sep 17 00:00:00 2001 From: John Julien Date: Mon, 22 Jul 2019 15:51:53 -0500 Subject: [PATCH 0328/1054] Allow S3 objects to use etag and SSE-S3 encryption --- aws/resource_aws_s3_bucket_object.go | 2 +- aws/resource_aws_s3_bucket_object_test.go | 40 +++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_s3_bucket_object.go b/aws/resource_aws_s3_bucket_object.go index b569c876b6e8..b67795d2299f 100644 --- a/aws/resource_aws_s3_bucket_object.go +++ b/aws/resource_aws_s3_bucket_object.go @@ -139,7 +139,7 @@ func resourceAwsS3BucketObject() *schema.Resource { // See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonResponseHeaders.html Optional: true, Computed: true, - ConflictsWith: []string{"kms_key_id", "server_side_encryption"}, + ConflictsWith: []string{"kms_key_id"}, }, "version_id": { diff --git a/aws/resource_aws_s3_bucket_object_test.go b/aws/resource_aws_s3_bucket_object_test.go index 47d2c8217e12..51cde29f5d7c 100644 --- a/aws/resource_aws_s3_bucket_object_test.go +++ b/aws/resource_aws_s3_bucket_object_test.go @@ -223,6 +223,30 @@ func TestAccAWSS3BucketObject_content(t *testing.T) { }) } +func TestAccAWSS3BucketObject_etagEncryption(t *testing.T) { + var obj s3.GetObjectOutput + resourceName := "aws_s3_bucket_object.object" + rInt := acctest.RandInt() + source := testAccAWSS3BucketObjectCreateTempFile(t, "{anything will do }") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, + Steps: []resource.TestStep{ + { + PreConfig: func() {}, + Config: testAccAWSS3BucketObjectEtagEncryption(rInt, source), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSS3BucketObjectExists(resourceName, &obj), + testAccCheckAWSS3BucketObjectBody(&obj, "{anything will do }"), + resource.TestCheckResourceAttr(resourceName, "etag", "7b006ff4d70f68cc65061acf2f802e6f"), + ), + }, + }, + }) +} + func TestAccAWSS3BucketObject_contentBase64(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_bucket_object.object" @@ -880,6 +904,22 @@ resource "aws_s3_bucket_object" "object" { `, randInt, content) } +func testAccAWSS3BucketObjectEtagEncryption(randInt int, source string) string { + return fmt.Sprintf(` +resource "aws_s3_bucket" "object_bucket" { + bucket = "tf-object-test-bucket-%d" +} + +resource "aws_s3_bucket_object" "object" { + bucket = "${aws_s3_bucket.object_bucket.bucket}" + key = "test-key" + source = "%s" + server_side_encryption = "AES256" + etag = "${filemd5("%s")}" +} +`, randInt, source, source) +} + func testAccAWSS3BucketObjectConfigContentBase64(randInt int, contentBase64 string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "object_bucket" { From 08d2fea5ba415a61e92ad116843af486b2677772 Mon Sep 17 00:00:00 2001 From: Nick Fagerlund Date: Mon, 22 Jul 2019 15:53:56 -0700 Subject: [PATCH 0329/1054] website: Add `nav-auto-expand` class to "Data Sources"/"Resources" sub-sub navs This new class (dependent on a pending PR to terraform-website) lets you indicate that a subnav should default to open whenever its parent is opened. A softer, gentler feel than `nav-visible`. --- website/aws.erb | 300 ++++++++++++++++++++++++------------------------ 1 file changed, 150 insertions(+), 150 deletions(-) diff --git a/website/aws.erb b/website/aws.erb index 79562ceffce9..3a3c4afaa5c4 100644 --- a/website/aws.erb +++ b/website/aws.erb @@ -67,9 +67,9 @@
  • ACM -