Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ses awssdkv2 migration #38568

Merged
merged 55 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a6b479e
Update names_data.hcl, add endpointID, patch gen
HubbardHarvey3 Jul 10, 2024
f70546b
r/d/active_receipt_rule_set: Migrate to AWS SDK v2
HubbardHarvey3 Jul 11, 2024
6f2ce04
Merge branch 'hashicorp:main' into ses-awssdkv2-migration
HubbardHarvey3 Jul 11, 2024
00dff0f
r/configuration_set.go: Migrate to AWS SDK v2
HubbardHarvey3 Jul 11, 2024
ddaf310
r/domain_dkim.go: Migrate to AWS SDK v2
HubbardHarvey3 Jul 12, 2024
2c82b36
Merge branch 'hashicorp:main' into ses-awssdkv2-migration
HubbardHarvey3 Jul 12, 2024
af0a4de
r/domain_identity.go: Migrate to AWS SDK v2
HubbardHarvey3 Jul 12, 2024
3ebaf0a
d/domain_identity: Migrate to AWS SDK v2
HubbardHarvey3 Jul 12, 2024
0a600a8
r/domain_identity_verification: Migrate to AWS SDK v2
HubbardHarvey3 Jul 12, 2024
e7043c0
Merge branch 'hashicorp:main' into ses-awssdkv2-migration
HubbardHarvey3 Jul 15, 2024
e84ca8f
r/domain_mail_from: Migrate to AWS SDK v2
HubbardHarvey3 Jul 15, 2024
f60b2f7
r/d/email_identity: Migrate to AWS SDK v2
HubbardHarvey3 Jul 15, 2024
6da657f
Merge branch 'hashicorp:main' into ses-awssdkv2-migration
HubbardHarvey3 Jul 16, 2024
598a7af
r/event_destination: Migrate to AWS SDK v2
HubbardHarvey3 Jul 17, 2024
77560eb
Merge branch 'hashicorp:main' into ses-awssdkv2-migration
HubbardHarvey3 Jul 17, 2024
133d4af
r/identity_notification_topic: Migrate to AWS SDK v2
HubbardHarvey3 Jul 17, 2024
21af40f
r/identity_policy: Migrate to AWS SDK v2
HubbardHarvey3 Jul 17, 2024
74d1bec
r/receipt_filter: Migrate to AWS SDK v2
HubbardHarvey3 Jul 17, 2024
d9c0dda
Merge branch 'hashicorp:main' into ses-awssdkv2-migration
HubbardHarvey3 Jul 18, 2024
eea5468
r/receipt_rule: Migrate to AWS SDK v2
HubbardHarvey3 Jul 18, 2024
e11be9c
Merge branch 'hashicorp:main' into ses-awssdkv2-migration
HubbardHarvey3 Jul 19, 2024
205bd08
r/receipt_rule_set: Migrate to AWS SDK v2
HubbardHarvey3 Jul 18, 2024
66eccce
sweep: Migrate to AWS SDK v2
HubbardHarvey3 Jul 19, 2024
6b039aa
generate.go update: Migrate to AWS SDK v2
HubbardHarvey3 Jul 19, 2024
3e09e6e
template: Migrate to AWS SDK v2
HubbardHarvey3 Jul 19, 2024
606aa78
r/configuration_set: Migrate to AWS SDK v2
HubbardHarvey3 Jul 19, 2024
74316ad
d/domain_identity: Migrate to AWS SDK v2
HubbardHarvey3 Jul 19, 2024
d2874e8
go mod tidy: Migrate to AWS SDK v2
HubbardHarvey3 Jul 19, 2024
a6c575e
r/configuration_set_test: Migrate to AWS SDK v2
HubbardHarvey3 Jul 19, 2024
4c65b8f
r/domain_dkim_test: Migrate to AWS SDK v2
HubbardHarvey3 Jul 19, 2024
f5c71e6
Merge branch 'hashicorp:main' into ses-awssdkv2-migration
HubbardHarvey3 Jul 20, 2024
eb0b84d
r/domain_identity_test: Migrate to AWS SDK v2
HubbardHarvey3 Jul 21, 2024
f678942
r/domain_identity_verification: Migrate to AWS SDK v2
HubbardHarvey3 Jul 21, 2024
56dcc4a
r/domain_mail_from_test: Migrate to AWS SDK v2
HubbardHarvey3 Jul 21, 2024
fcea8da
r/email_identity_test: Migrate to AWS SDK v2
HubbardHarvey3 Jul 21, 2024
ee66eb7
r/event_destination_test: Migrate to AWS SDK v2
HubbardHarvey3 Jul 21, 2024
66a0caa
r/identity_notification_topic_test: Migrate to AWS SDK v2
HubbardHarvey3 Jul 21, 2024
e39d673
r/identity_policy_test: Migrate to AWS SDK v2
HubbardHarvey3 Jul 21, 2024
293ba8e
r/receipt_rule_set_test: Migrate to AWS SDK v2
HubbardHarvey3 Jul 21, 2024
4deafbb
make gen, template_test: Migrate to AWS SDK v2
HubbardHarvey3 Jul 21, 2024
fefbfbe
email_identity_test: Migrate to AWS SDK v2
HubbardHarvey3 Jul 21, 2024
040ebe9
r/receipt_filter_test: Migrate to AWS SDK v2
HubbardHarvey3 Jul 21, 2024
ea3fae1
Merge branch 'hashicorp:main' into ses-awssdkv2-migration
HubbardHarvey3 Jul 24, 2024
36eb6aa
r/configuration_set: Migrate to AWS SDK v2 - clean up types
HubbardHarvey3 Jul 24, 2024
ccb959e
r/domain_identity_verification: Migrate to AWS SDK v2 - clean up types
HubbardHarvey3 Jul 24, 2024
27f5df3
r/identity_policy: Migrate to AWS SDK v2 - fix DEBUG log
HubbardHarvey3 Jul 24, 2024
44cc470
r/receipt_rule: Migrate to AWS SDK v2 - fix tests
HubbardHarvey3 Jul 24, 2024
24d0dc4
Merge branch 'hashicorp:main' into ses-awssdkv2-migration
HubbardHarvey3 Jul 26, 2024
a347445
r/configuration_set: Migrate to AWS SDK v2 - fix errorcheck
HubbardHarvey3 Jul 26, 2024
593f0f0
r/event_destination: Migrate to AWS SDK v2 - handle missing event des…
HubbardHarvey3 Jul 26, 2024
ece3dad
r/identity_notification_topic: Migrate to AWS SDK v2 - fix test
HubbardHarvey3 Jul 26, 2024
8ed0178
Merge branch 'hashicorp:main' into ses-awssdkv2-migration
HubbardHarvey3 Jul 27, 2024
bdc8d6c
Migrate to AWS SDK v2 - fix ci checks
HubbardHarvey3 Jul 27, 2024
ede7101
Merge branch 'main' into ses-awssdkv2-migration
jar-b Aug 6, 2024
49a17ab
r/aws_ses_domain_identity_verification: compare enum types
jar-b Aug 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/servicecatalogappregistry v1.28.3
github.com/aws/aws-sdk-go-v2/service/servicediscovery v1.31.3
github.com/aws/aws-sdk-go-v2/service/servicequotas v1.23.3
github.com/aws/aws-sdk-go-v2/service/ses v1.25.2
github.com/aws/aws-sdk-go-v2/service/sesv2 v1.32.3
github.com/aws/aws-sdk-go-v2/service/sfn v1.30.0
github.com/aws/aws-sdk-go-v2/service/shield v1.27.3
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@ github.com/aws/aws-sdk-go-v2/service/servicediscovery v1.31.3 h1:EthA93BNgTnk36F
github.com/aws/aws-sdk-go-v2/service/servicediscovery v1.31.3/go.mod h1:4xh/h0pevPhBkA4b2iYosZaqrThccxFREQxiGuZpJlc=
github.com/aws/aws-sdk-go-v2/service/servicequotas v1.23.3 h1:J6R7Mo3nDY9BmmG4V9EpQa70A0XOoCuWPYTpsmouM48=
github.com/aws/aws-sdk-go-v2/service/servicequotas v1.23.3/go.mod h1:be52Ycqv581QoIOZzHfZFWlJLcGAI2M/ItUSlx7lLp0=
github.com/aws/aws-sdk-go-v2/service/ses v1.25.2 h1:NMFHOa6j5/PcxXNy2JEwN5nT79YMiWE55uDW9w5LO5o=
github.com/aws/aws-sdk-go-v2/service/ses v1.25.2/go.mod h1:cCXA/nP50r07dXq9qB0oM55YdYl6152Nd/2B+JrB9zo=
github.com/aws/aws-sdk-go-v2/service/sesv2 v1.32.3 h1:DLJCsgYZoNIIIFnWd3MXyg9ehgnlihOKDEvOAkzGRMc=
github.com/aws/aws-sdk-go-v2/service/sesv2 v1.32.3/go.mod h1:klyMXN+cNAndrESWMyT7LA8Ll0I6Nc03jxfSkeuU/Xg=
github.com/aws/aws-sdk-go-v2/service/sfn v1.30.0 h1:FIprHGk9sztofQcgyHrIOh4QQo0rO1kjHmksxDrXMtg=
Expand Down
6 changes: 3 additions & 3 deletions internal/conns/awsclient_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 15 additions & 14 deletions internal/service/ses/active_receipt_rule_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import (
"fmt"
"log"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/service/ses"
"github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/arn"
"github.com/aws/aws-sdk-go-v2/service/ses"
awstypes "github.com/aws/aws-sdk-go-v2/service/ses/types"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/hashicorp/terraform-provider-aws/internal/conns"
"github.com/hashicorp/terraform-provider-aws/internal/errs"
"github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag"
"github.com/hashicorp/terraform-provider-aws/names"
)
Expand Down Expand Up @@ -48,15 +49,15 @@ func ResourceActiveReceiptRuleSet() *schema.Resource {

func resourceActiveReceiptRuleSetUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
var diags diag.Diagnostics
conn := meta.(*conns.AWSClient).SESConn(ctx)
conn := meta.(*conns.AWSClient).SESClient(ctx)

ruleSetName := d.Get("rule_set_name").(string)

createOpts := &ses.SetActiveReceiptRuleSetInput{
RuleSetName: aws.String(ruleSetName),
}

_, err := conn.SetActiveReceiptRuleSetWithContext(ctx, createOpts)
_, err := conn.SetActiveReceiptRuleSet(ctx, createOpts)
if err != nil {
return sdkdiag.AppendErrorf(diags, "setting active SES rule set: %s", err)
}
Expand All @@ -68,13 +69,13 @@ func resourceActiveReceiptRuleSetUpdate(ctx context.Context, d *schema.ResourceD

func resourceActiveReceiptRuleSetRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
var diags diag.Diagnostics
conn := meta.(*conns.AWSClient).SESConn(ctx)
conn := meta.(*conns.AWSClient).SESClient(ctx)

describeOpts := &ses.DescribeActiveReceiptRuleSetInput{}

response, err := conn.DescribeActiveReceiptRuleSetWithContext(ctx, describeOpts)
response, err := conn.DescribeActiveReceiptRuleSet(ctx, describeOpts)
if err != nil {
if tfawserr.ErrCodeEquals(err, ses.ErrCodeRuleSetDoesNotExistException) {
if errs.IsA[*awstypes.RuleSetDoesNotExistException](err) {
log.Printf("[WARN] SES Receipt Rule Set (%s) belonging to SES Active Receipt Rule Set not found, removing from state", d.Id())
d.SetId("")
return diags
Expand Down Expand Up @@ -104,13 +105,13 @@ func resourceActiveReceiptRuleSetRead(ctx context.Context, d *schema.ResourceDat

func resourceActiveReceiptRuleSetDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
var diags diag.Diagnostics
conn := meta.(*conns.AWSClient).SESConn(ctx)
conn := meta.(*conns.AWSClient).SESClient(ctx)

deleteOpts := &ses.SetActiveReceiptRuleSetInput{
RuleSetName: nil,
}

_, err := conn.SetActiveReceiptRuleSetWithContext(ctx, deleteOpts)
_, err := conn.SetActiveReceiptRuleSet(ctx, deleteOpts)
if err != nil {
return sdkdiag.AppendErrorf(diags, "deleting active SES rule set: %s", err)
}
Expand All @@ -119,11 +120,11 @@ func resourceActiveReceiptRuleSetDelete(ctx context.Context, d *schema.ResourceD
}

func resourceActiveReceiptRuleSetImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
conn := meta.(*conns.AWSClient).SESConn(ctx)
conn := meta.(*conns.AWSClient).SESClient(ctx)

describeOpts := &ses.DescribeActiveReceiptRuleSetInput{}

response, err := conn.DescribeActiveReceiptRuleSetWithContext(ctx, describeOpts)
response, err := conn.DescribeActiveReceiptRuleSet(ctx, describeOpts)
if err != nil {
return nil, err
}
Expand All @@ -132,7 +133,7 @@ func resourceActiveReceiptRuleSetImport(ctx context.Context, d *schema.ResourceD
return nil, fmt.Errorf("no active Receipt Rule Set found")
}

if aws.StringValue(response.Metadata.Name) != d.Id() {
if aws.ToString(response.Metadata.Name) != d.Id() {
return nil, fmt.Errorf("SES Receipt Rule Set (%s) belonging to SES Active Receipt Rule Set not found", d.Id())
}

Expand Down
12 changes: 6 additions & 6 deletions internal/service/ses/active_receipt_rule_set_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"context"
"fmt"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/service/ses"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/arn"
"github.com/aws/aws-sdk-go-v2/service/ses"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-aws/internal/conns"
Expand Down Expand Up @@ -38,9 +38,9 @@ func DataSourceActiveReceiptRuleSet() *schema.Resource {

func dataSourceActiveReceiptRuleSetRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
var diags diag.Diagnostics
conn := meta.(*conns.AWSClient).SESConn(ctx)
conn := meta.(*conns.AWSClient).SESClient(ctx)

data, err := conn.DescribeActiveReceiptRuleSetWithContext(ctx, &ses.DescribeActiveReceiptRuleSetInput{})
data, err := conn.DescribeActiveReceiptRuleSet(ctx, &ses.DescribeActiveReceiptRuleSetInput{})

if err != nil {
return sdkdiag.AppendErrorf(diags, "reading SES Active Receipt Rule Set: %s", err)
Expand All @@ -49,7 +49,7 @@ func dataSourceActiveReceiptRuleSetRead(ctx context.Context, d *schema.ResourceD
return sdkdiag.AppendErrorf(diags, "reading SES Active Receipt Rule Set: %s", tfresource.NewEmptyResultError(nil))
}

name := aws.StringValue(data.Metadata.Name)
name := aws.ToString(data.Metadata.Name)
d.SetId(name)
d.Set("rule_set_name", name)
arn := arn.ARN{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"

"github.com/YakDriver/regexache"
"github.com/aws/aws-sdk-go/service/ses"
"github.com/aws/aws-sdk-go-v2/service/ses"
sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
Expand Down Expand Up @@ -85,9 +85,9 @@ data "aws_ses_active_receipt_rule_set" "test" {}
}

func testAccPreCheckUnsetActiveRuleSet(ctx context.Context, t *testing.T) {
conn := acctest.Provider.Meta().(*conns.AWSClient).SESConn(ctx)
conn := acctest.Provider.Meta().(*conns.AWSClient).SESClient(ctx)

output, err := conn.DescribeActiveReceiptRuleSetWithContext(ctx, &ses.DescribeActiveReceiptRuleSetInput{})
output, err := conn.DescribeActiveReceiptRuleSet(ctx, &ses.DescribeActiveReceiptRuleSetInput{})
if acctest.PreCheckSkipError(err) {
t.Skipf("skipping acceptance testing: %s", err)
}
Expand All @@ -98,7 +98,7 @@ func testAccPreCheckUnsetActiveRuleSet(ctx context.Context, t *testing.T) {
t.Fatalf("unexpected PreCheck error: %s", err)
}

_, err = conn.SetActiveReceiptRuleSetWithContext(ctx, &ses.SetActiveReceiptRuleSetInput{
_, err = conn.SetActiveReceiptRuleSet(ctx, &ses.SetActiveReceiptRuleSetInput{
RuleSetName: nil,
})
if acctest.PreCheckSkipError(err) {
Expand Down
18 changes: 9 additions & 9 deletions internal/service/ses/active_receipt_rule_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"fmt"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ses"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/ses"
sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/terraform"
Expand Down Expand Up @@ -98,19 +98,19 @@ func testAccActiveReceiptRuleSet_disappears(t *testing.T) {

func testAccCheckActiveReceiptRuleSetDestroy(ctx context.Context) resource.TestCheckFunc {
return func(s *terraform.State) error {
conn := acctest.Provider.Meta().(*conns.AWSClient).SESConn(ctx)
conn := acctest.Provider.Meta().(*conns.AWSClient).SESClient(ctx)

for _, rs := range s.RootModule().Resources {
if rs.Type != "aws_ses_active_receipt_rule_set" {
continue
}

response, err := conn.DescribeActiveReceiptRuleSetWithContext(ctx, &ses.DescribeActiveReceiptRuleSetInput{})
response, err := conn.DescribeActiveReceiptRuleSet(ctx, &ses.DescribeActiveReceiptRuleSetInput{})
if err != nil {
return err
}

if response.Metadata != nil && (aws.StringValue(response.Metadata.Name) == rs.Primary.ID) {
if response.Metadata != nil && (aws.ToString(response.Metadata.Name) == rs.Primary.ID) {
return fmt.Errorf("Active receipt rule set still exists")
}
}
Expand All @@ -130,15 +130,15 @@ func testAccCheckActiveReceiptRuleSetExists(ctx context.Context, n string) resou
return fmt.Errorf("SES Active Receipt Rule Set name not set")
}

conn := acctest.Provider.Meta().(*conns.AWSClient).SESConn(ctx)
conn := acctest.Provider.Meta().(*conns.AWSClient).SESClient(ctx)

response, err := conn.DescribeActiveReceiptRuleSetWithContext(ctx, &ses.DescribeActiveReceiptRuleSetInput{})
response, err := conn.DescribeActiveReceiptRuleSet(ctx, &ses.DescribeActiveReceiptRuleSetInput{})
if err != nil {
return err
}

if response.Metadata != nil && (aws.StringValue(response.Metadata.Name) != rs.Primary.ID) {
return fmt.Errorf("The active receipt rule set (%s) was not set to %s", aws.StringValue(response.Metadata.Name), rs.Primary.ID)
if response.Metadata != nil && (aws.ToString(response.Metadata.Name) != rs.Primary.ID) {
return fmt.Errorf("The active receipt rule set (%s) was not set to %s", aws.ToString(response.Metadata.Name), rs.Primary.ID)
}

return nil
Expand Down
Loading
Loading