providers

package
v0.0.0-...-fb1fb40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2025 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ALTERNATE_CREDENTIAL_PROFILE_ENV_VAR = "ECS_ALTERNATE_CREDENTIAL_PROFILE"
	DEFAULT_CREDENTIAL_PROFILE           = "default"

	// RotatingSharedCredentialsProviderName is the name of this provider
	RotatingSharedCredentialsProviderName = "RotatingSharedCredentialsProvider"
)

Variables

This section is empty.

Functions

func NewInstanceCredentialsCache

func NewInstanceCredentialsCache(
	isExternal bool,
	rotatingSharedCreds aws.CredentialsProvider,
	imdsClient ec2rolecreds.GetMetadataAPIClient,
) *aws.CredentialsCache

NewInstanceCredentialsCache returns a chain of instance credentials providers wrapped in a credentials cache. The instance credentials chain is the default credentials chain plus the "rotating shared credentials provider", so credentials will be checked in this order:

  1. Env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY).
  2. Shared credentials file (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/create-shared-credentials-file.html) (file at ~/.aws/credentials containing access key id and secret access key).
  3. EC2 role credentials. This is an IAM role that the user specifies when they launch their EC2 container instance (ie ecsInstanceRole (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)).
  4. Rotating shared credentials file located at /rotatingcreds/credentials

Types

type InstanceCredentialsProvider

type InstanceCredentialsProvider struct {
	// contains filtered or unexported fields
}

func (*InstanceCredentialsProvider) Retrieve

type RotatingSharedCredentialsProvider

type RotatingSharedCredentialsProvider struct {
	credentials.Expiry

	RotationInterval time.Duration
	// contains filtered or unexported fields
}

RotatingSharedCredentialsProvider is a provider that retrieves credentials via the shared credentials provider, and adds the functionality of expiring and re-retrieving those credentials from the file.

func NewRotatingSharedCredentialsProvider

func NewRotatingSharedCredentialsProvider() *RotatingSharedCredentialsProvider

NewRotatingSharedCredentials returns a rotating shared credentials provider with default values set.

func (*RotatingSharedCredentialsProvider) Retrieve

Retrieve will use the given filename and profile and retrieve AWS credentials.

type RotatingSharedCredentialsProviderV2

type RotatingSharedCredentialsProviderV2 struct {
	RotationInterval time.Duration
	// contains filtered or unexported fields
}

RotatingSharedCredentialsProviderV2 is a provider that retrieves credentials from the shared credentials file and adds the functionality of expiring and re-retrieving those credentials from the file. TODO (@tiffwang): Remove V2 suffix after the credentials package is fully migrated to aws-sdk-go-v2.

func NewRotatingSharedCredentialsProviderV2

func NewRotatingSharedCredentialsProviderV2() *RotatingSharedCredentialsProviderV2

NewRotatingSharedCredentials returns a rotating shared credentials provider with default values set.

func (*RotatingSharedCredentialsProviderV2) Retrieve

Retrieve will use the given filename and profile and retrieve AWS credentials.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL