From d9fb30bd6843dcb8d6616ff58efc37803f9f812c Mon Sep 17 00:00:00 2001 From: Tristen Lawrence Date: Tue, 10 Oct 2023 09:35:15 -0400 Subject: [PATCH 1/2] Update Instance List to add state and name --- ec2/instances.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ec2/instances.go b/ec2/instances.go index 891348a..6fa5cae 100644 --- a/ec2/instances.go +++ b/ec2/instances.go @@ -93,8 +93,19 @@ func (e *Ec2) ListInstances(ctx context.Context, org string, per int64, next *st continue } + var instanceName *string + + for _, tag := range i.Tags { + if *tag.Key == "Name" { + instanceName = tag.Value + break + } + } + list = append(list, map[string]*string{ "id": i.InstanceId, + "name": instanceName, + "state": i.State.Name, }) } } From 72adde0d97442780bc07d208647a0e752dbdb57a Mon Sep 17 00:00:00 2001 From: Tristen Lawrence Date: Tue, 10 Oct 2023 09:42:17 -0400 Subject: [PATCH 2/2] Fix indent --- ec2/instances.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ec2/instances.go b/ec2/instances.go index 6fa5cae..85f63a0 100644 --- a/ec2/instances.go +++ b/ec2/instances.go @@ -96,10 +96,10 @@ func (e *Ec2) ListInstances(ctx context.Context, org string, per int64, next *st var instanceName *string for _, tag := range i.Tags { - if *tag.Key == "Name" { - instanceName = tag.Value - break - } + if *tag.Key == "Name" { + instanceName = tag.Value + break + } } list = append(list, map[string]*string{