// TargetSeries returns the series that a machine has been locked
// for upgrading to.
548848
func (a *API) TargetSeries(args params.Entities) (params.StringResults, error) {
	result := params.StringResults{}

	canAccess, err := a.AccessMachine()
	if err != nil {
		return result, err
	}

	results := make([]params.StringResult, len(args.Entities))
	for i, entity := range args.Entities {
		machine, err := a.authAndMachine(entity, canAccess)
		if err != nil {
			results[i].Error = common.ServerError(err)
			continue
		}
		target, err := machine.UpgradeSeriesTarget()
		if err != nil {
			results[i].Error = common.ServerError(err)
		}
		results[i].Result = target
	}

	result.Results = results
	return result, nil
}
391745
func (m *MockUpgradeSeriesMachine) Series() string {
	ret := m.ctrl.Call(m, "Series")
	ret0, _ := ret[0].(string)
	return ret0
}
204850
func (s *AutomationExecution) SetTargets(v []*Target) *AutomationExecution {
	s.Targets = v
	return s
}
1308668
func (ix *Reindexer) TargetClient(c *Client) *Reindexer {
	ix.targetClient = c
	return ix
}
1269816
func (i *Instance) updateTargetNetworks(set provider.Ipset, old, new []string) error {

	deleteMap := map[string]bool{}
	for _, net := range old {
		deleteMap[net] = true
	}

	for _, net := range new {
		if _, ok := deleteMap[net]; ok {
			deleteMap[net] = false
			continue
		}
		if err := i.addToIPset(set, net); err != nil {
			return fmt.Errorf("unable to update target set: %s", err)
		}
	}

	for net, delete := range deleteMap {
		if delete {
			if err := i.delFromIPset(set, net); err != nil {
				zap.L().Debug("unable to remove network from set", zap.Error(err))
			}
		}
	}
	return nil
}
539485
func (s *BatchDetachFromIndex) SetTargetReference(v *ObjectReference) *BatchDetachFromIndex {
	s.TargetReference = v
	return s
}
992828
func (s *CreateJobInput) SetTargets(v []*string) *CreateJobInput {
	s.Targets = v
	return s
}
674877
func (s *UpdateMaintenanceWindowTaskOutput) SetTargets(v []*Target) *UpdateMaintenanceWindowTaskOutput {
	s.Targets = v
	return s
}
58052
func (client *Client) UpgradeSeriesComplete(machineName string) error {
	if client.BestAPIVersion() < 5 {
		return errors.NotSupportedf("UpgradeSeriesComplete")
	}
	args := params.UpdateSeriesArg{
		Entity: params.Entity{Tag: names.NewMachineTag(machineName).String()},
	}
	result := new(params.ErrorResult)
	err := client.facade.FacadeCall("UpgradeSeriesComplete", args, result)
	if err != nil {
		return errors.Trace(err)
	}
	if result.Error != nil {
		return result.Error
	}

	return nil
}
554884
func (m *Machine) UpgradeSeriesTarget() (string, error) {
	lock, err := m.getUpgradeSeriesLock()
	if err != nil {
		return "", errors.Trace(err)
	}
	return lock.ToSeries, nil
}
778172
func (s *ListTargetsForPolicyOutput) SetTargets(v []*string) *ListTargetsForPolicyOutput {
	s.Targets = v
	return s
}
868910
func (u *Unit) UpgradeSeriesStatus() (model.UpgradeSeriesStatus, error) {
	res, err := u.st.UpgradeSeriesUnitStatus()
	if err != nil {
		return "", errors.Trace(err)
	}
	if len(res) != 1 {
		return "", errors.Errorf("expected 1 result, got %d", len(res))
	}
	return res[0], nil
}
1188217
func (s *Operation) SetTargets(v map[string]*string) *Operation {
	s.Targets = v
	return s
}
1033110
func Targets(ctx context.Context, log *logrus.Entry) ([]srvcache.Server, error) {
	mu.Lock()
	defer mu.Unlock()

	if resolver == nil {
		return []srvcache.Server{}, fmt.Errorf("no Provisioning Target Resolver registered")
	}

	s := resolver.Targets(ctx, log)

	if len(s) == 0 {
		return []srvcache.Server{}, fmt.Errorf("provisioning target plugin %s returned no servers", Name())
	}

	servers, err := srvcache.StringHostsToServers(s, "nats")
	if err != nil {
		return []srvcache.Server{}, fmt.Errorf("could not determine provisioning servers using %s provisionig target plugin: %s", Name(), err)
	}

	if len(servers) == 0 {
		return []srvcache.Server{}, fmt.Errorf("provisioning broker urls from the %s plugin were not in the valid format, 0 server:port combinations were foundin %v", Name(), s)
	}

	return servers, nil
}
719068
func (s *CreateAssociationBatchRequestEntry) SetTargets(v []*Target) *CreateAssociationBatchRequestEntry {
	s.Targets = v
	return s
}
549783
func (s *UpdateShardCountInput) SetTargetShardCount(v int64) *UpdateShardCountInput {
	s.TargetShardCount = &v
	return s
}
1105233
func (s *CreatePullRequestInput) SetTargets(v []*Target) *CreatePullRequestInput {
	s.Targets = v
	return s
}