// SetUserCustomStatusContext will set a custom status and emoji for the currently authenticated user with a custom context
//
// For more information see SetUserCustomStatus
176944
func (api *Client) SetUserCustomStatusContext(ctx context.Context, statusText, statusEmoji string, statusExpiration int64) error {
	// XXX(theckman): this anonymous struct is for making requests to the Slack
	// API for setting and unsetting a User's Custom Status/Emoji. To change
	// these values we must provide a JSON document as the profile POST field.
	//
	// We use an anonymous struct over UserProfile because to unset the values
	// on the User's profile we cannot use the `json:"omitempty"` tag. This is
	// because an empty string ("") is what's used to unset the values. Check
	// out the API docs for more details:
	//
	// - https://api.slack.com/docs/presence-and-status#custom_status
	profile, err := json.Marshal(
		&struct {
			StatusText       string `json:"status_text"`
			StatusEmoji      string `json:"status_emoji"`
			StatusExpiration int64  `json:"status_expiration"`
		}{
			StatusText:       statusText,
			StatusEmoji:      statusEmoji,
			StatusExpiration: statusExpiration,
		},
	)

	if err != nil {
		return err
	}

	values := url.Values{
		"token":   {api.token},
		"profile": {string(profile)},
	}

	response := &userResponseFull{}
	if err = api.postMethod(ctx, "users.profile.set", values, response); err != nil {
		return err
	}

	return response.Err()
}
618867
func (ctx *ContextRelation) SetStatus(status relation.Status) error {
	return ctx.ru.Relation().SetStatus(status)
}
706392
func (s *CreateQualificationTypeInput) SetQualificationTypeStatus(v string) *CreateQualificationTypeInput {
	s.QualificationTypeStatus = &v
	return s
}
1103860
func (c *Client) SetOperatorStatus(appName string, status status.Status, message string, data map[string]interface{}) error {
	var result params.ErrorResults
	args := params.SetStatus{Entities: []params.EntityStatusArgs{
		{Tag: names.NewApplicationTag(appName).String(), Status: status.String(), Info: message, Data: data},
	}}
	err := c.facade.FacadeCall("SetOperatorStatus", args, &result)
	if err != nil {
		return err
	}
	return result.OneError()
}
756842
func (s *tokenServiceImpl) SetStatusForAllIdentityTokens(ctx context.Context, identityID uuid.UUID, status int) error {
	identity, err := s.Repositories().Identities().LoadWithUser(ctx, identityID)
	if err != nil {
		return err
	}

	// Load all tokens for the identity
	tokens, err := s.Repositories().TokenRepository().ListForIdentity(ctx, identity.ID)
	if err != nil {
		return err
	}

	err = s.ExecuteInTransaction(func() error {
		// Update all the token status flags
		err = s.Repositories().TokenRepository().SetStatusFlagsForIdentity(ctx, identity.ID, status)
		if err != nil {
			log.Error(ctx, map[string]interface{}{
				"err":         err,
				"identity_id": identity.ID,
			}, "Unable to update status values for identity.")
			return err
		}
		return nil
	})

	log.Debug(ctx, map[string]interface{}{
		"identity_id": identity.ID,
		"tokens":      len(tokens),
	}, "Updated all token status values for identity.")

	return err
}
524277
func (s *TaskExecutionResultDetail) SetVerifyStatus(v string) *TaskExecutionResultDetail {
	s.VerifyStatus = &v
	return s
}
48615
func (k *KeybaseDaemonLocal) NotifySyncStatus(ctx context.Context,
	_ *keybase1.FSPathSyncStatus) error {
	return checkContext(ctx)
}
154872
func (s *TestInvokeAuthorizerOutput) SetClientStatus(v int64) *TestInvokeAuthorizerOutput {
	s.ClientStatus = &v
	return s
}
1167361
func (s *DomainValidation) SetValidationStatus(v string) *DomainValidation {
	s.ValidationStatus = &v
	return s
}
862026
func (client *Client) SetUserContext(u *User) {
	client.mu.Lock()
	defer client.mu.Unlock()
	client.context.setUser(u)
}
908729
func (c *Context) SetStatus(class, id, status string) error {
	fullID := payload.BuildID(class, id)
	logger.Tracef("Calling status-set on payload context %q", fullID)

	res, err := c.api.SetStatus(status, fullID)
	if err != nil {
		return errors.Trace(err)
	}
	// TODO(ericsnow) We should not ignore a 0-len result.
	if len(res) > 0 && res[0].Error != nil {
		// In a hook context, the case where the specified payload does
		// not exist is a special one. A hook tool is how a charm author
		// communicates the state of the charm. So returning an error
		// here in the "missing" case makes less sense than in other
		// places. We could simply ignore any error that surfaces for
		// that case. However, returning the error communicates to the
		// charm author that what they're trying to communicate doesn't
		// make sense.
		return errors.Trace(res[0].Error)
	}

	return nil
}
1147360
func (s *CreateAccountOutput) SetCreateAccountStatus(v *CreateAccountStatus) *CreateAccountOutput {
	s.CreateAccountStatus = v
	return s
}
716746
func (s *RespondToAuthChallengeInput) SetUserContextData(v *UserContextDataType) *RespondToAuthChallengeInput {
	s.UserContextData = v
	return s
}
1315514
func (m *Machine) SetInstanceStatus(sInfo status.StatusInfo) (err error) {
	return setStatus(m.st.db(), setStatusParams{
		badge:     "instance",
		globalKey: m.globalInstanceKey(),
		status:    sInfo.Status,
		message:   sInfo.Message,
		rawData:   sInfo.Data,
		updated:   timeOrNow(sInfo.Since, m.st.clock()),
	})
}
677115
func (c *Client) SetAuthorizationStatus(ctx context.Context, id platform.ID, status platform.Status) error {
	return c.db.Update(func(tx *bolt.Tx) error {
		if pe := c.updateAuthorization(ctx, tx, id, status); pe != nil {
			return &platform.Error{
				Err: pe,
				Op:  platform.OpSetAuthorizationStatus,
			}
		}
		return nil
	})
}
27753
func (sys *IAMSys) SetUserStatus(accessKey string, status madmin.AccountStatus) error {
	objectAPI := newObjectLayerFn()
	if objectAPI == nil {
		return errServerNotInitialized
	}

	if status != madmin.AccountEnabled && status != madmin.AccountDisabled {
		return errInvalidArgument
	}

	sys.Lock()
	defer sys.Unlock()

	cred, ok := sys.iamUsersMap[accessKey]
	if !ok {
		return errNoSuchUser
	}

	uinfo := madmin.UserInfo{
		SecretKey: cred.SecretKey,
		Status:    status,
	}

	configFile := pathJoin(iamConfigUsersPrefix, accessKey, iamIdentityFile)
	data, err := json.Marshal(uinfo)
	if err != nil {
		return err
	}

	if globalEtcdClient != nil {
		err = saveConfigEtcd(context.Background(), globalEtcdClient, configFile, data)
	} else {
		err = saveConfig(context.Background(), objectAPI, configFile, data)
	}

	if err != nil {
		return err
	}

	sys.iamUsersMap[accessKey] = auth.Credentials{
		AccessKey: accessKey,
		SecretKey: uinfo.SecretKey,
		Status:    string(uinfo.Status),
	}

	return nil
}
1371200
func (f *FirewallerAPIV4) SetRelationsStatus(args params.SetStatus) (params.ErrorResults, error) {
	var result params.ErrorResults
	result.Results = make([]params.ErrorResult, len(args.Entities))
	for i, entity := range args.Entities {
		relationTag, err := names.ParseRelationTag(entity.Tag)
		if err != nil {
			result.Results[i].Error = common.ServerError(err)
			continue
		}
		rel, err := f.st.KeyRelation(relationTag.Id())
		if err != nil {
			result.Results[i].Error = common.ServerError(err)
			continue
		}
		err = rel.SetStatus(status.StatusInfo{
			Status:  status.Status(entity.Status),
			Message: entity.Info,
		})
		result.Results[i].Error = common.ServerError(err)
	}
	return result, nil
}