Documentation
¶
Index ¶
- Constants
- func NewSigV4Middleware(signerOpts ...func(signer *v4.SignerOptions)) httpclient.Middleware
- type AWSAPIClient
- type AuthType
- type Clock
- type ConfigProvider
- type LoadOptionsFunc
- type Settings
- func (s Settings) BaseOptions() []LoadOptionsFunc
- func (s Settings) GetAuthType() AuthType
- func (s Settings) Hash() uint64
- func (s Settings) WithAssumeRole(cfg aws.Config, client AWSAPIClient, sessionDuration *time.Duration) LoadOptionsFunc
- func (s Settings) WithEC2RoleCredentials(client AWSAPIClient) LoadOptionsFunc
- func (s Settings) WithEndpoint() LoadOptionsFunc
- func (s Settings) WithGrafanaAssumeRole(ctx context.Context, client AWSAPIClient) LoadOptionsFunc
- func (s Settings) WithHTTPClient() LoadOptionsFunc
- func (s Settings) WithRegion() LoadOptionsFunc
- func (s Settings) WithSharedCredentials() LoadOptionsFunc
- func (s Settings) WithStaticCredentials(client AWSAPIClient) LoadOptionsFunc
- func (s Settings) WithUserAgent() LoadOptionsFunc
- type SignerMiddleware
- type SignerRoundTripper
Constants ¶
const EmptySha256Hash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
Variables ¶
This section is empty.
Functions ¶
func NewSigV4Middleware ¶ added in v1.0.0
func NewSigV4Middleware(signerOpts ...func(signer *v4.SignerOptions)) httpclient.Middleware
Types ¶
type AWSAPIClient ¶
type AWSAPIClient interface {
LoadDefaultConfig(ctx context.Context, options ...LoadOptionsFunc) (aws.Config, error)
NewStaticCredentialsProvider(key, secret, session string) aws.CredentialsProvider
NewSTSClientFromConfig(cfg aws.Config) stscreds.AssumeRoleAPIClient
NewAssumeRoleProvider(client stscreds.AssumeRoleAPIClient, roleARN string, optFns ...func(*stscreds.AssumeRoleOptions)) aws.CredentialsProvider
NewCredentialsCache(provider aws.CredentialsProvider, optFns ...func(options *aws.CredentialsCacheOptions)) aws.CredentialsProvider
NewEC2RoleCreds() aws.CredentialsProvider
}
AWSAPIClient isolates most of our interactions with the AWS SDK to make it easier to mock in tests
type AuthType ¶
type AuthType string
AuthType enumerates the kinds of authentication that are supported
type ConfigProvider ¶
func NewConfigProvider ¶
func NewConfigProvider() ConfigProvider
func NewFakeConfigProvider ¶
func NewFakeConfigProvider(shouldFail bool) ConfigProvider
NewFakeConfigProvider returns a basic mock satisfying AWSConfigProvider. If shouldFail is true, the GetConfig method will fail. Otherwise it will return a basic config with static credentials
type LoadOptionsFunc ¶
type LoadOptionsFunc = func(*config.LoadOptions) error
type Settings ¶
type Settings struct {
AuthType AuthType
// deprecated: use AuthType instead
LegacyAuthType awsds.AuthType
AccessKey string
SecretKey string
Region string
CredentialsPath string
CredentialsProfile string
AssumeRoleARN string
Endpoint string
ExternalID string
UserAgent string
SessionToken string
HTTPClient *http.Client
ProxyOptions *proxy.Options
}
Settings carries configuration for authenticating with AWS
func (Settings) BaseOptions ¶
func (s Settings) BaseOptions() []LoadOptionsFunc
func (Settings) GetAuthType ¶
func (Settings) Hash ¶
Hash returns a value suitable for caching the config associated with these settings
func (Settings) WithAssumeRole ¶
func (s Settings) WithAssumeRole(cfg aws.Config, client AWSAPIClient, sessionDuration *time.Duration) LoadOptionsFunc
func (Settings) WithEC2RoleCredentials ¶
func (s Settings) WithEC2RoleCredentials(client AWSAPIClient) LoadOptionsFunc
func (Settings) WithEndpoint ¶
func (s Settings) WithEndpoint() LoadOptionsFunc
func (Settings) WithGrafanaAssumeRole ¶ added in v0.36.0
func (s Settings) WithGrafanaAssumeRole(ctx context.Context, client AWSAPIClient) LoadOptionsFunc
WithGrafanaAssumeRole returns a LoadOptionsFunc to initialize config for Grafana Assume Role
func (Settings) WithHTTPClient ¶
func (s Settings) WithHTTPClient() LoadOptionsFunc
func (Settings) WithRegion ¶
func (s Settings) WithRegion() LoadOptionsFunc
func (Settings) WithSharedCredentials ¶
func (s Settings) WithSharedCredentials() LoadOptionsFunc
WithSharedCredentials returns a LoadOptionsFunc to initialize config from a credentials file
func (Settings) WithStaticCredentials ¶
func (s Settings) WithStaticCredentials(client AWSAPIClient) LoadOptionsFunc
func (Settings) WithUserAgent ¶
func (s Settings) WithUserAgent() LoadOptionsFunc
WithUserAgent adds info to the UserAgent header of API requests. Adapted from grafana-aws-sdk/pkg/awsds/utils.go
type SignerMiddleware ¶ added in v1.0.0
type SignerMiddleware struct {
// contains filtered or unexported fields
}
func (SignerMiddleware) CreateMiddleware ¶ added in v1.0.0
func (s SignerMiddleware) CreateMiddleware(opts httpclient.Options, next http.RoundTripper) http.RoundTripper
func (SignerMiddleware) MiddlewareName ¶ added in v1.0.0
func (s SignerMiddleware) MiddlewareName() string
type SignerRoundTripper ¶ added in v1.0.0
type SignerRoundTripper struct {
// contains filtered or unexported fields
}
func NewSignerRoundTripper ¶ added in v1.0.0
func NewSignerRoundTripper(opts httpclient.Options, next http.RoundTripper, signer v4.HTTPSigner) SignerRoundTripper
func (SignerRoundTripper) SignHTTP ¶ added in v1.0.0
func (s SignerRoundTripper) SignHTTP(ctx context.Context, req *http.Request, credentials aws.Credentials) error