// SetTemplate reads in the template with the filename provided. If the file does not exist or is not parsable, it will return an error.
17488
func SetTemplate(t *template.Template, name, filename string) error {

	// Read template
	buf, err := ioutil.ReadFile(filename)
	if err != nil {
		return err
	}

	// Update if exists
	if tt := t.Lookup(name); tt != nil {
		_, err = tt.Parse(string(buf))
		return err
	}

	// Allocate new name if not
	_, err = t.New(name).Parse(string(buf))
	return err
}
65329
func (s *GetCustomVerificationEmailTemplateInput) SetTemplateName(v string) *GetCustomVerificationEmailTemplateInput {
	s.TemplateName = &v
	return s
}
1153457
func (s *UpdateStackSetInput) SetTemplateURL(v string) *UpdateStackSetInput {
	s.TemplateURL = &v
	return s
}
185541
func (s *EstimateTemplateCostInput) SetTemplateURL(v string) *EstimateTemplateCostInput {
	s.TemplateURL = &v
	return s
}
17283
func (s *UpdateStackSetInput) SetTemplateBody(v string) *UpdateStackSetInput {
	s.TemplateBody = &v
	return s
}
405405
func (s *RegistrationConfig) SetTemplateBody(v string) *RegistrationConfig {
	s.TemplateBody = &v
	return s
}
848003
func (s *EstimateTemplateCostInput) SetTemplateBody(v string) *EstimateTemplateCostInput {
	s.TemplateBody = &v
	return s
}
914079
func (s *CreateApplicationVersionRequest) SetTemplateUrl(v string) *CreateApplicationVersionRequest {
	s.TemplateUrl = &v
	return s
}
492967
func (s *CreateChangeSetInput) SetTemplateURL(v string) *CreateChangeSetInput {
	s.TemplateURL = &v
	return s
}
1161071
func (s *Store) SetTemplate(ctx context.Context, name string, content []byte) error {
	p := s.templatefile(name)

	if err := s.storage.Set(ctx, p, content); err != nil {
		return errors.Wrapf(err, "failed to write template")
	}

	if err := s.rcs.Add(ctx, p); err != nil {
		if errors.Cause(err) == store.ErrGitNotInit {
			return nil
		}
		return errors.Wrapf(err, "failed to add '%s' to git", p)
	}

	if !ctxutil.IsGitCommit(ctx) {
		return nil
	}

	return s.gitCommitAndPush(ctx, name)
}
878256
func (s *InstanceDetails) SetLaunchTemplate(v *LaunchTemplateSpecification) *InstanceDetails {
	s.LaunchTemplate = v
	return s
}
415419
func (s *CreateStackInput) SetTemplateURL(v string) *CreateStackInput {
	s.TemplateURL = &v
	return s
}
1291161
func (s *GenerateTemplateInput) SetTemplateFormat(v string) *GenerateTemplateInput {
	s.TemplateFormat = &v
	return s
}
473467
func (s *CreateChangeSetInput) SetTemplateBody(v string) *CreateChangeSetInput {
	s.TemplateBody = &v
	return s
}
650059
func (s *DescribeThingRegistrationTaskOutput) SetTemplateBody(v string) *DescribeThingRegistrationTaskOutput {
	s.TemplateBody = &v
	return s
}
725335
func (s *UpdateResolverInput) SetResponseMappingTemplate(v string) *UpdateResolverInput {
	s.ResponseMappingTemplate = &v
	return s
}
700930
func (s *Instance) SetLaunchTemplate(v *LaunchTemplateSpecification) *Instance {
	s.LaunchTemplate = v
	return s
}