RetrieveWithCredContext is like Retrieve with Cred Context
(cc *CredContext)
| 96 | |
| 97 | // RetrieveWithCredContext is like Retrieve with Cred Context |
| 98 | func (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 |