// UpdateAgentAction updates a single agent.
421460
func updateAgentAction(client *gocd.Client, c *cli.Context) (v interface{}, resp *gocd.APIResponse, err error) {

	if c.String("uuid") == "" {
		return nil, nil, NewFlagError("uuid")
	}

	if c.String("config") == "" {
		return nil, nil, NewFlagError("config")
	}

	a := &gocd.Agent{}
	b := []byte(c.String("config"))
	if err := json.Unmarshal(b, &a); err != nil {
		return nil, nil, err
	}

	return client.Agents.Update(context.Background(), c.String("uuid"), a)
}
1359359
func deleteAgentAction(client *gocd.Client, c *cli.Context) (v interface{}, resp *gocd.APIResponse, err error) {
	if c.String("uuid") == "" {
		return nil, nil, NewFlagError("uuid")
	}

	deleteResponse, r, err := client.Agents.Delete(context.Background(), c.String("uuid"))
	if r.HTTP.StatusCode == 406 {
		err = errors.New(deleteResponse)
	}
	return deleteResponse, r, err
}
421181
func (s *DeleteAgentInput) SetAgentArn(v string) *DeleteAgentInput {
	s.AgentArn = &v
	return s
}
1346900
func (s *AgentListEntry) SetAgentArn(v string) *AgentListEntry {
	s.AgentArn = &v
	return s
}
583927
func (c *Cache) UpdateAge() {
	c.mu.RLock()
	defer c.mu.RUnlock()
	c.tracker.SetAge(time.Since(c.lastSnapshot))
}
1305418
func (e *UpgradeReadyError) ChangeAgentTools() error {
	agentTools, err := tools.ChangeAgentTools(e.DataDir, e.AgentName, e.NewTools)
	if err != nil {
		return err
	}
	logger.Infof("upgraded from %v to %v (%q)", e.OldTools, agentTools.Version, agentTools.URL)
	return nil
}
1284417
func (self *simplePBundle) UpdateSession(i interface{}) (Session, error) {
	return self.mgr.Update(self.s, i)
}
476821
func (c *ServerContext) SetAgent(a agent.Agent, channel ssh.Channel) {
	c.Lock()
	defer c.Unlock()
	if c.agentChannel != nil {
		c.Infof("closing previous agent channel")
		c.agentChannel.Close()
	}
	c.agentChannel = channel
	c.agent = a
}
37778
func (s *UpdateInstanceInput) SetAgentVersion(v string) *UpdateInstanceInput {
	s.AgentVersion = &v
	return s
}
1367757
func (s *AgentsService) Update(ctx context.Context, uuid string, agent *Agent) (*Agent, *APIResponse, error) {
	return s.handleAgentRequest(ctx, "PATCH", uuid, agent)
}
1150212
func (inode *Inode) updateXattr() (err error) {
	err = copyObjectMaybeMultipart(inode.fs, int64(inode.Attributes.Size),
		*inode.FullName(), *inode.FullName(),
		aws.String(string(inode.s3Metadata["etag"])), convertMetadata(inode.userMetadata))
	return
}
762656
func (agent *ActionAgent) refreshTablet(ctx context.Context, reason string) error {
	agent.checkLock()
	log.Infof("Executing post-action state refresh: %v", reason)

	span, ctx := trace.NewSpan(ctx, "ActionAgent.refreshTablet")
	span.Annotate("reason", reason)
	defer span.Finish()

	// Actions should have side effects on the tablet, so reload the data.
	ti, err := agent.TopoServer.GetTablet(ctx, agent.TabletAlias)
	if err != nil {
		log.Warningf("Failed rereading tablet after %v - services may be inconsistent: %v", reason, err)
		return vterrors.Wrapf(err, "refreshTablet failed rereading tablet after %v", reason)
	}
	tablet := ti.Tablet

	// Also refresh the MySQL port, to be sure it's correct.
	// Note if this run doesn't succeed, the healthcheck go routine
	// will try again.
	agent.gotMysqlPort = false
	agent.waitingForMysql = false
	if updatedTablet := agent.checkTabletMysqlPort(ctx, tablet); updatedTablet != nil {
		tablet = updatedTablet
	}

	agent.updateState(ctx, tablet, reason)
	log.Infof("Done with post-action state refresh")
	return nil
}
202197
func (s *DescribeAgentInput) SetAgentArn(v string) *DescribeAgentInput {
	s.AgentArn = &v
	return s
}
96919
func (s *UpdateStackInput) SetAgentVersion(v string) *UpdateStackInput {
	s.AgentVersion = &v
	return s
}
620717
func NewUpdateTenant(config tenantConfig) func(context.Context) error {
	return func(ctx context.Context) error {
		return UpdateTenant(ctx, config)
	}
}
1213138
func getAgentAction(client *gocd.Client, c *cli.Context) (v interface{}, resp *gocd.APIResponse, err error) {
	agent, r, err := client.Agents.Get(context.Background(), c.String("uuid"))
	if r.HTTP.StatusCode != 404 {
		agent.RemoveLinks()
	}
	return agent, r, err
}
1354015
func (s *Service) UpdateAnnotation(w http.ResponseWriter, r *http.Request) {
	id, err := paramID("id", r)
	if err != nil {
		Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
		return
	}

	annoID, err := paramStr("aid", r)
	if err != nil {
		Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
		return
	}

	ctx := r.Context()
	src, err := s.Store.Sources(ctx).Get(ctx, id)
	if err != nil {
		notFound(w, id, s.Logger)
		return
	}

	ts, err := s.TimeSeries(src)
	if err != nil {
		msg := fmt.Sprintf("unable to connect to source %d: %v", id, err)
		Error(w, http.StatusBadRequest, msg, s.Logger)
		return
	}

	if err = ts.Connect(ctx, &src); err != nil {
		msg := fmt.Sprintf("unable to connect to source %d: %v", id, err)
		Error(w, http.StatusBadRequest, msg, s.Logger)
		return
	}

	store := influx.NewAnnotationStore(ts)
	cur, err := store.Get(ctx, annoID)
	if err != nil {
		notFound(w, annoID, s.Logger)
		return
	}

	var req updateAnnotationRequest
	if err = json.NewDecoder(r.Body).Decode(&req); err != nil {
		invalidJSON(w, s.Logger)
		return
	}

	if req.StartTime != nil {
		cur.StartTime = *req.StartTime
	}
	if req.EndTime != nil {
		cur.EndTime = *req.EndTime
	}
	if req.Text != nil {
		cur.Text = *req.Text
	}
	if req.Type != nil {
		cur.Type = *req.Type
	}

	if err = store.Update(ctx, cur); err != nil {
		if err == chronograf.ErrUpstreamTimeout {
			msg := "Timeout waiting for response"
			Error(w, http.StatusRequestTimeout, msg, s.Logger)
			return
		}
		Error(w, http.StatusBadRequest, err.Error(), s.Logger)
		return
	}

	res := newAnnotationResponse(src, cur)
	location(w, res.Links.Self)
	encodeJSON(w, http.StatusOK, res, s.Logger)
}