@@ -7,15 +7,17 @@ import (
77	"context" 
88	"log" 
99
10- 	"github.com/aws/aws-sdk-go/aws" 
11- 	"github.com/aws/aws-sdk-go/service/chimesdkvoice" 
12- 	"github.com/hashicorp /aws-sdk-go-base/ v2/awsv1shim/v2/tfawserr " 
10+ 	"github.com/aws/aws-sdk-go-v2 /aws" 
11+ 	"github.com/aws/aws-sdk-go-v2 /service/chimesdkvoice" 
12+ 	awstypes  "github.com/aws /aws-sdk-go-v2/service/chimesdkvoice/types " 
1313	"github.com/hashicorp/terraform-plugin-sdk/v2/diag" 
1414	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" 
1515	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" 
1616	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 
1717	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" 
1818	"github.com/hashicorp/terraform-provider-aws/internal/conns" 
19+ 	"github.com/hashicorp/terraform-provider-aws/internal/enum" 
20+ 	"github.com/hashicorp/terraform-provider-aws/internal/errs" 
1921	"github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" 
2022	tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" 
2123	"github.com/hashicorp/terraform-provider-aws/internal/tfresource" 
@@ -42,11 +44,11 @@ func ResourceVoiceConnector() *schema.Resource {
4244				Computed : true ,
4345			},
4446			"aws_region" : {
45- 				Type :         schema .TypeString ,
46- 				ForceNew :     true ,
47- 				Optional :     true ,
48- 				Computed :     true ,
49- 				ValidateFunc :  validation . StringInSlice ( chimesdkvoice . VoiceConnectorAwsRegion_Values (),  false ),
47+ 				Type :              schema .TypeString ,
48+ 				ForceNew :          true ,
49+ 				Optional :          true ,
50+ 				Computed :          true ,
51+ 				ValidateDiagFunc :  enum . Validate [awstypes. VoiceConnectorAwsRegion ]( ),
5052			},
5153			"name" : {
5254				Type :         schema .TypeString ,
@@ -84,7 +86,7 @@ func resourceVoiceConnectorDefaultRegion(ctx context.Context, diff *schema.Resou
8486
8587func  resourceVoiceConnectorCreate (ctx  context.Context , d  * schema.ResourceData , meta  interface {}) diag.Diagnostics  {
8688	var  diags  diag.Diagnostics 
87- 	conn  :=  meta .(* conns.AWSClient ).ChimeSDKVoiceConn (ctx )
89+ 	conn  :=  meta .(* conns.AWSClient ).ChimeSDKVoiceClient (ctx )
8890
8991	createInput  :=  & chimesdkvoice.CreateVoiceConnectorInput {
9092		Name :              aws .String (d .Get ("name" ).(string )),
@@ -93,24 +95,24 @@ func resourceVoiceConnectorCreate(ctx context.Context, d *schema.ResourceData, m
9395	}
9496
9597	if  v , ok  :=  d .GetOk ("aws_region" ); ok  {
96- 		createInput .AwsRegion  =  aws . String (v .(string ))
98+ 		createInput .AwsRegion  =  awstypes . VoiceConnectorAwsRegion (v .(string ))
9799	}
98100
99- 	resp , err  :=  conn .CreateVoiceConnectorWithContext (ctx , createInput )
101+ 	resp , err  :=  conn .CreateVoiceConnector (ctx , createInput )
100102	if  err  !=  nil  ||  resp .VoiceConnector  ==  nil  {
101103		return  sdkdiag .AppendErrorf (diags , "creating Chime Voice connector: %s" , err )
102104	}
103105
104- 	d .SetId (aws .StringValue (resp .VoiceConnector .VoiceConnectorId ))
106+ 	d .SetId (aws .ToString (resp .VoiceConnector .VoiceConnectorId ))
105107
106108	return  append (diags , resourceVoiceConnectorRead (ctx , d , meta )... )
107109}
108110
109111func  resourceVoiceConnectorRead (ctx  context.Context , d  * schema.ResourceData , meta  interface {}) diag.Diagnostics  {
110112	var  diags  diag.Diagnostics 
111- 	conn  :=  meta .(* conns.AWSClient ).ChimeSDKVoiceConn (ctx )
113+ 	conn  :=  meta .(* conns.AWSClient ).ChimeSDKVoiceClient (ctx )
112114
113- 	resp , err  :=  FindVoiceConnectorResourceWithRetry (ctx , d .IsNewResource (), func () (* chimesdkvoice .VoiceConnector , error ) {
115+ 	resp , err  :=  FindVoiceConnectorResourceWithRetry (ctx , d .IsNewResource (), func () (* awstypes .VoiceConnector , error ) {
114116		return  findVoiceConnectorByID (ctx , conn , d .Id ())
115117	})
116118
@@ -139,7 +141,7 @@ func resourceVoiceConnectorRead(ctx context.Context, d *schema.ResourceData, met
139141
140142func  resourceVoiceConnectorUpdate (ctx  context.Context , d  * schema.ResourceData , meta  interface {}) diag.Diagnostics  {
141143	var  diags  diag.Diagnostics 
142- 	conn  :=  meta .(* conns.AWSClient ).ChimeSDKVoiceConn (ctx )
144+ 	conn  :=  meta .(* conns.AWSClient ).ChimeSDKVoiceClient (ctx )
143145
144146	if  d .HasChanges ("name" , "require_encryption" ) {
145147		updateInput  :=  & chimesdkvoice.UpdateVoiceConnectorInput {
@@ -148,7 +150,7 @@ func resourceVoiceConnectorUpdate(ctx context.Context, d *schema.ResourceData, m
148150			RequireEncryption : aws .Bool (d .Get ("require_encryption" ).(bool )),
149151		}
150152
151- 		if  _ , err  :=  conn .UpdateVoiceConnectorWithContext (ctx , updateInput ); err  !=  nil  {
153+ 		if  _ , err  :=  conn .UpdateVoiceConnector (ctx , updateInput ); err  !=  nil  {
152154			return  sdkdiag .AppendErrorf (diags , "updating Voice connector (%s): %s" , d .Id (), err )
153155		}
154156	}
@@ -158,14 +160,14 @@ func resourceVoiceConnectorUpdate(ctx context.Context, d *schema.ResourceData, m
158160
159161func  resourceVoiceConnectorDelete (ctx  context.Context , d  * schema.ResourceData , meta  interface {}) diag.Diagnostics  {
160162	var  diags  diag.Diagnostics 
161- 	conn  :=  meta .(* conns.AWSClient ).ChimeSDKVoiceConn (ctx )
163+ 	conn  :=  meta .(* conns.AWSClient ).ChimeSDKVoiceClient (ctx )
162164
163165	input  :=  & chimesdkvoice.DeleteVoiceConnectorInput {
164166		VoiceConnectorId : aws .String (d .Id ()),
165167	}
166168
167- 	if  _ , err  :=  conn .DeleteVoiceConnectorWithContext (ctx , input ); err  !=  nil  {
168- 		if  tfawserr . ErrCodeEquals (err ,  chimesdkvoice . ErrCodeNotFoundException ) {
169+ 	if  _ , err  :=  conn .DeleteVoiceConnector (ctx , input ); err  !=  nil  {
170+ 		if  errs. IsA [ * awstypes. NotFoundException ] (err ) {
169171			log .Printf ("[WARN] Chime Voice connector %s not found" , d .Id ())
170172			return  diags 
171173		}
@@ -175,14 +177,14 @@ func resourceVoiceConnectorDelete(ctx context.Context, d *schema.ResourceData, m
175177	return  diags 
176178}
177179
178- func  findVoiceConnectorByID (ctx  context.Context , conn  * chimesdkvoice.ChimeSDKVoice , id  string ) (* chimesdkvoice .VoiceConnector , error ) {
180+ func  findVoiceConnectorByID (ctx  context.Context , conn  * chimesdkvoice.Client , id  string ) (* awstypes .VoiceConnector , error ) {
179181	in  :=  & chimesdkvoice.GetVoiceConnectorInput {
180182		VoiceConnectorId : aws .String (id ),
181183	}
182184
183- 	resp , err  :=  conn .GetVoiceConnectorWithContext (ctx , in )
185+ 	resp , err  :=  conn .GetVoiceConnector (ctx , in )
184186
185- 	if  tfawserr . ErrCodeEquals (err ,  chimesdkvoice . ErrCodeNotFoundException ) {
187+ 	if  errs. IsA [ * awstypes. NotFoundException ] (err ) {
186188		return  nil , & retry.NotFoundError {
187189			LastError :   err ,
188190			LastRequest : in ,
0 commit comments