func()

in pkg/selector/selector.go [686:701]


func (s Selector) getLocationType(ctx context.Context, location string) (ec2types.LocationType, error) {
	azs, err := s.EC2.DescribeAvailabilityZones(ctx, &ec2.DescribeAvailabilityZonesInput{})
	if err != nil {
		return "", err
	}
	for _, zone := range azs.AvailabilityZones {
		if location == *zone.RegionName {
			return regionNameLocationType, nil
		} else if location == *zone.ZoneName {
			return zoneNameLocationType, nil
		} else if location == *zone.ZoneId {
			return zoneIDLocationType, nil
		}
	}
	return "", fmt.Errorf("the location passed in (%s) is not a valid zone-id, zone-name, or region name", location)
}