Struct: ibmiam.Provider

import "../ibm-cos-sdk-go/aws/credentials/ibmiam"

Overview

Provider Struct

Implemented Interfaces

s3crypto.Cipher, credentials.Provider, s3manager.ReadSeekerWriteTo, s3manager.WriterReadFrom

Structure Field Summary collapse

Constructor Functions collapse

Method Summary collapse

Structure Field Details

ErrorStatus error

Error

Function Details

func NewEnvProvider(config *aws.Config) *Provider

NewEnvProvider constructor of the IBM IAM provider that loads IAM credentials from environment variables Parameter:

AWS Config

Returns:

A new provider with AWS config, API Key, IBM IAM Authentication Server Endpoint and Service Instance ID


23
24
25
26
27
28
29
// File 'aws/credentials/ibmiam/env_provider.go', line 23

func NewEnvProvider(config *aws.Config) *Provider { apiKey := os.Getenv("IBM_API_KEY_ID") serviceInstanceID := os.Getenv("IBM_SERVICE_INSTANCE_ID") authEndPoint := os.Getenv("IBM_AUTH_ENDPOINT") return NewProvider(EnvProviderName, config, apiKey, authEndPoint, serviceInstanceID, nil) }

func NewSharedConfigProvider(config *aws.Config, filename, profilename string) *Provider

NewSharedConfigProvider constructor of the IBM IAM provider that loads IAM Credentials from shared config Parameters:

AWS Config Profile filename Profile name

Returns:

Common Ini Provider with values


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// File 'aws/credentials/ibmiam/shared_config_provider.go', line 31

func NewSharedConfigProvider(config *aws.Config, filename, profilename string) *Provider { // Sets the file name from possible locations // - AWS_CONFIG_FILE environment variable // Error if the filename is missing if filename == "" { filename = os.Getenv("AWS_CONFIG_FILE") if filename == "" { // BUG? home := shareddefaults.UserHomeDir() if home == "" { e := awserr.New("SharedCredentialsHomeNotFound", "Shared Credentials Home folder not found", nil) logFromConfigHelper(config, "", "", SharedConfProviderName, e) return &Provider{ providerName: SharedConfProviderName, ErrorStatus: e, } } filename = shareddefaults.SharedConfigFilename() } } // Sets the profile name // Otherwise sets the prefix with profile name passed in if profilename == "" { profilename = os.Getenv("AWS_PROFILE") if profilename == "" { profilename = defaultProfile } else { profilename = profilePrefix + profilename } } else { profilename = profilePrefix + profilename } return commonIniProvider(SharedConfProviderName, config, filename, profilename) }

func NewSharedCredentialsProvider(config *aws.Config, filename, profilename string) *Provider

NewSharedCredentialsProvider constructor of the IBM IAM provider that loads IAM credentials from shared credentials file Parameters:

AWS Config Profile filename Profile prefix

Returns:

Common initial provider with config file/profile


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// File 'aws/credentials/ibmiam/shared_credentials_provider.go', line 28

func NewSharedCredentialsProvider(config *aws.Config, filename, profilename string) *Provider { // Sets the file name from possible locations // - AWS_SHARED_CREDENTIALS_FILE environment variable // Error if the filename is missing if filename == "" { filename = os.Getenv("AWS_SHARED_CREDENTIALS_FILE") if filename == "" { // BUG where will we use home? home := shareddefaults.UserHomeDir() if home == "" { e := awserr.New("SharedCredentialsHomeNotFound", "Shared Credentials Home folder not found", nil) logFromConfigHelper(config, "", "", SharedCredsProviderName, e) return &Provider{ providerName: SharedCredsProviderName, ErrorStatus: e, } } filename = shareddefaults.SharedCredentialsFilename() } } // Sets the profile name from AWS_PROFILE environment variable // Otherwise sets the profile name with defaultProfile passed in if profilename == "" { profilename = os.Getenv("AWS_PROFILE") if profilename == "" { profilename = defaultProfile } } return commonIniProvider(SharedCredsProviderName, config, filename, profilename) }

func NewStaticProvider(config *aws.Config, authEndPoint, apiKey, serviceInstanceID string) *Provider

NewStaticProvider constructor of the IBM IAM provider that uses IAM details passed directly Returns: New Provider (AWS type)



12
13
14
// File 'aws/credentials/ibmiam/static_provider.go', line 12

func NewStaticProvider(config *aws.Config, authEndPoint, apiKey, serviceInstanceID string) *Provider { return NewProvider(StaticProviderName, config, apiKey, authEndPoint, serviceInstanceID, nil) }

Method Details

func (p *Provider) IsExpired() bool

IsExpired …

Provider expired or not - boolean


139
140
141
// File 'aws/credentials/ibmiam/common.go', line 139

func (p *Provider) IsExpired() bool { return true }

func (p *Provider) IsValid() bool

IsValid … Returns:

Provider validation - boolean


106
107
108
// File 'aws/credentials/ibmiam/common.go', line 106

func (p *Provider) IsValid() bool { return nil == p.ErrorStatus }

func (p *Provider) Retrieve() (credentials.Value, error)

Retrieve … Returns:

Credential values Error


115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// File 'aws/credentials/ibmiam/common.go', line 115

func (p *Provider) Retrieve() (credentials.Value, error) { if p.ErrorStatus != nil { if p.logLevel.Matches(aws.LogDebug) { p.logger.Log(debugLog, ibmiamProviderLog, p.providerName, p.ErrorStatus) } return credentials.Value{ProviderName: p.providerName}, p.ErrorStatus } tokenValue, err := p.tokenManager.Get() if err != nil { var returnErr error if p.logLevel.Matches(aws.LogDebug) { p.logger.Log(debugLog, ibmiamProviderLog, p.providerName, "ERROR ON GET", err) } returnErr = awserr.New("TokenManagerRetrieveError", "error retrieving the token", err) return credentials.Value{}, returnErr } return credentials.Value{Token: *tokenValue, ProviderName: p.providerName, ProviderType: p.providerType, ServiceInstanceID: p.serviceInstanceID}, nil }