// PuppetSetting retrieves a config setting by shelling out to puppet apply --configprint
489027
func PuppetSetting(setting string) (string, error) {
	args := []string{"apply", "--configprint", setting}

	out, err := exec.Command(PuppetAIOCmd("puppet", "puppet"), args...).Output()
	if err != nil {
		return "", err
	}

	return strings.Replace(string(out), "\n", "", -1), nil
}
125746
func (u *Unit) ConfigSettings() (charm.Settings, error) {
	var results params.ConfigSettingsResults
	args := params.Entities{
		Entities: []params.Entity{{Tag: u.tag.String()}},
	}
	err := u.st.facade.FacadeCall("ConfigSettings", args, &results)
	if err != nil {
		return nil, err
	}
	if len(results.Results) != 1 {
		return nil, errors.Errorf("expected 1 result, got %d", len(results.Results))
	}
	result := results.Results[0]
	if result.Error != nil {
		return nil, result.Error
	}
	return charm.Settings(result.Settings), nil
}
456772
func (c *Config) JujuProxySettings() proxy.Settings {
	return proxy.Settings{
		Http:    c.JujuHTTPProxy(),
		Https:   c.JujuHTTPSProxy(),
		Ftp:     c.JujuFTPProxy(),
		NoProxy: c.JujuNoProxy(),
	}
}
500634
func updateSettings(c context.Context) error {
	// Load the settings from luci-config.
	cs := cfgclient.CurrentServiceConfigSet(c)
	lucicfg := GetConfigService(c)
	cfg, err := lucicfg.GetConfig(c, cs, "settings.cfg", false)
	if err != nil {
		return errors.Annotate(err, "loading settings.cfg from luci-config").Err()
	}

	// Do the revision check & swap in a datastore transaction.
	return datastore.RunInTransaction(c, func(c context.Context) error {
		oldSettings := Settings{}
		err := datastore.Get(c, &oldSettings)
		switch err {
		case datastore.ErrNoSuchEntity:
			// This might be the first time this has run, so a warning here is ok.
			logging.WithError(err).Warningf(c, "no existing service config")
		case nil:
			// Continue
		default:
			return errors.Annotate(err, "loading existing config").Err()
		}
		// Check to see if we need to update
		if oldSettings.Revision == cfg.Revision {
			logging.Debugf(c, "revisions matched (%s), no need to update", cfg.Revision)
			return nil
		}
		newSettings := Settings{Revision: cfg.Revision}
		if err := proto.UnmarshalText(cfg.Content, &newSettings.Settings); err != nil {
			return errors.Annotate(err, "unmarshalling proto").Err()
		}
		ctx := &validation.Context{Context: c}
		ctx.SetFile("settings.cfg")
		validateSettings(ctx, &newSettings.Settings)
		if err := ctx.Finalize(); err != nil {
			return errors.Annotate(err, "validating settings").Err()
		}
		return datastore.Put(c, &newSettings)
	}, nil)
}
132867
func (s *CreateStreamProcessorInput) SetSettings(v *StreamProcessorSettings) *CreateStreamProcessorInput {
	s.Settings = v
	return s
}
536077
func (s *CreateDirectoryInput) SetVpcSettings(v *DirectoryVpcSettings) *CreateDirectoryInput {
	s.VpcSettings = v
	return s
}
969853
func (s *CreateDBClusterInput) SetScalingConfiguration(v *ScalingConfiguration) *CreateDBClusterInput {
	s.ScalingConfiguration = v
	return s
}
925547
func (api *ProxyLBAPI) UpdateSetting(id int64, value *sacloud.ProxyLB) (*sacloud.ProxyLB, error) {
	req := &sacloud.ProxyLB{
		// Settings
		Settings: value.Settings,
	}
	return api.request(func(res *proxyLBResponse) error {
		return api.update(id, api.createRequest(req), res)
	})
}
673566
func (c *Client) CreateCacheSetting(i *CreateCacheSettingInput) (*CacheSetting, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

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

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

	var cs *CacheSetting
	if err := decodeJSON(&cs, resp.Body); err != nil {
		return nil, err
	}
	return cs, nil
}
140360
func (p *WebPage) SetSettings(settings WebPageSettings) error {
	req := map[string]interface{}{
		"ref": p.ref.id,
		"settings": webPageSettingsJSON{
			JavascriptEnabled:             settings.JavascriptEnabled,
			LoadImages:                    settings.LoadImages,
			LocalToRemoteURLAccessEnabled: settings.LocalToRemoteURLAccessEnabled,
			UserAgent:                     settings.UserAgent,
			Username:                      settings.Username,
			Password:                      settings.Password,
			XSSAuditingEnabled:            settings.XSSAuditingEnabled,
			WebSecurityEnabled:            settings.WebSecurityEnabled,
			ResourceTimeout:               int(settings.ResourceTimeout / time.Millisecond),
		},
	}
	return p.ref.process.doJSON("POST", "/webpage/SetSettings", req, nil)
}
278838
func replaceSettings(db Database, collection, key string, values map[string]interface{}) error {
	op, _, err := replaceSettingsOp(db, collection, key, values)
	if err != nil {
		return errors.Annotatef(err, "settings %q", key)
	}
	err = db.RunTransaction([]txn.Op{op})
	if err == txn.ErrAborted {
		return errors.NotFoundf("settings")
	}
	if err != nil {
		return fmt.Errorf("cannot replace settings: %v", err)
	}
	return nil
}
413400
func (s *ListAccountSettingsOutput) SetSettings(v []*Setting) *ListAccountSettingsOutput {
	s.Settings = v
	return s
}
934060
func (a *AutoTriggerCheck) GetSetting() bool {
	if a == nil || a.Setting == nil {
		return false
	}
	return *a.Setting
}
187959
func (s *TranscriptionJob) SetSettings(v *Settings) *TranscriptionJob {
	s.Settings = v
	return s
}
1145077
func (s *ResetServiceSettingInput) SetSettingId(v string) *ResetServiceSettingInput {
	s.SettingId = &v
	return s
}
853965
func (c *ChatRPC) ChatSetConvSettings(
	_ context.Context, _ chat1.ChatSetConvSettingsArg) error {
	return nil
}
931163
func (s *PutAccountSettingDefaultOutput) SetSetting(v *Setting) *PutAccountSettingDefaultOutput {
	s.Setting = v
	return s
}