Skip to content

Commit

Permalink
Merge pull request #54 from YaleSpinup/tl694-update-instance-list
Browse files Browse the repository at this point in the history
Update Instance List to add state and name
  • Loading branch information
trstne authored Oct 12, 2023
2 parents 66a2ea7 + 72adde0 commit 3480ea9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ec2/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}
}
Expand Down

0 comments on commit 3480ea9

Please sign in to comment.