// CredentialsSource creates and returns a service credentials source whose
// behavior depends on which "credentials" and "credentials_helper" blocks,
// if any, are present in the receiving config.
CredentialsSource creates and returns a service credentials source whose
behavior depends on which "credentials" and "credentials_helper" blocks,
if any, are present in the receiving config.
// CredentialsSource creates and returns a service credentials source whose // behavior depends on which " credentials " and " credentials_helper " blocks // if any are present in the receiving config .
func (c *Config) CredentialsSource(helperPlugins pluginDiscovery.PluginMetaSet) (*CredentialsSource, error) {
	credentialsFilePath, err := credentialsConfigFile()
	if err != nil {
		return nil, fmt.Errorf("can't locate credentials file: %s", err)
	}
	var helper svcauth.CredentialsSource
	var helperType string
	for givenType, givenConfig := range c.CredentialsHelpers {
		available := helperPlugins.WithName(givenType)
		if available.Count() == 0 {
			log.Printf("[ERROR] Unable to find credentials helper %q; ignoring", helperType)
			break
		}
		selected := available.Newest()
		helperSource := svcauth.HelperProgramCredentialsSource(selected.Path, givenConfig.Args...)
		helper = svcauth.CachingCredentialsSource(helperSource) 
		helperType = givenType
		break
	}
	return c.credentialsSource(helperType, helper, credentialsFilePath), nil
}
func ( c * Config ) CredentialsSource ( helperPlugins pluginDiscovery . PluginMetaSet ) ( * CredentialsSource , error ) { credentialsFilePath , err := credentialsConfigFile ( ) if err != nil { return nil , fmt . Errorf ( " " , err ) } var helper svcauth . CredentialsSource var helperType string for givenType , givenConfig := range c . CredentialsHelpers { available := helperPlugins . WithName ( givenType ) if available . Count ( ) == 0 { log . Printf ( " " , helperType ) break } selected := available . Newest ( ) helperSource := svcauth . HelperProgramCredentialsSource ( selected . Path , givenConfig . Args ... ) helper = svcauth . CachingCredentialsSource ( helperSource ) helperType = givenType break } return c . credentialsSource ( helperType , helper , credentialsFilePath ) , nil }
CredentialsSource creates and returns a service credentials source whose
behavior depends on which "credentials" and "credentials_helper" blocks,
if any, are present in the receiving config.
CredentialsSource creates and returns a service credentials source whose behavior depends on which " credentials " and " credentials_helper " blocks if any are present in the receiving config .
// If we managed to load a Config object at all then we would already // have located this file, so this error is very unlikely. // cached because external operation may be slow/expensive // There should only be zero or one "credentials_helper" blocks. We // assume that the config was validated earlier and so we don't check // for extras here.