// setCondition saves the status of a condition, if it's new
// information. New information is something that adds or changes the
// status, reason or message (i.e., anything but the transition time)
// for one of the types of condition.
344144
func (chs *ChartChangeSync) setCondition(fhr fluxv1beta1.HelmRelease, typ fluxv1beta1.HelmReleaseConditionType, st v1.ConditionStatus, reason, message string) error {
	for _, c := range fhr.Status.Conditions {
		if c.Type == typ && c.Status == st && c.Message == message && c.Reason == reason {
			return nil
		}
	}

	fhrClient := chs.ifClient.FluxV1beta1().HelmReleases(fhr.Namespace)
	cond := fluxv1beta1.HelmReleaseCondition{
		Type:               typ,
		Status:             st,
		LastTransitionTime: metav1.Now(),
		Reason:             reason,
		Message:            message,
	}
	return status.UpdateConditions(fhrClient, fhr, cond)
}
648481
func (s *Filter) SetCondition(v string) *Filter {
	s.Condition = &v
	return s
}
1312851
func (s *PutIntentOutput) SetConfirmationPrompt(v *Prompt) *PutIntentOutput {
	s.ConfirmationPrompt = v
	return s
}
1212254
func SetCondition(status *v1.ReplicationControllerStatus, condition v1.ReplicationControllerCondition) {
	currentCond := GetCondition(*status, condition.Type)
	if currentCond != nil && currentCond.Status == condition.Status && currentCond.Reason == condition.Reason {
		return
	}
	newConditions := filterOutCondition(status.Conditions, condition.Type)
	status.Conditions = append(newConditions, condition)
}
280239
func (s *Condition) SetConditionType(v string) *Condition {
	s.ConditionType = &v
	return s
}
49309
func (s *DescribeCompilationJobOutput) SetStoppingCondition(v *StoppingCondition) *DescribeCompilationJobOutput {
	s.StoppingCondition = v
	return s
}
330612
func SetNodeCondition(c clientset.Interface, node types.NodeName, condition v1.NodeCondition) error {
	generatePatch := func(condition v1.NodeCondition) ([]byte, error) {
		raw, err := json.Marshal(&[]v1.NodeCondition{condition})
		if err != nil {
			return nil, err
		}
		return []byte(fmt.Sprintf(`{"status":{"conditions":%s}}`, raw)), nil
	}
	condition.LastHeartbeatTime = metav1.NewTime(time.Now())
	patch, err := generatePatch(condition)
	if err != nil {
		return nil
	}
	_, err = c.CoreV1().Nodes().PatchStatus(string(node), patch)
	return err
}
1303316
func (s *GetDocumentOutput) SetStatusInformation(v string) *GetDocumentOutput {
	s.StatusInformation = &v
	return s
}
1282106
func (c Condition) SetError(err error) {
	if err != nil {
		cond := amqp.MakeError(err)
		c.SetName(cond.Name)
		c.SetDescription(cond.Description)
	}
}
1166355
func (p *ProtoCommand) PreCondition(state State) bool {
	if p.PreConditionFunc != nil {
		return p.PreConditionFunc(state)
	}
	return true
}
179362
func (c *Client) UpdateCondition(i *UpdateConditionInput) (*Condition, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.Version == 0 {
		return nil, ErrMissingVersion
	}

	if i.Name == "" {
		return nil, ErrMissingName
	}

	path := fmt.Sprintf("/service/%s/version/%d/condition/%s", i.Service, i.Version, url.PathEscape(i.Name))
	resp, err := c.PutForm(path, i, nil)
	if err != nil {
		return nil, err
	}

	var co *Condition
	if err := decodeJSON(&co, resp.Body); err != nil {
		return nil, err
	}
	return co, nil
}
244012
func (a *SetBreakpointOnFunctionCallArgs) SetCondition(condition string) *SetBreakpointOnFunctionCallArgs {
	a.Condition = &condition
	return a
}
1306090
func (s *DocumentDescription) SetStatusInformation(v string) *DocumentDescription {
	s.StatusInformation = &v
	return s
}
964753
func (s *PutResourcePolicyInput) SetPolicyExistsCondition(v string) *PutResourcePolicyInput {
	s.PolicyExistsCondition = &v
	return s
}
416014
func (s *CustomRule) SetCondition(v string) *CustomRule {
	s.Condition = &v
	return s
}
772408
func (s *CreateTrainingJobInput) SetStoppingCondition(v *StoppingCondition) *CreateTrainingJobInput {
	s.StoppingCondition = v
	return s
}
100822
func ScaleCondition(r Scaler, precondition *ScalePrecondition, namespace, name string, count uint) wait.ConditionFunc {
	return func() (bool, error) {
		err := r.ScaleSimple(namespace, name, precondition, count)
		switch e, _ := err.(ScaleError); err.(type) {
		case nil:
			return true, nil
		case ScaleError:
			// if it's invalid we shouldn't keep waiting
			if e.FailureType == ScaleUpdateInvalidFailure {
				return false, err
			}
			if e.FailureType == ScaleUpdateFailure {
				return false, nil
			}
		}
		return false, err
	}
}