Skip to content

Commit

Permalink
Merge pull request #33195 from markoskandylis/f-VerifiedAccessTrustPr…
Browse files Browse the repository at this point in the history
…ovider

F verified access trust provider
  • Loading branch information
ewbankkit authored Sep 11, 2023
2 parents 47eaadf + 7698f26 commit 342fb54
Show file tree
Hide file tree
Showing 9 changed files with 887 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/33195.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
aws_verifiedaccess_trust_provider
```
2 changes: 1 addition & 1 deletion .github/labeler-pr-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ service/translate:
- 'website/**/translate_*'
service/verifiedaccess:
- 'internal/service/ec2/**/verifiedaccess_*'
- 'website/**/verifiedaccess*'
- 'website/**/verifiedaccess_*'
service/verifiedpermissions:
- 'internal/service/verifiedpermissions/**/*'
- 'website/**/verifiedpermissions_*'
Expand Down
1 change: 1 addition & 0 deletions internal/service/ec2/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const (
errCodeInvalidTransitGatewayPolicyTableIdNotFound = "InvalidTransitGatewayPolicyTableId.NotFound"
errCodeInvalidTransitGatewayIDNotFound = "InvalidTransitGatewayID.NotFound"
errCodeInvalidTransitGatewayMulticastDomainIdNotFound = "InvalidTransitGatewayMulticastDomainId.NotFound"
errCodeInvalidVerifiedAccessTrustProviderIdNotFound = "InvalidVerifiedAccessTrustProviderId.NotFound"
errCodeInvalidVolumeNotFound = "InvalidVolume.NotFound"
errCodeInvalidVPCCIDRBlockAssociationIDNotFound = "InvalidVpcCidrBlockAssociationID.NotFound"
errCodeInvalidVPCEndpointIdNotFound = "InvalidVpcEndpointId.NotFound"
Expand Down
54 changes: 54 additions & 0 deletions internal/service/ec2/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -7020,3 +7020,57 @@ func FindInstanceConnectEndpointByID(ctx context.Context, conn *ec2_sdkv2.Client

return output, nil
}

func FindVerifiedAccessTrustProvider(ctx context.Context, conn *ec2_sdkv2.Client, input *ec2_sdkv2.DescribeVerifiedAccessTrustProvidersInput) (*awstypes.VerifiedAccessTrustProvider, error) {
output, err := FindVerifiedAccessTrustProviders(ctx, conn, input)

if err != nil {
return nil, err
}

return tfresource.AssertSingleValueResult(output)
}

func FindVerifiedAccessTrustProviders(ctx context.Context, conn *ec2_sdkv2.Client, input *ec2_sdkv2.DescribeVerifiedAccessTrustProvidersInput) ([]awstypes.VerifiedAccessTrustProvider, error) {
var output []awstypes.VerifiedAccessTrustProvider
paginator := ec2_sdkv2.NewDescribeVerifiedAccessTrustProvidersPaginator(conn, input)

for paginator.HasMorePages() {
page, err := paginator.NextPage(ctx)

if tfawserr_sdkv2.ErrCodeEquals(err, errCodeInvalidVerifiedAccessTrustProviderIdNotFound) {
return nil, &retry.NotFoundError{
LastError: err,
LastRequest: input,
}
}

if err != nil {
return nil, err
}

output = append(output, page.VerifiedAccessTrustProviders...)
}

return output, nil
}

func FindVerifiedAccessTrustProviderByID(ctx context.Context, conn *ec2_sdkv2.Client, id string) (*awstypes.VerifiedAccessTrustProvider, error) {
input := &ec2_sdkv2.DescribeVerifiedAccessTrustProvidersInput{
VerifiedAccessTrustProviderIds: []string{id},
}
output, err := FindVerifiedAccessTrustProvider(ctx, conn, input)

if err != nil {
return nil, err
}

// Eventual consistency check.
if aws_sdkv2.ToString(output.VerifiedAccessTrustProviderId) != id {
return nil, &retry.NotFoundError{
LastRequest: input,
}
}

return output, nil
}
8 changes: 8 additions & 0 deletions internal/service/ec2/service_package_gen.go

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

Loading

0 comments on commit 342fb54

Please sign in to comment.