I am making an API call to AWS to get a list of AMIs using the Golang SDK. The DescribeImages
function takes in DescribeImagesInput
. I only want to see my own AMIs, so my code is doing this:
// Build input
self := "self"
ownerSelf := []*string{&self}
ownImages := &ec2.DescribeImagesInput{
Owners: ownerSelf,
}
// Call the DescribeImages Operation
resp, err := svc.DescribeImages(ownImages)
if err != nil {
panic(err)
}
Building input like that is very ugly. I am sure there is a better technique, but being a Golang n00b, I don't know it. What is a better way to do?
Aucun commentaire:
Enregistrer un commentaire