RetrieveWithCredContext is like Retrieve with CredContext
(cc *CredContext)
| 57 | |
| 58 | // RetrieveWithCredContext is like Retrieve with CredContext |
| 59 | func (c *Chain) RetrieveWithCredContext(cc *CredContext) (Value, error) { |
| 60 | for _, p := range c.Providers { |
| 61 | creds, _ := p.RetrieveWithCredContext(cc) |
| 62 | // Always prioritize non-anonymous providers, if any. |
| 63 | if creds.AccessKeyID == "" && creds.SecretAccessKey == "" { |
| 64 | continue |
| 65 | } |
| 66 | c.curr = p |
| 67 | return creds, nil |
| 68 | } |
| 69 | // At this point we have exhausted all the providers and |
| 70 | // are left without any credentials return anonymous. |
| 71 | return Value{ |
| 72 | SignerType: SignatureAnonymous, |
| 73 | }, nil |
| 74 | } |
| 75 | |
| 76 | // Retrieve returns the credentials value, returns no credentials(anonymous) |
| 77 | // if no credentials provider returned any value. |