internal/awscloud: use AWS.Regions() from osbuild/images
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
5d73c22bb5
commit
7645f60f27
4 changed files with 0 additions and 39 deletions
|
|
@ -298,19 +298,6 @@ func (a *AWS) CopyImage(name, ami, sourceRegion string) (string, error) {
|
|||
return *result.ImageId, nil
|
||||
}
|
||||
|
||||
func (a *AWS) Regions() ([]string, error) {
|
||||
out, err := a.ec2.DescribeRegions(context.Background(), &ec2.DescribeRegionsInput{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := []string{}
|
||||
for _, r := range out.Regions {
|
||||
result = append(result, *r.RegionName)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (a *AWS) DescribeImagesByName(name string) (*ec2.DescribeImagesOutput, error) {
|
||||
return a.ec2.DescribeImages(
|
||||
context.Background(),
|
||||
|
|
|
|||
|
|
@ -18,13 +18,3 @@ func TestEC2CopyImage(t *testing.T) {
|
|||
// 1 snapshot, 1 image
|
||||
require.Equal(t, 2, m.calledFn["CreateTags"])
|
||||
}
|
||||
|
||||
func TestEC2Regions(t *testing.T) {
|
||||
m := newEc2Mock(t)
|
||||
aws := awscloud.NewForTest(m, nil, &s3mock{t, "bucket", "object-key"}, nil, nil)
|
||||
require.NotNil(t, aws)
|
||||
regions, err := aws.Regions()
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, regions)
|
||||
require.Equal(t, 1, m.calledFn["DescribeRegions"])
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ import (
|
|||
)
|
||||
|
||||
type EC2 interface {
|
||||
DescribeRegions(context.Context, *ec2.DescribeRegionsInput, ...func(*ec2.Options)) (*ec2.DescribeRegionsOutput, error)
|
||||
|
||||
// Security Groups
|
||||
AuthorizeSecurityGroupIngress(context.Context, *ec2.AuthorizeSecurityGroupIngressInput, ...func(*ec2.Options)) (*ec2.AuthorizeSecurityGroupIngressOutput, error)
|
||||
CreateSecurityGroup(context.Context, *ec2.CreateSecurityGroupInput, ...func(*ec2.Options)) (*ec2.CreateSecurityGroupOutput, error)
|
||||
|
|
|
|||
|
|
@ -115,20 +115,6 @@ func newEc2Mock(t *testing.T) *ec2mock {
|
|||
}
|
||||
}
|
||||
|
||||
func (m *ec2mock) DescribeRegions(ctx context.Context, input *ec2.DescribeRegionsInput, optfns ...func(*ec2.Options)) (*ec2.DescribeRegionsOutput, error) {
|
||||
m.calledFn["DescribeRegions"] += 1
|
||||
return &ec2.DescribeRegionsOutput{
|
||||
Regions: []ec2types.Region{
|
||||
{
|
||||
RegionName: aws.String("region1"),
|
||||
},
|
||||
{
|
||||
RegionName: aws.String("region2"),
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (m *ec2mock) AuthorizeSecurityGroupIngress(ctx context.Context, input *ec2.AuthorizeSecurityGroupIngressInput, optfns ...func(*ec2.Options)) (*ec2.AuthorizeSecurityGroupIngressOutput, error) {
|
||||
m.calledFn["AuthorizeSecurityGroupIngress"] += 1
|
||||
return &ec2.AuthorizeSecurityGroupIngressOutput{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue