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

Method GetWithContext

pkg/credentials/credentials.go:192–213  ·  pkg/credentials/credentials.go::Credentials.GetWithContext

GetWithContext returns the credentials value, or error if the credentials Value failed to be retrieved. Will return the cached credentials Value if it has not expired. If the credentials Value has expired the Provider's Retrieve() will be called to refresh the credentials. If Credentials.Expire()

(cc *CredContext)

Source from the content-addressed store, hash-verified

190// If Credentials.Expire() was called the credentials Value will be force
191// expired, and the next call to Get() will cause them to be refreshed.
192func (c *Credentials) GetWithContext(cc *CredContext) (Value, error) {
193 if c == nil {
194 return Value{}, nil
195 }
196 if cc == nil {
197 cc = defaultCredContext
198 }
199
200 c.Lock()
201 defer c.Unlock()
202
203 if c.isExpired() {
204 creds, err := c.provider.RetrieveWithCredContext(cc)
205 if err != nil {
206 return Value{}, err
207 }
208 c.creds = creds
209 c.forceRefresh = false
210 }
211
212 return c.creds, nil
213}
214
215// Expire expires the credentials and forces them to be retrieved on the
216// next call to Get().

Callers 15

GetMethod · 0.95
createSessionRequestMethod · 0.80
newRequestMethod · 0.80
GetCredsMethod · 0.80
PresignedPostPolicyMethod · 0.80
TestFileAWSFunction · 0.80
TestFileMinioClientFunction · 0.80
TestStaticGetFunction · 0.80
TestIAMMalformedEndpointFunction · 0.80
TestIAMFailServerFunction · 0.80

Calls 2

isExpiredMethod · 0.95

Tested by 9

TestFileAWSFunction · 0.64
TestFileMinioClientFunction · 0.64
TestStaticGetFunction · 0.64
TestIAMMalformedEndpointFunction · 0.64
TestIAMFailServerFunction · 0.64
TestIAMNoRolesFunction · 0.64
TestCredentialsGetFunction · 0.64