// UpgradeOperator upgrades the operator for the specified agents.
778192
func (api *API) UpgradeOperator(arg params.KubernetesUpgradeArg) (params.ErrorResult, error) {
	serverErr := func(err error) params.ErrorResult {
		return params.ErrorResult{common.ServerError(err)}
	}
	tag, err := names.ParseTag(arg.AgentTag)
	if err != nil {
		return serverErr(err), nil
	}
	if !api.auth.AuthOwner(tag) {
		return serverErr(common.ErrPerm), nil
	}
	appName := tag.Id()

	// Machines representing controllers really mean the controller operator.
	if tag.Kind() == names.MachineTagKind {
		appName = bootstrap.ControllerModelName
	}
	logger.Debugf("upgrading caas app %v", appName)
	err = api.broker.Upgrade(appName, arg.Version)
	if err != nil {
		return serverErr(err), nil
	}
	return params.ErrorResult{}, nil
}
270031
func NewWorker(
	upgradeComplete gate.Lock,
	agent agent.Agent,
	apiConn api.Connection,
	jobs []multiwatcher.MachineJob,
	openState func() (*state.StatePool, error),
	preUpgradeSteps func(st *state.StatePool, agentConf agent.Config, isController, isMasterServer, isCaas bool) error,
	machine StatusSetter,
	isCaas bool,
) (worker.Worker, error) {
	w := &upgradesteps{
		upgradeComplete: upgradeComplete,
		agent:           agent,
		apiConn:         apiConn,
		jobs:            jobs,
		openState:       openState,
		preUpgradeSteps: preUpgradeSteps,
		machine:         machine,
		tag:             agent.CurrentConfig().Tag(),
		isCaas:          isCaas,
	}
	w.tomb.Go(w.run)
	return w, nil
}
70455
func (c *Conn) Upgrade(upgrader ConnUpgrader) error {
	// Block reads and writes during the upgrading process
	w := c.createWaiter()
	defer w.Close()

	upgraded, err := upgrader(c.Conn)
	if err != nil {
		return err
	}

	c.Conn = upgraded
	c.init()
	return nil
}
240052
func updateAgentsCommand() *cli.Command {
	return &cli.Command{
		Name:     UpdateAgentsCommandName,
		Usage:    UpdateAgentsCommandUsage,
		Action:   ActionWrapper(updateAgentsAction),
		Category: agentCategory,
		Flags: []cli.Flag{
			cli.StringSliceFlag{Name: "uuid", Usage: "GoCD Agent UUIDs"},
			cli.StringFlag{Name: "state", Usage: "Whether agents are enabled or disabled. Allowed values 'Enabled','Disabled'."},
			cli.StringFlag{Name: "operations", Usage: "JSON encoded config for bulk operation updates."},
		},
	}
}
333521
func (s *Filter) SetOperator(v string) *Filter {
	s.Operator = &v
	return s
}
919455
func (s *ExplainService) DefaultOperator(defaultOperator string) *ExplainService {
	s.defaultOperator = defaultOperator
	return s
}
127193
func (environProvider) UpgradeConfig(cfg *config.Config) (*config.Config, error) {
	return configWithDefaults(cfg)
}
592355
func upgradeTo(binary string, rel Release) error {
	expectedReleases := releaseNames(rel.Tag)
	for _, asset := range rel.Assets {
		assetName := path.Base(asset.Name)
		l.Debugln("considering release", assetName)

		for _, expRel := range expectedReleases {
			if strings.HasPrefix(assetName, expRel) {
				return upgradeToURL(assetName, binary, asset.URL)
			}
		}
	}

	return ErrNoReleaseDownload
}
756778
func Upgrade(lexer Lexer) PeekingLexer {
	if peeking, ok := lexer.(PeekingLexer); ok {
		return peeking
	}
	return &lookaheadLexer{Lexer: lexer}
}
554350
func NewCAASOperatorUpgraderAPI(
	authorizer facade.Authorizer,
	broker caas.Upgrader,
) (*API, error) {
	if !authorizer.AuthController() && !authorizer.AuthApplicationAgent() {
		return nil, common.ErrPerm
	}
	return &API{
		auth:   authorizer,
		broker: broker,
	}, nil
}
1315455
func (c *Context) Upgrade(protocols ...string) (err error) {

	wes := websocket.Upgrader{
		ReadBufferSize:    4096,
		WriteBufferSize:   4096,
		EnableCompression: true,
		Subprotocols:      protocols,
		HandshakeTimeout:  time.Second * 10,
		CheckOrigin: func(r *http.Request) bool {
			return true
		},
	}

	if websocket.IsWebSocketUpgrade(c.Request().Request) {

		var sck *websocket.Conn
		res := c.response
		req := c.request.Request
		pro := websocket.Subprotocols(c.Request().Request)

		if len(protocols) > 0 && !in(protocols, pro) {
			return NewHTTPError(415, "Unsupported Media Type")
		}

		if sck, err = wes.Upgrade(res, req, res.Header()); err != nil {
			return NewHTTPError(426, "Upgrade required")
		}

		c.socket = NewSocket(sck, c, c.Fibre())

		return nil

	}

	return NewHTTPError(426, "Upgrade required")

}
345990
func (s *Rule) SetOperator(v string) *Rule {
	s.Operator = &v
	return s
}
1202829
func (p *Parser) parseOperator() (op string, err error) {
	tok, lit := p.consume()
	switch tok {
	case EqualsToken:
		op = "="
	default:
		return "", fmt.Errorf("found '%s', expected: '='", lit)
	}
	return op, nil
}
813349
func (s *ValidateService) DefaultOperator(defaultOperator string) *ValidateService {
	s.defaultOperator = defaultOperator
	return s
}
341403
func (s *Notification) SetComparisonOperator(v string) *Notification {
	s.ComparisonOperator = &v
	return s
}
242377
func Upgrade(version string) error {
	term.HideCursor()
	defer term.ShowCursor()

	p := &update.Manager{
		Command: "apex",
		Store: &github.Store{
			Owner:   "apex",
			Repo:    "apex",
			Version: version,
		},
	}

	// fetch releases
	releases, err := p.LatestReleases()
	if err != nil {
		return errors.Wrap(err, "fetching latest release")
	}

	// no updates
	if len(releases) == 0 {
		util.LogPad("No updates available, you're good :)")
		return nil
	}

	// latest
	r := releases[0]

	// find the tarball for this system
	a := r.FindTarball(runtime.GOOS, runtime.GOARCH)
	if a == nil {
		return errors.Errorf("failed to find a binary for %s %s", runtime.GOOS, runtime.GOARCH)
	}

	// download tarball to a tmp dir
	tarball, err := a.DownloadProxy(progressreader.New)
	if err != nil {
		return errors.Wrap(err, "downloading tarball")
	}

	// install it
	if err := p.Install(tarball); err != nil {
		return errors.Wrap(err, "installing")
	}

	term.ClearAll()
	util.LogPad("Updated %s to %s", version, r.Version)

	return nil
}
262190
func (cr *Context) SetOperator(op Operator) {
	C.cairo_set_operator(cr.Ptr, C.cairo_operator_t(op))
	if err := cr.status(); err != nil {
		panic(err)
	}
}