CloudWatch: Use context in aws DescribeRegionsWithContext (#76922)

* Use context in aws DescribeRegionsWithContext

In the current way, DescribeRegions is used which doesn't allow
cancelling the request if the context changes. Using
DescribeRegionsWithContext is the preferred way.

* Fix context variable

* Revert GetRegionsWithContext to GetRegions

GetRegions is not an AWS SDK method. Hence, GetRegions should be enough
as the name change is not needed for context implementation.
This commit is contained in:
Shabeeb Khalid
2023-10-23 17:39:07 +03:00
committed by GitHub
parent 8f96d23eee
commit 9dc6cac1f2
9 changed files with 23 additions and 20 deletions
+2 -2
View File
@@ -46,7 +46,7 @@ type AccountsProvider interface {
}
type RegionsAPIProvider interface {
GetRegions() ([]resources.ResourceResponse[resources.Region], error)
GetRegions(ctx context.Context) ([]resources.ResourceResponse[resources.Region], error)
}
// Clients
@@ -70,6 +70,6 @@ type OAMAPIProvider interface {
}
type EC2APIProvider interface {
DescribeRegions(in *ec2.DescribeRegionsInput) (*ec2.DescribeRegionsOutput, error)
DescribeRegionsWithContext(ctx context.Context, in *ec2.DescribeRegionsInput, opts ...request.Option) (*ec2.DescribeRegionsOutput, error)
DescribeInstancesPagesWithContext(ctx context.Context, in *ec2.DescribeInstancesInput, fn func(*ec2.DescribeInstancesOutput, bool) bool, opts ...request.Option) error
}