// SetEnvironVersion sets the model's current environ version. The value
// must be monotonically increasing.
543345
func (m *Model) SetEnvironVersion(v int) error {
	mOrig := m
	mCopy := *m
	m = &mCopy // copy so we can refresh without affecting the original m
	buildTxn := func(attempt int) ([]txn.Op, error) {
		if attempt > 0 {
			if err := m.Refresh(); err != nil {
				return nil, errors.Trace(err)
			}
		}
		if v < m.doc.EnvironVersion {
			return nil, errors.Errorf(
				"cannot set environ version to %v, which is less than the current version %v",
				v, m.doc.EnvironVersion,
			)
		}
		if v == m.doc.EnvironVersion {
			return nil, jujutxn.ErrNoOperations
		}
		return []txn.Op{{
			C:      modelsC,
			Id:     m.doc.UUID,
			Assert: bson.D{{"environ-version", m.doc.EnvironVersion}},
			Update: bson.D{{"$set", bson.D{{"environ-version", v}}}},
		}}, nil
	}
	if err := m.st.db().Run(buildTxn); err != nil {
		return errors.Trace(err)
	}
	mOrig.doc.EnvironVersion = v
	return nil
}
984484
func (s *CreateCustomActionTypeInput) SetVersion(v string) *CreateCustomActionTypeInput {
	s.Version = &v
	return s
}
97650
func (s *CreateRobotApplicationOutput) SetVersion(v string) *CreateRobotApplicationOutput {
	s.Version = &v
	return s
}
201198
func (s *DatasetContentSummary) SetVersion(v string) *DatasetContentSummary {
	s.Version = &v
	return s
}
1046650
func (s *App) SetEnvironment(v []*EnvironmentVariable) *App {
	s.Environment = v
	return s
}
402635
func (s *PutParameterOutput) SetVersion(v int64) *PutParameterOutput {
	s.Version = &v
	return s
}
668885
func (c *Client) SetModelEnvironVersion(tag names.ModelTag, v int) error {
	args := params.SetModelEnvironVersions{
		Models: []params.SetModelEnvironVersion{{
			ModelTag: tag.String(),
			Version:  v,
		}},
	}
	var results params.ErrorResults
	err := c.facade.FacadeCall("SetModelEnvironVersion", &args, &results)
	if err != nil {
		return errors.Trace(err)
	}
	return results.OneError()
}
798886
func (s *ContainerDefinition) SetEnvironment(v []*KeyValuePair) *ContainerDefinition {
	s.Environment = v
	return s
}
553662
func (s *PutIntentOutput) SetVersion(v string) *PutIntentOutput {
	s.Version = &v
	return s
}
1136855
func (s *Project) SetEnvironment(v *ProjectEnvironment) *Project {
	s.Environment = v
	return s
}
205123
func (s *ResponseCard) SetVersion(v string) *ResponseCard {
	s.Version = &v
	return s
}
388614
func (s *GetPipelineDefinitionInput) SetVersion(v string) *GetPipelineDefinitionInput {
	s.Version = &v
	return s
}
646415
func (s *ActionTypeId) SetVersion(v string) *ActionTypeId {
	s.Version = &v
	return s
}
1208622
func (s *GetIntentOutput) SetVersion(v string) *GetIntentOutput {
	s.Version = &v
	return s
}
82782
func (s *DescribeSecurityProfileOutput) SetVersion(v int64) *DescribeSecurityProfileOutput {
	s.Version = &v
	return s
}
744860
func (s *ContainerProperties) SetEnvironment(v []*KeyValuePair) *ContainerProperties {
	s.Environment = v
	return s
}
1277991
func (s *CreateAppInput) SetEnvironment(v []*EnvironmentVariable) *CreateAppInput {
	s.Environment = v
	return s
}