// AvailabilityZones returns all availability zones in the environment.
323354
func (env *environ) AvailabilityZones(ctx context.ProviderCallContext) ([]common.AvailabilityZone, error) {
	zones, err := env.gce.AvailabilityZones(env.cloud.Region)
	if err != nil {
		return nil, google.HandleCredentialError(errors.Trace(err), ctx)
	}

	var result []common.AvailabilityZone
	for _, zone := range zones {
		if zone.Deprecated() {
			continue
		}
		// We make a copy since the loop var keeps the same pointer.
		zoneCopy := zone
		result = append(result, &zoneCopy)
	}
	return result, nil
}
1225235
func (s *EventFilter) SetAvailabilityZones(v []*string) *EventFilter {
	s.AvailabilityZones = v
	return s
}
175756
func (e *Environ) DeriveAvailabilityZones(ctx context.ProviderCallContext, args environs.StartInstanceParams) ([]string, error) {
	availabilityZone, err := e.deriveAvailabilityZone(ctx, args.Placement, args.VolumeAttachments)
	if err != nil && !errors.IsNotImplemented(err) {
		common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
		return nil, errors.Trace(err)
	}
	if availabilityZone != "" {
		return []string{availabilityZone}, nil
	}
	return nil, nil
}
273926
func (f *F) setZones(zones []string) {
	for i := range zones {
		zones[i] = plugin.Host(zones[i]).Normalize()
	}
	f.Zones = zones
}
986858
func (env *maasEnviron) AvailabilityZones(ctx context.ProviderCallContext) ([]common.AvailabilityZone, error) {
	env.availabilityZonesMutex.Lock()
	defer env.availabilityZonesMutex.Unlock()
	if env.availabilityZones == nil {
		var availabilityZones []common.AvailabilityZone
		var err error
		if env.usingMAAS2() {
			availabilityZones, err = env.availabilityZones2(ctx)
			if err != nil {
				return nil, errors.Trace(err)
			}
		} else {
			availabilityZones, err = env.availabilityZones1(ctx)
			if err != nil {
				return nil, errors.Trace(err)
			}
		}
		env.availabilityZones = availabilityZones
	}
	return env.availabilityZones, nil
}
1149407
func (e *Environ) AvailabilityZones(ctx context.ProviderCallContext) ([]common.AvailabilityZone, error) {
	e.availabilityZonesMutex.Lock()
	defer e.availabilityZonesMutex.Unlock()
	if e.availabilityZones == nil {
		zones, err := novaListAvailabilityZones(e.nova())
		if gooseerrors.IsNotImplemented(err) {
			return nil, errors.NotImplementedf("availability zones")
		}
		if err != nil {
			common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
			return nil, err
		}
		e.availabilityZones = make([]common.AvailabilityZone, len(zones))
		for i, z := range zones {
			e.availabilityZones[i] = &openstackAvailabilityZone{z}
		}
	}
	return e.availabilityZones, nil
}
831206
func (gc *Connection) AvailabilityZones(region string) ([]AvailabilityZone, error) {
	rawZones, err := gc.raw.ListAvailabilityZones(gc.projectID, region)
	if err != nil {
		return nil, errors.Trace(err)
	}

	var zones []AvailabilityZone
	for _, rawZone := range rawZones {
		zones = append(zones, AvailabilityZone{rawZone})
	}
	return zones, nil
}
1095723
func (s *EnableAvailabilityZonesForLoadBalancerInput) SetAvailabilityZones(v []*string) *EnableAvailabilityZonesForLoadBalancerInput {
	s.AvailabilityZones = v
	return s
}
593115
func (s *CreateClusterInput) SetAvailabilityZones(v []*string) *CreateClusterInput {
	s.AvailabilityZones = v
	return s
}
366958
func flattenSubnetsFromAvailabilityZones(availabilityZones []*elbv2.AvailabilityZone) []string {
	var result []string
	for _, az := range availabilityZones {
		result = append(result, aws.StringValue(az.SubnetId))
	}
	return result
}
1000687
func (s *Products) GetAvailabilityZoneNames() (availablityZoneNames []string) {
	if len(s.AZReference) > 0 {
		availablityZoneNames = s.AZReference
	} else {
		availablityZoneNames = append(availablityZoneNames, s.SingletonAvailabilityZoneReference)
	}
	return
}
1369892
func (s *DNSViewSnapshot) ListZones() []DNSZoneInfo {
	var zones []DNSZoneInfo
	for _, z := range s.zoneMap {
		zones = append(zones, DNSZoneInfo{
			Name: z.Name,
		})
	}
	return zones
}
1214669
func (s *Region) SetAvailabilityZones(v []*AvailabilityZone) *Region {
	s.AvailabilityZones = v
	return s
}
34643
func (env *sessionEnviron) AvailabilityZones(ctx context.ProviderCallContext) ([]common.AvailabilityZone, error) {
	if env.zones == nil {
		computeResources, err := env.client.ComputeResources(env.ctx)
		if err != nil {
			HandleCredentialError(err, ctx)
			return nil, errors.Trace(err)
		}
		var zones []common.AvailabilityZone
		for _, cr := range computeResources {
			if cr.Summary.GetComputeResourceSummary().EffectiveCpu == 0 {
				logger.Debugf("skipping empty compute resource %q", cr.Name)
				continue
			}
			pools, err := env.client.ResourcePools(env.ctx, cr.Name+"/...")
			if err != nil {
				HandleCredentialError(err, ctx)
				return nil, errors.Trace(err)
			}
			for _, pool := range pools {
				zone := &vmwareAvailZone{
					r:    *cr,
					pool: pool,
				}
				logger.Tracef("zone: %q", zone.Name())
				zones = append(zones, zone)
			}
		}
		env.zones = zones
	}
	return env.zones, nil
}
511805
func (c *openstackCloud) ListDNSZones(opt zones.ListOptsBuilder) ([]zones.Zone, error) {
	var zs []zones.Zone

	done, err := vfs.RetryWithBackoff(readBackoff, func() (bool, error) {
		allPages, err := zones.List(c.dnsClient, opt).AllPages()
		if err != nil {
			return false, fmt.Errorf("failed to list dns zones: %s", err)
		}
		r, err := zones.ExtractZones(allPages)
		if err != nil {
			return false, fmt.Errorf("failed to extract dns zone pages: %s", err)
		}
		zs = r
		return true, nil
	})
	if err != nil {
		return zs, err
	} else if done {
		return zs, nil
	} else {
		return zs, wait.ErrWaitTimeout
	}
}
944636
func (az *Cloud) isAvailabilityZone(zone string) bool {
	return strings.HasPrefix(zone, fmt.Sprintf("%s-", az.Location))
}
1068995
func (s *TraceSummary) SetAvailabilityZones(v []*AvailabilityZoneDetail) *TraceSummary {
	s.AvailabilityZones = v
	return s
}