// AvailabilityZone implements MachineProvisioner.AvailabilityZone.
550954
func (m *Machine) AvailabilityZone() (string, error) {
	var results params.StringResults
	args := params.Entities{
		Entities: []params.Entity{{Tag: m.tag.String()}},
	}
	err := m.st.facade.FacadeCall("AvailabilityZone", args, &results)
	if err != nil {
		return "", err
	}
	if len(results.Results) != 1 {
		return "", fmt.Errorf("expected 1 result, got %d", len(results.Results))
	}
	result := results.Results[0]
	if result.Error != nil {
		return "", result.Error
	}
	return result.Result, nil
}
1222914
func (s *ListedFlow) SetAvailabilityZone(v string) *ListedFlow {
	s.AvailabilityZone = &v
	return s
}
1084095
func (s *DecreaseReplicationFactorInput) SetAvailabilityZones(v []*string) *DecreaseReplicationFactorInput {
	s.AvailabilityZones = v
	return s
}
757575
func (s *NodeConfiguration) SetAvailabilityZone(v string) *NodeConfiguration {
	s.AvailabilityZone = &v
	return s
}
981896
func (s *Event) SetAvailabilityZone(v string) *Event {
	s.AvailabilityZone = &v
	return s
}
1275713
func NewZone(name, status, state, replacement string) AvailabilityZone {
	zone := &compute.Zone{
		Name:   name,
		Status: status,
	}
	if state != "" {
		zone.Deprecated = &compute.DeprecationStatus{
			State:       state,
			Replacement: replacement,
		}
	}
	return AvailabilityZone{zone: zone}
}
944636
func (az *Cloud) isAvailabilityZone(zone string) bool {
	return strings.HasPrefix(zone, fmt.Sprintf("%s-", az.Location))
}
575063
func (s *DBCluster) SetAvailabilityZones(v []*string) *DBCluster {
	s.AvailabilityZones = v
	return s
}
120450
func (v *VM) SetZone(zone string) {
	for _, disk := range v.GetDisk() {
		disk.Type = strings.Replace(disk.Type, "{{.Zone}}", zone, -1)
	}
	v.MachineType = strings.Replace(v.GetMachineType(), "{{.Zone}}", zone, -1)
	v.Zone = zone
}
531040
func (s *RestoreFromClusterSnapshotInput) SetAvailabilityZone(v string) *RestoreFromClusterSnapshotInput {
	s.AvailabilityZone = &v
	return s
}
1145279
func (s *SingleInstanceHealth) SetAvailabilityZone(v string) *SingleInstanceHealth {
	s.AvailabilityZone = &v
	return s
}
816134
func (api *HostsAPI) SetAvailabilityZone(id string, availabilityZone *HostSetAvailabilityZoneOperation) (task *Task, err error) {
	body, err := json.Marshal(availabilityZone)
	if err != nil {
		return
	}

	res, err := api.client.restClient.Post(
		api.client.Endpoint+hostUrl+"/"+id+"/set_availability_zone",
		"application/json",
		bytes.NewReader(body),
		api.client.options.TokenOptions)

	if err != nil {
		return
	}

	defer res.Body.Close()
	task, err = getTask(getError(res))
	return
}
1017817
func (s *VPCDerivedInfo) SetAvailabilityZones(v []*string) *VPCDerivedInfo {
	s.AvailabilityZones = v
	return s
}
222405
func (s *CreateFlowInput) SetAvailabilityZone(v string) *CreateFlowInput {
	s.AvailabilityZone = &v
	return s
}
1123865
func (s *CreateClusterInput) SetAvailabilityZone(v string) *CreateClusterInput {
	s.AvailabilityZone = &v
	return s
}
1284842
func (m *MockMachineProvisioner) AvailabilityZone() (string, error) {
	ret := m.ctrl.Call(m, "AvailabilityZone")
	ret0, _ := ret[0].(string)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
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
}