Documentation ¶
Index ¶
Constants ¶
const IAMTokenURL = "https://iam.cloud.ibm.com/oidc/token"
IAMTokenURL is the global endpoint URL for the IAM token service
Variables ¶
var ( // RetryWaitMax is the maximum time to wait between HTTP retries RetryWaitMax = 30 * time.Second // RetryMax is the max number of attempts to retry for failed HTTP requests RetryMax = 4 )
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct { ErrorCode string `json:"errorCode"` ErrorMessage string `json:"errorMessage"` Context *iamRequestContext `json:"context"` HTTPResponse *http.Response }
Error is a type to hold error information that the IAM services sends back when a request cannot be completed. ErrorCode, ErrorMessage, and Context.RequestID are probably the most useful fields. IAM will most likely ask you for the RequestID if you ask for support.
Also of note is that the http.Response object is included in HTTPResponse for error handling at the higher application levels.
type IAMTokenSource ¶
type IAMTokenSource struct { TokenURL string APIKey string // contains filtered or unexported fields }
IAMTokenSource is used to retrieve access tokens from the IAM token service. Most will probably want to use CredentialFromAPIKey to build an IAMTokenSource type, but it can also be created directly if one wishes to override the default IAM endpoint by setting TokenURL
func CredentialFromAPIKey ¶
func CredentialFromAPIKey(apiKey string) *IAMTokenSource
CredentialFromAPIKey returns an IAMTokenSource that requests access tokens from the default token endpoint using an IAM API Key as the authentication mechanism
func (*IAMTokenSource) Token ¶
func (ts *IAMTokenSource) Token() (*Token, error)
Token requests an access token from IAM using the IAMTokenSource config.