// SetRelationStatus updates the status of the specified relations.
421531
func (u *UniterAPI) SetRelationStatus(args params.RelationStatusArgs) (params.ErrorResults, error) {
	var statusResults params.ErrorResults

	unitCache := make(map[string]*state.Unit)
	getUnit := func(tag string) (*state.Unit, error) {
		if unit, ok := unitCache[tag]; ok {
			return unit, nil
		}
		unitTag, err := names.ParseUnitTag(tag)
		if err != nil {
			return nil, errors.Trace(err)
		}
		unit, err := u.st.Unit(unitTag.Id())
		if errors.IsNotFound(err) {
			return nil, common.ErrPerm
		}
		if err != nil {
			return nil, errors.Trace(err)
		}
		unitCache[tag] = unit
		return unit, nil
	}

	checker := u.leadershipChecker
	changeOne := func(arg params.RelationStatusArg) error {
		// TODO(wallyworld) - the token should be passed to SetStatus() but the
		// interface method doesn't allow for that yet.
		unitTag := arg.UnitTag
		if unitTag == "" {
			// Older clients don't pass in the unit tag explicitly.
			unitTag = u.auth.GetAuthTag().String()
		}
		unit, err := getUnit(unitTag)
		if err != nil {
			return err
		}
		token := checker.LeadershipCheck(unit.ApplicationName(), unit.Name())
		if err := token.Check(0, nil); err != nil {
			return errors.Trace(err)
		}

		rel, err := u.st.Relation(arg.RelationId)
		if errors.IsNotFound(err) {
			return common.ErrPerm
		} else if err != nil {
			return errors.Trace(err)
		}
		_, err = rel.Unit(unit)
		if errors.IsNotFound(err) {
			return common.ErrPerm
		} else if err != nil {
			return errors.Trace(err)
		}
		// If we are transitioning from "suspending" to "suspended",
		// we retain any existing message so that if the user has
		// previously specified a reason for suspending, it is retained.
		message := arg.Message
		if message == "" && arg.Status == params.Suspended {
			current, err := rel.Status()
			if err != nil {
				return errors.Trace(err)
			}
			if current.Status == status.Suspending {
				message = current.Message
			}
		}
		return rel.SetStatus(status.StatusInfo{
			Status:  status.Status(arg.Status),
			Message: message,
		})
	}
	results := make([]params.ErrorResult, len(args.Args))
	for i, arg := range args.Args {
		err := changeOne(arg)
		results[i].Error = common.ServerError(err)
	}
	statusResults.Results = results
	return statusResults, nil
}
608948
func (s *ElasticIpStatus) SetStatus(v string) *ElasticIpStatus {
	s.Status = &v
	return s
}
348997
func (s *Shipment) SetStatus(v string) *Shipment {
	s.Status = &v
	return s
}
411844
func setStatus(ctx *context, statuses []params.EntityStatusArgs) {
	if len(statuses) > 0 {
		if err := ctx.config.Status.SetStatus(statuses); err != nil {
			logger.Errorf("failed to set status: %v", err)
		}
	}
}
1061914
func (s *GetContactReachabilityStatusOutput) SetStatus(v string) *GetContactReachabilityStatusOutput {
	s.Status = &v
	return s
}
845071
func (s *VirtualServiceData) SetStatus(v *VirtualServiceStatus) *VirtualServiceData {
	s.Status = v
	return s
}
481397
func (s *DBClusterEndpoint) SetStatus(v string) *DBClusterEndpoint {
	s.Status = &v
	return s
}
1209805
func (st *State) SetStatus(args []params.EntityStatusArgs) error {
	var result params.ErrorResults
	err := st.facade.FacadeCall("SetStatus", params.SetStatus{args}, &result)
	if err != nil {
		return err
	}
	return result.Combine()
}
712757
func (s *ChannelSummary) SetStatus(v string) *ChannelSummary {
	s.Status = &v
	return s
}
436327
func (s *InstanceGroup) SetStatus(v *InstanceGroupStatus) *InstanceGroup {
	s.Status = v
	return s
}
1185763
func (s *EntityRecognizerFilter) SetStatus(v string) *EntityRecognizerFilter {
	s.Status = &v
	return s
}
210877
func (s *SendBulkTemplatedEmailOutput) SetStatus(v []*BulkEmailDestinationStatus) *SendBulkTemplatedEmailOutput {
	s.Status = v
	return s
}
770615
func (s *SigningProfile) SetStatus(v string) *SigningProfile {
	s.Status = &v
	return s
}
694545
func (s *ClusterSecurityGroupMembership) SetStatus(v string) *ClusterSecurityGroupMembership {
	s.Status = &v
	return s
}
723545
func (s *MatchmakingTicket) SetStatus(v string) *MatchmakingTicket {
	s.Status = &v
	return s
}
1099348
func (s *AccessKeyMetadata) SetStatus(v string) *AccessKeyMetadata {
	s.Status = &v
	return s
}
322396
func (s *AccountGateResult) SetStatus(v string) *AccountGateResult {
	s.Status = &v
	return s
}