MCPcopy
hub / github.com/minio/minio-go / RetrieveWithCredContext

Method RetrieveWithCredContext

pkg/credentials/iam_aws.go:98–233  ·  view source on GitHub ↗

RetrieveWithCredContext is like Retrieve with Cred Context

(cc *CredContext)

Source from the content-addressed store, hash-verified

96
97// RetrieveWithCredContext is like Retrieve with Cred Context
98func (m *IAM) RetrieveWithCredContext(cc *CredContext) (Value, error) {
99 if cc == nil {
100 cc = defaultCredContext
101 }
102
103 token := os.Getenv("AWS_CONTAINER_AUTHORIZATION_TOKEN")
104 if token == "" {
105 token = m.Container.AuthorizationToken
106 }
107
108 tokenFile := os.Getenv("AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE")
109 if tokenFile == "" {
110 tokenFile = m.Container.AuthorizationToken
111 }
112
113 relativeURI := os.Getenv("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI")
114 if relativeURI == "" {
115 relativeURI = m.Container.CredentialsRelativeURI
116 }
117
118 fullURI := os.Getenv("AWS_CONTAINER_CREDENTIALS_FULL_URI")
119 if fullURI == "" {
120 fullURI = m.Container.CredentialsFullURI
121 }
122
123 identityFile := os.Getenv("AWS_WEB_IDENTITY_TOKEN_FILE")
124 if identityFile == "" {
125 identityFile = m.EKSIdentity.TokenFile
126 }
127
128 roleArn := os.Getenv("AWS_ROLE_ARN")
129 if roleArn == "" {
130 roleArn = m.EKSIdentity.RoleARN
131 }
132
133 roleSessionName := os.Getenv("AWS_ROLE_SESSION_NAME")
134 if roleSessionName == "" {
135 roleSessionName = m.EKSIdentity.RoleSessionName
136 }
137
138 region := os.Getenv("AWS_REGION")
139 if region == "" {
140 region = m.Region
141 }
142
143 var roleCreds ec2RoleCredRespBody
144 var err error
145
146 client := m.Client
147 if client == nil {
148 client = cc.Client
149 }
150 if client == nil {
151 client = defaultCredContext.Client
152 }
153
154 endpoint := m.Endpoint
155

Callers 9

RetrieveMethod · 0.95
TestIAMFunction · 0.95
TestIAMFailAssumeFunction · 0.95
TestIAMIsExpiredFunction · 0.95
TestEcsTaskFunction · 0.95
TestEcsTaskFullURIFunction · 0.95
TestStsFunction · 0.95
TestStsCnFunction · 0.95
TestIMDSv1BlockedFunction · 0.95

Calls 7

ExpirationMethod · 0.95
getEcsTaskCredentialsFunction · 0.85
isLoopbackFunction · 0.85
getCredentialsFunction · 0.85
SetExpirationMethod · 0.80

Tested by 8

TestIAMFunction · 0.76
TestIAMFailAssumeFunction · 0.76
TestIAMIsExpiredFunction · 0.76
TestEcsTaskFunction · 0.76
TestEcsTaskFullURIFunction · 0.76
TestStsFunction · 0.76
TestStsCnFunction · 0.76
TestIMDSv1BlockedFunction · 0.76