// AllowedTargetVersion checks if targetVersion is too different from
// curVersion to allow a downgrade.
435212
func AllowedTargetVersion(
	origAgentVersion version.Number,
	curVersion version.Number,
	upgradeStepsRunning bool,
	targetVersion version.Number,
) bool {
	if upgradeStepsRunning && targetVersion == origAgentVersion {
		return true
	}
	if targetVersion.Major < curVersion.Major {
		return false
	}
	if targetVersion.Major == curVersion.Major && targetVersion.Minor < curVersion.Minor {
		return false
	}
	return true
}
1318828
func (s *ListV2LoggingLevelsInput) SetTargetType(v string) *ListV2LoggingLevelsInput {
	s.TargetType = &v
	return s
}
1257560
func (i *ProviderInstaller) platformCompatibleVersions(versions []*response.TerraformProviderVersion) []*response.TerraformProviderVersion {
	var v []*response.TerraformProviderVersion
	for _, version := range versions {
		if err := i.checkPlatformCompatibility(version); err == nil {
			v = append(v, version)
		}
	}
	return v
}
439193
func (s *PutScalingPolicyInput) SetTargetTrackingScalingPolicyConfiguration(v *TargetTrackingScalingPolicyConfiguration) *PutScalingPolicyInput {
	s.TargetTrackingScalingPolicyConfiguration = v
	return s
}
79761
func StatusReleaseVersion(version int32) StatusOption {
	return func(opts *options) {
		opts.statusReq.Version = version
	}
}
122581
func (s *PutScheduledActionInput) SetScalableTargetAction(v *ScalableTargetAction) *PutScheduledActionInput {
	s.ScalableTargetAction = v
	return s
}
1301702
func (s *CancelResizeOutput) SetTargetNodeType(v string) *CancelResizeOutput {
	s.TargetNodeType = &v
	return s
}
739972
func (s *AutoScalingTargetTrackingScalingPolicyConfigurationUpdate) SetTargetValue(v float64) *AutoScalingTargetTrackingScalingPolicyConfigurationUpdate {
	s.TargetValue = &v
	return s
}
349620
func (tree *MutableTree) LoadVersion(targetVersion int64) (int64, error) {
	roots, err := tree.ndb.getRoots()
	if err != nil {
		return 0, err
	}
	if len(roots) == 0 {
		return 0, nil
	}
	latestVersion := int64(0)
	var latestRoot []byte
	for version, r := range roots {
		tree.versions[version] = true
		if version > latestVersion &&
			(targetVersion == 0 || version <= targetVersion) {
			latestVersion = version
			latestRoot = r
		}
	}

	if !(targetVersion == 0 || latestVersion == targetVersion) {
		return latestVersion, fmt.Errorf("wanted to load target %v but only found up to %v",
			targetVersion, latestVersion)
	}

	t := &ImmutableTree{
		ndb:     tree.ndb,
		version: latestVersion,
	}
	if len(latestRoot) != 0 {
		t.root = tree.ndb.GetNode(latestRoot)
	}

	tree.orphans = map[string]int64{}
	tree.ImmutableTree = t
	tree.lastSaved = t.clone()
	return latestVersion, nil
}
1321399
func (s *UpgradeElasticsearchDomainInput) SetTargetVersion(v string) *UpgradeElasticsearchDomainInput {
	s.TargetVersion = &v
	return s
}
1323641
func (s *AutoScalingPolicyUpdate) SetTargetTrackingScalingPolicyConfiguration(v *AutoScalingTargetTrackingScalingPolicyConfigurationUpdate) *AutoScalingPolicyUpdate {
	s.TargetTrackingScalingPolicyConfiguration = v
	return s
}
554884
func (m *Machine) UpgradeSeriesTarget() (string, error) {
	lock, err := m.getUpgradeSeriesLock()
	if err != nil {
		return "", errors.Trace(err)
	}
	return lock.ToSeries, nil
}
809010
func (s *CreateDocumentInput) SetTargetType(v string) *CreateDocumentInput {
	s.TargetType = &v
	return s
}
676999
func (c *cmd) allowedTarget(target string) bool {
	for _, dt := range c.defaultTargets() {
		if dt == target {
			return true
		}
	}
	return false
}
914948
func (s *UpdateDocumentInput) SetTargetType(v string) *UpdateDocumentInput {
	s.TargetType = &v
	return s
}
589119
func (s *CodeGenEdge) SetTargetParameter(v string) *CodeGenEdge {
	s.TargetParameter = &v
	return s
}
1324938
func (s *UpgradeElasticsearchDomainOutput) SetTargetVersion(v string) *UpgradeElasticsearchDomainOutput {
	s.TargetVersion = &v
	return s
}