// SetApplicationsConfig implements the server side of Application.SetApplicationsConfig.
// It does not unset values that are set to an empty string.
// Unset should be used for that.
335462
func (api *APIBase) SetApplicationsConfig(args params.ApplicationConfigSetArgs) (params.ErrorResults, error) {
	var result params.ErrorResults
	if err := api.checkCanWrite(); err != nil {
		return result, errors.Trace(err)
	}
	if err := api.check.ChangeAllowed(); err != nil {
		return result, errors.Trace(err)
	}
	result.Results = make([]params.ErrorResult, len(args.Args))
	for i, arg := range args.Args {
		err := api.setApplicationConfig(arg)
		result.Results[i].Error = common.ServerError(err)
	}
	return result, nil
}
70226
func (s *CreateConfigurationTemplateInput) SetApplicationName(v string) *CreateConfigurationTemplateInput {
	s.ApplicationName = &v
	return s
}
163290
func (s *DescribeConfigurationOptionsInput) SetApplicationName(v string) *DescribeConfigurationOptionsInput {
	s.ApplicationName = &v
	return s
}
446578
func (c *Client) SetApplicationConfig(branchName, application string, config map[string]string) error {
	if c.BestAPIVersion() < 6 {
		return errors.NotSupportedf("SetApplicationsConfig not supported by this version of Juju")
	}
	args := params.ApplicationConfigSetArgs{
		Args: []params.ApplicationConfigSet{{
			ApplicationName: application,
			Generation:      branchName,
			Config:          config,
		}},
	}
	var results params.ErrorResults
	err := c.facade.FacadeCall("SetApplicationsConfig", args, &results)
	if err != nil {
		return errors.Trace(err)
	}
	return results.OneError()
}
887974
func (s *CreateDeploymentInput) SetApplicationName(v string) *CreateDeploymentInput {
	s.ApplicationName = &v
	return s
}
199342
func (s *RemoveAttributesInput) SetApplicationId(v string) *RemoveAttributesInput {
	s.ApplicationId = &v
	return s
}
235430
func (s *RunJobFlowInput) SetApplications(v []*Application) *RunJobFlowInput {
	s.Applications = v
	return s
}
117010
func (s *UpdateRobotApplicationInput) SetApplication(v string) *UpdateRobotApplicationInput {
	s.Application = &v
	return s
}
104025
func (s *UpdateEnvironmentInput) SetApplicationName(v string) *UpdateEnvironmentInput {
	s.ApplicationName = &v
	return s
}
1194041
func (s *ApplicationSummary) SetApplicationName(v string) *ApplicationSummary {
	s.ApplicationName = &v
	return s
}
1197490
func (a *Application) UpdateApplicationConfig(
	changes application.ConfigAttributes,
	reset []string,
	schema environschema.Fields,
	defaults schema.Defaults,
) error {
	node, err := readSettings(a.st.db(), settingsC, a.applicationConfigKey())
	if errors.IsNotFound(err) {
		return errors.Errorf("cannot update application config since no config exists for application %v", a.doc.Name)
	} else if err != nil {
		return errors.Annotatef(err, "application config for application %q", a.doc.Name)
	}
	resetKeys := set.NewStrings(reset...)
	for name, value := range changes {
		if resetKeys.Contains(name) {
			continue
		}
		node.Set(name, value)
	}
	for _, name := range reset {
		node.Delete(name)
	}
	newConfig, err := application.NewConfig(node.Map(), schema, defaults)
	if err != nil {
		return errors.Trace(err)
	}
	if err := newConfig.Validate(); err != nil {
		return errors.Trace(err)
	}
	// Update node so it gets coerced values with correct types.
	coerced := newConfig.Attributes()
	for _, key := range node.Keys() {
		node.Set(key, coerced[key])
	}
	_, err = node.Write()
	return err
}
762704
func (s *CreateApplicationInput) SetApplicationCode(v string) *CreateApplicationInput {
	s.ApplicationCode = &v
	return s
}
32985
func (s *CreateEnvironmentInput) SetApplicationName(v string) *CreateEnvironmentInput {
	s.ApplicationName = &v
	return s
}
194895
func (s *ApplicationConfigurationUpdate) SetApplicationCodeConfigurationUpdate(v *ApplicationCodeConfigurationUpdate) *ApplicationConfigurationUpdate {
	s.ApplicationCodeConfigurationUpdate = v
	return s
}
579166
func (s *DisassociateConfigurationItemsFromApplicationInput) SetApplicationConfigurationId(v string) *DisassociateConfigurationItemsFromApplicationInput {
	s.ApplicationConfigurationId = &v
	return s
}
666089
func (s *RobotApplicationConfig) SetApplication(v string) *RobotApplicationConfig {
	s.Application = &v
	return s
}
1050861
func (s *Cluster) SetApplications(v []*Application) *Cluster {
	s.Applications = v
	return s
}