// colorizeUpdateMessage - inspired from Yeoman project npm package https://github.com/yeoman/update-notifier
488405
func colorizeUpdateMessage(updateString string, newerThan string) string {
	msgLine1Fmt := " You are running an older version of mc released %s "
	msgLine2Fmt := " Update: %s "

	// Calculate length *without* color coding: with ANSI terminal
	// color characters, the result is incorrect.
	line1Length := len(fmt.Sprintf(msgLine1Fmt, newerThan))
	line2Length := len(fmt.Sprintf(msgLine2Fmt, updateString))

	// Populate lines with color coding.
	line1InColor := fmt.Sprintf(msgLine1Fmt, colorYellowBold(newerThan))
	line2InColor := fmt.Sprintf(msgLine2Fmt, colorCyanBold(updateString))

	// calculate the rectangular box size.
	maxContentWidth := int(math.Max(float64(line1Length), float64(line2Length)))

	// termWidth is set to a default one to use when we are
	// not able to calculate terminal width via OS syscalls
	termWidth := 25
	if width, err := pb.GetTerminalWidth(); err == nil {
		termWidth = width
	}

	// Box cannot be printed if terminal width is small than maxContentWidth
	if maxContentWidth > termWidth {
		return "\n" + line1InColor + "\n" + line2InColor + "\n\n"
	}

	topLeftChar := "┏"
	topRightChar := "┓"
	bottomLeftChar := "┗"
	bottomRightChar := "┛"
	horizBarChar := "━"
	vertBarChar := "┃"
	// on windows terminal turn off unicode characters.
	if runtime.GOOS == "windows" {
		topLeftChar = "+"
		topRightChar = "+"
		bottomLeftChar = "+"
		bottomRightChar = "+"
		horizBarChar = "-"
		vertBarChar = "|"
	}

	lines := []string{
		colorYellowBold(topLeftChar + strings.Repeat(horizBarChar, maxContentWidth) + topRightChar),
		vertBarChar + line1InColor + strings.Repeat(" ", maxContentWidth-line1Length) + vertBarChar,
		vertBarChar + line2InColor + strings.Repeat(" ", maxContentWidth-line2Length) + vertBarChar,
		colorYellowBold(bottomLeftChar + strings.Repeat(horizBarChar, maxContentWidth) + bottomRightChar),
	}
	return "\n" + strings.Join(lines, "\n") + "\n"
}
543907
func (s *CommonStorageDB) ApplyUpdates(batch *statedb.UpdateBatch, height *version.Height) error {
	return errors.New("this function should not be invoked on this type. Please invoke function ApplyPrivacyAwareUpdates")
}
389239
func (projectStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
	return validation.ValidateProjectUpdate(obj.(*projectapi.Project), old.(*projectapi.Project))
}
1144328
func (this *NotifyNotification) Update(summary, body, icon string) bool {
	return NotificationUpdate(this, summary, body, icon)
}
62781
func (a *API) UpdateNotification(user int, notification *Notification) (*Notification, error) {
	dst := new(Notification)
	url := a.BuildURL("/v2/user/%d/notification/%d", user, notification.Id)
	err := a.Put(url, Params{}, notification, dst)
	return dst, err
}
445779
func New(foreground, background Color) Colorize {
	return Colorize{
		Foreground: foreground,
		Background: background,
	}
}
399773
func Update(c *messagebird.Client, id string, req *UpdateRequest) (*Conversation, error) {
	conv := &Conversation{}
	if err := request(c, conv, http.MethodPatch, path+"/"+id, req); err != nil {
		return nil, err
	}

	return conv, nil
}
1176138
func (s *AgentsService) BulkUpdate(ctx context.Context, agents AgentBulkUpdate) (message string, resp *APIResponse, err error) {
	a := StringResponse{}
	_, resp, err = s.client.patchAction(ctx, &APIClientRequest{
		Path:         "agents",
		APIVersion:   apiV4,
		ResponseBody: &a,
		RequestBody:  agents,
	})
	message = a.Message
	return
}
1217744
func checkUpdate(mode string) {
	// Its OK to ignore any errors during doUpdate() here.
	if updateMsg, _, currentReleaseTime, latestReleaseTime, err := getUpdateInfo(2*time.Second, mode); err == nil {
		if globalInplaceUpdateDisabled {
			logger.StartupMessage(updateMsg)
		} else {
			logger.StartupMessage(prepareUpdateMessage("Run `minio update`", latestReleaseTime.Sub(currentReleaseTime)))
		}
	}
}
711278
func (s *LabelService) UpdateLabel(ctx context.Context, id platform.ID, upd platform.LabelUpdate) (*platform.Label, error) {
	return s.UpdateLabelFn(ctx, id, upd)
}
710419
func (b *Local) Colorize() *colorstring.Colorize {
	if b.CLIColor != nil {
		return b.CLIColor
	}

	return &colorstring.Colorize{
		Colors:  colorstring.DefaultColors,
		Disable: true,
	}
}
414959
func (r ResourceEventHandlerFuncs) OnUpdate(oldObj, newObj interface{}) {
	if r.UpdateFunc != nil {
		r.UpdateFunc(oldObj, newObj)
	}
}
383774
func Update(c *messagebird.Client, id string, contactRequest *Request) (*Contact, error) {
	contact := &Contact{}
	if err := c.Request(contact, http.MethodPatch, path+"/"+id, contactRequest); err != nil {
		return nil, err
	}

	return contact, nil
}
749061
func (m *Machine) GetUpgradeSeriesMessages() ([]string, bool, error) {
	lock, err := m.getUpgradeSeriesLock()
	if errors.IsNotFound(err) {
		// If the lock is not found here then there are no more messages
		return nil, true, nil
	}
	if err != nil {
		return nil, false, errors.Trace(err)
	}
	// finished means that a subsequent call to this method, while the
	// Machine Lock is of a similar Machine Status, would return no
	// additional messages (notifications). Since the value of this variable
	// is returned, callers may choose to close streams or stop watchers
	// based on this information.
	finished := lock.MachineStatus == model.UpgradeSeriesCompleted ||
		lock.MachineStatus == model.UpgradeSeriesPrepareCompleted
	// Filter seen messages
	unseenMessages := make([]UpgradeSeriesMessage, 0)
	for _, upgradeSeriesMessage := range lock.Messages {
		if !upgradeSeriesMessage.Seen {
			unseenMessages = append(unseenMessages, upgradeSeriesMessage)
		}
	}
	if len(unseenMessages) == 0 {
		return []string{}, finished, nil
	}
	sort.Slice(unseenMessages, func(i, j int) bool {
		return unseenMessages[i].Timestamp.Before(unseenMessages[j].Timestamp)
	})
	messages := make([]string, 0)
	for _, unseenMessage := range unseenMessages {
		messages = append(messages, unseenMessage.Message)
	}
	err = m.SetUpgradeSeriesMessagesAsSeen(lock.Messages)
	if err != nil {
		return nil, false, errors.Trace(err)
	}
	return messages, finished, nil
}
650607
func NewMessage(hdr *Header, msg []byte) *Message {
	var h Header
	if hdr != nil {
		h = *hdr
	}

	if h.Timestamp.IsZero() {
		h.Timestamp = time.Now().UTC()
	}

	if h.Version == 0 {
		h.Version = 1
	}

	if msg != nil {
		m := make([]byte, len(msg))
		copy(m, msg)
		msg = m
	}

	return &Message{Header: h, Msg: msg}
}
636549
func (r rmMessage) String() string {
	return console.Colorize("Remove", fmt.Sprintf("Removing `%s`.", r.Key))
}
1140256
func SimpleUpdate(fn SimpleUpdateFunc) UpdateFunc {
	return func(input runtime.Object, _ ResponseMeta) (runtime.Object, *uint64, error) {
		out, err := fn(input)
		return out, nil, err
	}
}