// Sets the overwrite status property of the view.
// TODO(.): Couldn't this just be a value in the View's Settings?
164765
func (v *View) OverwriteStatus() bool {
	v.lock.Lock()
	defer v.lock.Unlock()
	return v.overwrite
}
654734
func (cmd *baseCommand) setWrite(policy *WritePolicy, operation OperationType, key *Key, bins []*Bin, binMap BinMap) error {
	cmd.begin()
	fieldCount, err := cmd.estimateKeySize(key, policy.SendKey)
	if err != nil {
		return err
	}

	if binMap == nil {
		for i := range bins {
			if err := cmd.estimateOperationSizeForBin(bins[i]); err != nil {
				return err
			}
		}
	} else {
		for name, value := range binMap {
			if err := cmd.estimateOperationSizeForBinNameAndValue(name, value); err != nil {
				return err
			}
		}
	}

	if err := cmd.sizeBuffer(); err != nil {
		return err
	}

	if binMap == nil {
		cmd.writeHeaderWithPolicy(policy, 0, _INFO2_WRITE, fieldCount, len(bins))
	} else {
		cmd.writeHeaderWithPolicy(policy, 0, _INFO2_WRITE, fieldCount, len(binMap))
	}

	cmd.writeKey(key, policy.SendKey)

	if binMap == nil {
		for i := range bins {
			if err := cmd.writeOperationForBin(bins[i], operation); err != nil {
				return err
			}
		}
	} else {
		for name, value := range binMap {
			if err := cmd.writeOperationForBinNameAndValue(name, value, operation); err != nil {
				return err
			}
		}
	}

	cmd.end()

	return nil
}
756485
func (s *StartBuildInput) SetPrivilegedModeOverride(v bool) *StartBuildInput {
	s.PrivilegedModeOverride = &v
	return s
}
267614
func (s *OperationSummary) SetStatus(v string) *OperationSummary {
	s.Status = &v
	return s
}
428520
func (s *JobTemplate) SetStatusUpdateInterval(v string) *JobTemplate {
	s.StatusUpdateInterval = &v
	return s
}
543458
func (s *Event) SetStatusCode(v string) *Event {
	s.StatusCode = &v
	return s
}
224581
func (s *AssociationDescription) SetOverview(v *AssociationOverview) *AssociationDescription {
	s.Overview = v
	return s
}
1233542
func (w *responseWriter) SetWritten(n int) {
	if n >= NoWritten && n <= StatusCodeWritten {
		w.written = n
	}
}
545734
func (s *VirtualRouterStatus) SetStatus(v string) *VirtualRouterStatus {
	s.Status = &v
	return s
}
1184030
func (s *EndpointSendConfiguration) SetBodyOverride(v string) *EndpointSendConfiguration {
	s.BodyOverride = &v
	return s
}
341143
func (r *GoHeader) SetStatus(statusCode int) {
	if r.isResponse {
		r.Source.(*GoResponse).Original.WriteHeader(statusCode)
	}
}
888020
func (s *ListEndpointsInput) SetStatusEquals(v string) *ListEndpointsInput {
	s.StatusEquals = &v
	return s
}
495783
func Overwrite(src string, content string) error {
	return Trunc(src, func(fd *os.File) error {
		_, err := fd.WriteString(content)

		return err
	})
}
583574
func (s *CreateDevEndpointOutput) SetStatus(v string) *CreateDevEndpointOutput {
	s.Status = &v
	return s
}
795254
func (s *ShareResult) SetStatus(v string) *ShareResult {
	s.Status = &v
	return s
}
9134
func (u ViewUpdate) Apply(v *View) error {
	if err := u.Valid(); err != nil {
		return err
	}

	if u.Name != nil {
		v.Name = *u.Name
	}

	if u.Properties != nil {
		v.Properties = u.Properties
	}

	return nil
}
611169
func (a *Application) SetStatus(statusInfo status.StatusInfo) error {
	if !status.ValidWorkloadStatus(statusInfo.Status) {
		return errors.Errorf("cannot set invalid status %q", statusInfo.Status)
	}

	var newHistory *statusDoc
	m, err := a.st.Model()
	if err != nil {
		return errors.Trace(err)
	}
	if m.Type() == ModelTypeCAAS {
		// Application status for a caas model needs to consider status
		// info coming from the operator pod as well; It may need to
		// override what is set here.
		operatorStatus, err := getStatus(a.st.db(), applicationGlobalOperatorKey(a.Name()), "operator")
		expectWorkload, err := expectWorkload(a.st, a.Name())
		if err != nil {
			return errors.Trace(err)
		}
		if err == nil {
			newHistory, err = caasHistoryRewriteDoc(statusInfo, operatorStatus, expectWorkload, caasApplicationDisplayStatus, a.st.clock())
			if err != nil {
				return errors.Trace(err)
			}
		} else if !errors.IsNotFound(err) {
			return errors.Trace(err)
		}
	}

	return setStatus(a.st.db(), setStatusParams{
		badge:            "application",
		globalKey:        a.globalKey(),
		status:           statusInfo.Status,
		message:          statusInfo.Message,
		rawData:          statusInfo.Data,
		updated:          timeOrNow(statusInfo.Since, a.st.clock()),
		historyOverwrite: newHistory,
	})
}