// AvailabilityZone returns the name of the availability zone into which
// the unit's machine instance was provisioned.
516492
func (u *Unit) AvailabilityZone() (string, error) {
	m, err := u.machine()
	if err != nil {
		return "", errors.Trace(err)
	}
	return m.AvailabilityZone()
}
322042
func (s *PlacementType) SetAvailabilityZones(v []*string) *PlacementType {
	s.AvailabilityZones = v
	return s
}
390664
func (s *CreateLoadBalancerInput) SetAvailabilityZones(v []*string) *CreateLoadBalancerInput {
	s.AvailabilityZones = v
	return s
}
44013
func (s *RaidArray) SetAvailabilityZone(v string) *RaidArray {
	s.AvailabilityZone = &v
	return s
}
708271
func (c *Cloud) GetZone(ctx context.Context) (cloudprovider.Zone, error) {
	return cloudprovider.Zone{
		FailureDomain: c.selfAWSInstance.availabilityZone,
		Region:        c.region,
	}, nil
}
115043
func ConfigureAvailabilityZone(managerConfig container.ManagerConfig, machineZone AvailabilityZoner) (container.ManagerConfig, error) {
	availabilityZone, err := machineZone.AvailabilityZone()
	if err != nil {
		return nil, errors.Trace(err)
	}
	managerConfig[container.ConfigAvailabilityZone] = availabilityZone

	return managerConfig, nil
}
1145279
func (s *SingleInstanceHealth) SetAvailabilityZone(v string) *SingleInstanceHealth {
	s.AvailabilityZone = &v
	return s
}
333232
func (s *ReplicationInstance) SetAvailabilityZone(v string) *ReplicationInstance {
	s.AvailabilityZone = &v
	return s
}
1035495
func (s *RestoreDBInstanceFromDBSnapshotInput) SetAvailabilityZone(v string) *RestoreDBInstanceFromDBSnapshotInput {
	s.AvailabilityZone = &v
	return s
}
568541
func (e *environ) AvailabilityZones(ctx context.ProviderCallContext) ([]common.AvailabilityZone, error) {
	e.availabilityZonesMutex.Lock()
	defer e.availabilityZonesMutex.Unlock()
	if e.availabilityZones == nil {
		filter := ec2.NewFilter()
		filter.Add("region-name", e.cloud.Region)
		resp, err := ec2AvailabilityZones(e.ec2, filter)
		if err != nil {
			return nil, maybeConvertCredentialError(err, ctx)
		}
		logger.Debugf("availability zones: %+v", resp)
		e.availabilityZones = make([]common.AvailabilityZone, len(resp.Zones))
		for i, z := range resp.Zones {
			e.availabilityZones[i] = &ec2AvailabilityZone{z}
		}
	}
	return e.availabilityZones, nil
}
376023
func (o *OracleEnviron) AvailabilityZones(ctx context.ProviderCallContext) ([]common.AvailabilityZone, error) {
	return []common.AvailabilityZone{
		oraclenet.NewAvailabilityZone("default"),
	}, nil
}
1091226
func (m *MockZonedEnviron) AvailabilityZones(arg0 context.ProviderCallContext) ([]common.AvailabilityZone, error) {
	ret := m.ctrl.Call(m, "AvailabilityZones", arg0)
	ret0, _ := ret[0].([]common.AvailabilityZone)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
1036527
func (env *environ) AvailabilityZones(ctx context.ProviderCallContext) ([]common.AvailabilityZone, error) {
	// TODO(dimitern): Fix this properly.
	return []common.AvailabilityZone{
		azShim{"zone1", true},
		azShim{"zone2", false},
		azShim{"zone3", true},
		azShim{"zone4", true},
	}, nil
}
1088949
func (s *DBInstance) SetAvailabilityZone(v string) *DBInstance {
	s.AvailabilityZone = &v
	return s
}
1306331
func (env *environ) InstanceAvailabilityZoneNames(ctx context.ProviderCallContext, ids []instance.Id) ([]string, error) {
	if err := env.checkBroken("InstanceAvailabilityZoneNames"); err != nil {
		return nil, errors.NotSupportedf("instance availability zones")
	}
	availabilityZones, err := env.AvailabilityZones(ctx)
	if err != nil {
		return nil, err
	}
	azMaxIndex := len(availabilityZones) - 1
	azIndex := 0
	returnValue := make([]string, len(ids))
	for i := range ids {
		if availabilityZones[azIndex].Available() {
			returnValue[i] = availabilityZones[azIndex].Name()
		} else {
			// Based on knowledge of how the AZs are setup above
			// in AvailabilityZones()
			azIndex += 1
			returnValue[i] = availabilityZones[azIndex].Name()
		}
		azIndex += 1
		if azIndex == azMaxIndex {
			azIndex = 0
		}
	}
	return returnValue, nil
}
1284842
func (m *MockMachineProvisioner) AvailabilityZone() (string, error) {
	ret := m.ctrl.Call(m, "AvailabilityZone")
	ret0, _ := ret[0].(string)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
488514
func (s *CreateInstancesInput) SetAvailabilityZone(v string) *CreateInstancesInput {
	s.AvailabilityZone = &v
	return s
}