From 51c3bb6ff18cfea9832d7fdb2008dc9a0191b640 Mon Sep 17 00:00:00 2001 From: E Camden Fisher Date: Tue, 14 Sep 2021 11:02:21 -0400 Subject: [PATCH] Allow getting public images (#11) * allow getting public images --- ec2/images.go | 1 - ec2/images_test.go | 29 ++++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ec2/images.go b/ec2/images.go index 85a67c8..fdcb68e 100644 --- a/ec2/images.go +++ b/ec2/images.go @@ -63,7 +63,6 @@ func (e *Ec2) GetImage(ctx context.Context, ids ...string) ([]*ec2.Image, error) log.Infof("getting details about image ids %+v", ids) input := ec2.DescribeImagesInput{ - Owners: aws.StringSlice([]string{"self"}), ImageIds: aws.StringSlice(ids), } diff --git a/ec2/images_test.go b/ec2/images_test.go index b2162f4..a79a9de 100644 --- a/ec2/images_test.go +++ b/ec2/images_test.go @@ -415,7 +415,21 @@ func TestEc2_GetImage(t *testing.T) { ctx: context.TODO(), ids: []string{"i-00000005"}, }, - want: []*ec2.Image{}, + want: []*ec2.Image{ + { + ImageId: aws.String("i-00000005"), + Name: aws.String("Image_00000005"), + OwnerId: aws.String("aws"), + Public: aws.Bool(false), + State: aws.String("available"), + Tags: []*ec2.Tag{ + { + Key: aws.String("yale:org"), + Value: aws.String("dev"), + }, + }, + }, + }, }, { name: "multiple ids", @@ -508,6 +522,19 @@ func TestEc2_GetImage(t *testing.T) { }, }, }, + { + ImageId: aws.String("i-00000005"), + Name: aws.String("Image_00000005"), + OwnerId: aws.String("aws"), + Public: aws.Bool(false), + State: aws.String("available"), + Tags: []*ec2.Tag{ + { + Key: aws.String("yale:org"), + Value: aws.String("dev"), + }, + }, + }, }, }, }