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:
@@ -125,7 +125,7 @@ type mockEC2Client struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
func (c *mockEC2Client) DescribeRegions(in *ec2.DescribeRegionsInput) (*ec2.DescribeRegionsOutput, error) {
|
||||
func (c *mockEC2Client) DescribeRegionsWithContext(ctx aws.Context, in *ec2.DescribeRegionsInput, option ...request.Option) (*ec2.DescribeRegionsOutput, error) {
|
||||
args := c.Called(in)
|
||||
return args.Get(0).(*ec2.DescribeRegionsOutput), args.Error(1)
|
||||
}
|
||||
@@ -143,7 +143,7 @@ type oldEC2Client struct {
|
||||
reservations []*ec2.Reservation
|
||||
}
|
||||
|
||||
func (c oldEC2Client) DescribeRegions(*ec2.DescribeRegionsInput) (*ec2.DescribeRegionsOutput, error) {
|
||||
func (c oldEC2Client) DescribeRegionsWithContext(ctx aws.Context, in *ec2.DescribeRegionsInput, option ...request.Option) (*ec2.DescribeRegionsOutput, error) {
|
||||
regions := []*ec2.Region{}
|
||||
for _, region := range c.regions {
|
||||
regions = append(regions, &ec2.Region{
|
||||
|
||||
Reference in New Issue
Block a user