aws / aws-sdk-go-v2

AWS SDK for the Go programming language.
https://aws.github.io/aws-sdk-go-v2/docs/
Apache License 2.0
2.68k stars 650 forks source link

service/ec2: Add Waiter for DisassociateSecurityGroupVpc #2911

Open aslatter opened 3 days ago

aslatter commented 3 days ago

Describe the feature

Per the documentation, DisassociateSecurityGroupVpc is an async operation, and the caller is advised to check the status of the disassociation by DescribeSecurityGroupVpcAssociations.

Most similar operations offer a "waiter" in the related service package. I expected to find something like NewSecurityGroupDisassociationWaiter in the service/ec2 but I couldn't find anything.

Use Case

I am attempting to programmatically write code to clean up unused Security Groups. As a part of this, I need to disassociate any VPCs from the Security Group (this is a documented requirement of DeleteSecurityGroup).

As the disassociation is asynchronous, I assume I need to wait for the disassociation to complete before moving forward with the security-group deletion (but I have not tested this).

Proposed Solution

Introduce NewSecurityGroupDisassociationWaiter, similar to other waiters in the SDK.

Other Information

No response

Acknowledgements

AWS Go SDK V2 Module Versions Used

``` github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/jmespath/go-jmespath@v0.4.0 github.com/aws/aws-sdk-go-v2@v1.32.5 go@1.21 github.com/aws/aws-sdk-go-v2/config@v1.28.5 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/aws-sdk-go-v2/config@v1.28.5 github.com/aws/aws-sdk-go-v2/credentials@v1.17.46 github.com/aws/aws-sdk-go-v2/config@v1.28.5 github.com/aws/aws-sdk-go-v2/feature/ec2/imds@v1.16.20 github.com/aws/aws-sdk-go-v2/config@v1.28.5 github.com/aws/aws-sdk-go-v2/internal/ini@v1.8.1 github.com/aws/aws-sdk-go-v2/config@v1.28.5 github.com/aws/aws-sdk-go-v2/service/sso@v1.24.6 github.com/aws/aws-sdk-go-v2/config@v1.28.5 github.com/aws/aws-sdk-go-v2/service/ssooidc@v1.28.5 github.com/aws/aws-sdk-go-v2/config@v1.28.5 github.com/aws/aws-sdk-go-v2/service/sts@v1.33.1 github.com/aws/aws-sdk-go-v2/config@v1.28.5 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/config@v1.28.5 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.3.24 github.com/aws/aws-sdk-go-v2/config@v1.28.5 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.6.24 github.com/aws/aws-sdk-go-v2/config@v1.28.5 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding@v1.12.1 github.com/aws/aws-sdk-go-v2/config@v1.28.5 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url@v1.12.5 github.com/aws/aws-sdk-go-v2/config@v1.28.5 go@1.21 github.com/aws/aws-sdk-go-v2/credentials@v1.17.46 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/aws-sdk-go-v2/credentials@v1.17.46 github.com/aws/aws-sdk-go-v2/feature/ec2/imds@v1.16.20 github.com/aws/aws-sdk-go-v2/credentials@v1.17.46 github.com/aws/aws-sdk-go-v2/service/sso@v1.24.6 github.com/aws/aws-sdk-go-v2/credentials@v1.17.46 github.com/aws/aws-sdk-go-v2/service/ssooidc@v1.28.5 github.com/aws/aws-sdk-go-v2/credentials@v1.17.46 github.com/aws/aws-sdk-go-v2/service/sts@v1.33.1 github.com/aws/aws-sdk-go-v2/credentials@v1.17.46 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/credentials@v1.17.46 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.3.24 github.com/aws/aws-sdk-go-v2/credentials@v1.17.46 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.6.24 github.com/aws/aws-sdk-go-v2/credentials@v1.17.46 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding@v1.12.1 github.com/aws/aws-sdk-go-v2/credentials@v1.17.46 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url@v1.12.5 github.com/aws/aws-sdk-go-v2/credentials@v1.17.46 go@1.21 github.com/aws/aws-sdk-go-v2/feature/ec2/imds@v1.16.20 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/aws-sdk-go-v2/feature/ec2/imds@v1.16.20 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/feature/ec2/imds@v1.16.20 go@1.21 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.3.24 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.3.24 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.3.24 go@1.21 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.6.24 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.6.24 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.6.24 go@1.21 github.com/aws/aws-sdk-go-v2/internal/ini@v1.8.1 go@1.21 github.com/aws/aws-sdk-go-v2/service/ec2@v1.193.0 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/aws-sdk-go-v2/service/ec2@v1.193.0 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.3.24 github.com/aws/aws-sdk-go-v2/service/ec2@v1.193.0 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.6.24 github.com/aws/aws-sdk-go-v2/service/ec2@v1.193.0 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding@v1.12.1 github.com/aws/aws-sdk-go-v2/service/ec2@v1.193.0 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url@v1.12.5 github.com/aws/aws-sdk-go-v2/service/ec2@v1.193.0 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/service/ec2@v1.193.0 go@1.21 github.com/aws/aws-sdk-go-v2/service/eks@v1.52.1 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/aws-sdk-go-v2/service/eks@v1.52.1 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.3.24 github.com/aws/aws-sdk-go-v2/service/eks@v1.52.1 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.6.24 github.com/aws/aws-sdk-go-v2/service/eks@v1.52.1 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/service/eks@v1.52.1 github.com/jmespath/go-jmespath@v0.4.0 github.com/aws/aws-sdk-go-v2/service/eks@v1.52.1 go@1.21 github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2@v1.43.0 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2@v1.43.0 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.3.24 github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2@v1.43.0 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.6.24 github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2@v1.43.0 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2@v1.43.0 github.com/jmespath/go-jmespath@v0.4.0 github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2@v1.43.0 go@1.21 github.com/aws/aws-sdk-go-v2/service/iam@v1.38.1 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/aws-sdk-go-v2/service/iam@v1.38.1 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.3.24 github.com/aws/aws-sdk-go-v2/service/iam@v1.38.1 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.6.24 github.com/aws/aws-sdk-go-v2/service/iam@v1.38.1 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/service/iam@v1.38.1 go@1.21 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding@v1.12.1 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding@v1.12.1 go@1.21 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url@v1.12.5 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url@v1.12.5 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url@v1.12.5 go@1.21 github.com/aws/aws-sdk-go-v2/service/route53@v1.46.2 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/aws-sdk-go-v2/service/route53@v1.46.2 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.3.24 github.com/aws/aws-sdk-go-v2/service/route53@v1.46.2 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.6.24 github.com/aws/aws-sdk-go-v2/service/route53@v1.46.2 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/service/route53@v1.46.2 github.com/jmespath/go-jmespath@v0.4.0 github.com/aws/aws-sdk-go-v2/service/route53@v1.46.2 go@1.21 github.com/aws/aws-sdk-go-v2/service/sso@v1.24.6 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/aws-sdk-go-v2/service/sso@v1.24.6 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.3.24 github.com/aws/aws-sdk-go-v2/service/sso@v1.24.6 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.6.24 github.com/aws/aws-sdk-go-v2/service/sso@v1.24.6 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/service/sso@v1.24.6 go@1.21 github.com/aws/aws-sdk-go-v2/service/ssooidc@v1.28.5 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/aws-sdk-go-v2/service/ssooidc@v1.28.5 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.3.24 github.com/aws/aws-sdk-go-v2/service/ssooidc@v1.28.5 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.6.24 github.com/aws/aws-sdk-go-v2/service/ssooidc@v1.28.5 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/service/ssooidc@v1.28.5 go@1.21 github.com/aws/aws-sdk-go-v2/service/sts@v1.33.1 github.com/aws/aws-sdk-go-v2@v1.32.5 github.com/aws/aws-sdk-go-v2/service/sts@v1.33.1 github.com/aws/aws-sdk-go-v2/internal/configsources@v1.3.24 github.com/aws/aws-sdk-go-v2/service/sts@v1.33.1 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2@v2.6.24 github.com/aws/aws-sdk-go-v2/service/sts@v1.33.1 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding@v1.12.1 github.com/aws/aws-sdk-go-v2/service/sts@v1.33.1 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url@v1.12.5 github.com/aws/aws-sdk-go-v2/service/sts@v1.33.1 github.com/aws/smithy-go@v1.22.1 github.com/aws/aws-sdk-go-v2/service/sts@v1.33.1 go@1.21 github.com/aws/smithy-go@v1.22.1 go@1.21 ```

Go version used

go version go1.23.3 linux/amd64

aslatter commented 3 days ago

(I'm not currently using security groups associated with additional VPCs, so this isn't a high-priority for me - I was looking to address this in my own code for completeness.)