// DeriveAvailabilityZones is part of the common.ZonedEnviron interface.
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
}
376243
func (s *NodeSummary) SetAvailabilityZone(v string) *NodeSummary {
	s.AvailabilityZone = &v
	return s
}
1084095
func (s *DecreaseReplicationFactorInput) SetAvailabilityZones(v []*string) *DecreaseReplicationFactorInput {
	s.AvailabilityZones = v
	return s
}
1164499
func (s *Hsm) SetAvailabilityZone(v string) *Hsm {
	s.AvailabilityZone = &v
	return s
}
1357813
func (env *sessionEnviron) DeriveAvailabilityZones(ctx context.ProviderCallContext, args environs.StartInstanceParams) ([]string, error) {
	if args.Placement != "" {
		// args.Placement will always be a zone name or empty.
		placement, err := env.parsePlacement(ctx, args.Placement)
		if err != nil {
			return nil, errors.Trace(err)
		}
		if placement.Name() != "" {
			return []string{placement.Name()}, nil
		}
	}
	return nil, nil
}
488514
func (s *CreateInstancesInput) SetAvailabilityZone(v string) *CreateInstancesInput {
	s.AvailabilityZone = &v
	return s
}
333232
func (s *ReplicationInstance) SetAvailabilityZone(v string) *ReplicationInstance {
	s.AvailabilityZone = &v
	return s
}
1016671
func (s *CreateReplicationInstanceInput) SetAvailabilityZone(v string) *CreateReplicationInstanceInput {
	s.AvailabilityZone = &v
	return s
}
1307593
func (env *sessionEnviron) InstanceAvailabilityZoneNames(ctx context.ProviderCallContext, ids []instance.Id) ([]string, error) {
	zones, err := env.AvailabilityZones(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	instances, err := env.Instances(ctx, ids)
	switch err {
	case nil, environs.ErrPartialInstances:
		break
	case environs.ErrNoInstances:
		return nil, err
	default:
		return nil, errors.Trace(err)
	}

	results := make([]string, len(ids))
	for i, inst := range instances {
		if inst == nil {
			continue
		}
		vm := inst.(*environInstance).base
		for _, zone := range zones {
			pool := zone.(*vmwareAvailZone).pool
			if pool.Reference().Value == vm.ResourcePool.Value {
				results[i] = zone.Name()
				break
			}
		}
	}
	return results, err
}
1035495
func (s *RestoreDBInstanceFromDBSnapshotInput) SetAvailabilityZone(v string) *RestoreDBInstanceFromDBSnapshotInput {
	s.AvailabilityZone = &v
	return s
}
1250872
func (s *ElasticLoadBalancer) SetAvailabilityZones(v []*string) *ElasticLoadBalancer {
	s.AvailabilityZones = v
	return s
}
207758
func (s *CreateHsmInput) SetAvailabilityZone(v string) *CreateHsmInput {
	s.AvailabilityZone = &v
	return s
}
161753
func (s *DBSnapshot) SetAvailabilityZone(v string) *DBSnapshot {
	s.AvailabilityZone = &v
	return s
}
1368161
func (s *ConfigurationItem) SetAvailabilityZone(v string) *ConfigurationItem {
	s.AvailabilityZone = &v
	return s
}
206686
func (s *CreateDevEndpointOutput) SetAvailabilityZone(v string) *CreateDevEndpointOutput {
	s.AvailabilityZone = &v
	return s
}
44013
func (s *RaidArray) SetAvailabilityZone(v string) *RaidArray {
	s.AvailabilityZone = &v
	return s
}
1206862
func (e *environ) InstanceAvailabilityZoneNames(ctx context.ProviderCallContext, ids []instance.Id) ([]string, error) {
	instances, err := e.Instances(ctx, ids)
	if err != nil && err != environs.ErrPartialInstances {
		return nil, err
	}
	zones := make([]string, len(instances))
	for i, inst := range instances {
		if inst == nil {
			continue
		}
		zones[i] = inst.(*ec2Instance).AvailZone
	}
	return zones, err
}