// Returns API config if secret set, otherwise empty struct so defaults can be
// attempted.
492678
func getAPICfg(spec *volume.Spec, pod *v1.Pod, kubeClient clientset.Interface) (*storageosAPIConfig, error) {
	if spec.PersistentVolume != nil {
		source, _, err := getPersistentVolumeSource(spec)
		if err != nil {
			return nil, err
		}
		if source.SecretRef == nil {
			return nil, nil
		}
		return parsePVSecret(source.SecretRef.Namespace, source.SecretRef.Name, kubeClient)
	}

	if spec.Volume != nil {
		source, _, err := getVolumeSource(spec)
		if err != nil {
			return nil, err
		}
		if source.SecretRef == nil {
			return nil, nil
		}
		return parsePodSecret(pod, source.SecretRef.Name, kubeClient)
	}

	return nil, fmt.Errorf("spec not Volume or PersistentVolume")
}
619459
func (f FakeGetter) Get(name string) (*api.Secret, error) {
	return f.Secret, f.Err
}
1329113
func (configMgr *ConfigurationManager) GetConfigurationsByKeyAndDimensionInfo(dimensionInfo, key string) interface{} {
	configMgr.configMapMux.Lock()
	sourceName, ok := configMgr.ConfigurationMap[key]

	configMgr.configMapMux.Unlock()
	if !ok {
		return nil
	}

	return configMgr.configValueBySourceAndDimensionInfo(key, sourceName, dimensionInfo)
}
677534
func (r Network_Tunnel_Module_Context) GetEncryptionDefault() (resp string, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_Tunnel_Module_Context", "getEncryptionDefault", nil, &r.Options, &resp)
	return
}
158378
func getDefaultOpts(header http.Header, copySource bool, metadata map[string]string) (opts ObjectOptions, err error) {
	var clientKey [32]byte
	var sse encrypt.ServerSide

	if copySource {
		if crypto.SSECopy.IsRequested(header) {
			clientKey, err = crypto.SSECopy.ParseHTTP(header)
			if err != nil {
				return
			}
			if sse, err = encrypt.NewSSEC(clientKey[:]); err != nil {
				return
			}
			return ObjectOptions{ServerSideEncryption: encrypt.SSECopy(sse), UserDefined: metadata}, nil
		}
		return
	}

	if crypto.SSEC.IsRequested(header) {
		clientKey, err = crypto.SSEC.ParseHTTP(header)
		if err != nil {
			return
		}
		if sse, err = encrypt.NewSSEC(clientKey[:]); err != nil {
			return
		}
		return ObjectOptions{ServerSideEncryption: sse, UserDefined: metadata}, nil
	}
	if crypto.S3.IsRequested(header) || (metadata != nil && crypto.S3.IsEncrypted(metadata)) {
		return ObjectOptions{ServerSideEncryption: encrypt.NewSSE(), UserDefined: metadata}, nil
	}
	return ObjectOptions{UserDefined: metadata}, nil
}
1097101
func (adm *AdminClient) GetConfigKeys(keys []string) ([]byte, error) {
	queryVals := make(url.Values)
	for _, k := range keys {
		queryVals.Add(k, "")
	}

	// Execute GET on /minio/admin/v1/config-keys to get config of a setup.
	resp, err := adm.executeMethod("GET",
		requestData{
			relPath:     "/v1/config-keys",
			queryValues: queryVals,
		})
	defer closeResponse(resp)
	if err != nil {
		return nil, err
	}

	if resp.StatusCode != http.StatusOK {
		return nil, httpRespToErrorResponse(resp)
	}

	return DecryptData(adm.secretAccessKey, resp.Body)
}
165795
func (c *GetMappingCall) ConfigSet(configSet string) *GetMappingCall {
	c.urlParams_.Set("config_set", configSet)
	return c
}
1334019
func (a *AuthenticateSSHRequest) CheckAndSetDefaults() error {
	if err := a.AuthenticateUserRequest.CheckAndSetDefaults(); err != nil {
		return trace.Wrap(err)
	}
	if len(a.PublicKey) == 0 {
		return trace.BadParameter("missing parameter 'public_key'")
	}
	certificateFormat, err := utils.CheckCertificateFormatFlag(a.CompatibilityMode)
	if err != nil {
		return trace.Wrap(err)
	}
	a.CompatibilityMode = certificateFormat
	return nil
}
1146340
func (a *Client) GetConfig(params *GetConfigParams, authInfo runtime.ClientAuthInfoWriter) (*GetConfigOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetConfigParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "GetConfig",
		Method:             "GET",
		PathPattern:        "/config",
		ProducesMediaTypes: []string{"application/json", "application/x-gzip"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GetConfigReader{formats: a.formats},
		AuthInfo:           authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetConfigOK), nil
}
293162
func (c *ClientsetSecretStore) Secret(name string) (*fi.Secret, error) {
	s, err := c.FindSecret(name)
	if err != nil {
		return nil, err
	}
	if s == nil {
		return nil, fmt.Errorf("Secret not found: %q", name)
	}
	return s, nil
}
709923
func (c *configCommand) getAPI() (configCommandAPI, error) {
	if c.api != nil {
		return c.api, nil
	}
	api, err := c.NewAPIRoot()
	if err != nil {
		return nil, errors.Annotate(err, "opening API connection")
	}
	client := modelconfig.NewClient(api)
	return client, nil
}
298855
func (c *ConfigPolicy) getDefaults() Config {
	config := NewConfig()
	for _, v := range c.stringRules {
		for key, val := range v.Rules {
			if val.HasDefault {
				config[key] = val.Default
			}
		}
	}
	for _, v := range c.boolRules {
		for key, val := range v.Rules {
			if val.HasDefault {
				config[key] = val.Default
			}
		}
	}
	for _, v := range c.floatRules {
		for key, val := range v.Rules {
			if val.HasDefault {
				config[key] = val.Default
			}
		}
	}
	for _, v := range c.integerRules {
		for key, val := range v.Rules {
			if val.HasDefault {
				config[key] = val.Default
			}
		}
	}

	return config
}
1087756
func (r *configs) Get(configID string) (*api.Config, error) {
	r.mu.RLock()
	defer r.mu.RUnlock()
	if r, ok := r.m[configID]; ok {
		return r, nil
	}
	return nil, fmt.Errorf("config %s not found", configID)
}
429656
func (s *Config) CheckAndSetDefaults() error {
	if s.Bucket == "" {
		return trace.BadParameter("missing parameter Bucket")
	}
	if s.Session == nil {
		// create an AWS session using default SDK behavior, i.e. it will interpret
		// the environment and ~/.aws directory just like an AWS CLI tool would:
		sess, err := awssession.NewSessionWithOptions(awssession.Options{
			SharedConfigState: awssession.SharedConfigEnable,
		})
		if err != nil {
			return trace.Wrap(err)
		}
		// override the default environment (region + credentials) with the values
		// from the YAML file:
		if s.Region != "" {
			sess.Config.Region = aws.String(s.Region)
		}
		s.Session = sess
	}
	return nil
}
1316321
func (c *ClusterManager) SecretGet(secretKey string) (interface{}, error) {
	return c.secretsManager.SecretGet(secretKey)
}
224949
func (f *Function) GetConfigQualifier(s string) (*lambda.GetFunctionOutput, error) {
	f.Log.Debug("fetching config")
	return f.Service.GetFunction(&lambda.GetFunctionInput{
		FunctionName: &f.FunctionName,
		Qualifier:    &s,
	})
}
918049
func (settings EnvironmentSettings) GetClientCredentials() (ClientCredentialsConfig, error) {
	secret := settings.Values[ClientSecret]
	if secret == "" {
		return ClientCredentialsConfig{}, errors.New("missing client secret")
	}
	clientID, tenantID := settings.getClientAndTenant()
	config := NewClientCredentialsConfig(clientID, secret, tenantID)
	config.AADEndpoint = settings.Environment.ActiveDirectoryEndpoint
	config.Resource = settings.Values[Resource]
	return config, nil
}