clients

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	URLConfigTypeStatic  = "Static"
	URLConfigTypeDynamic = "Dynamic"
)

Endpoint URL configuration types.

View Source
const (
	// DefaultSection for INI files.
	//DefaultSection = ini.DefaultSection
	DefaultSection = "DEFAULT"
)
View Source
const GlobalRegion = "aws-global"

GlobalRegion is the region name used for AWS services that do not have a notion of region.

Variables

View Source
var GlobalCallerIdentityCache = NewCallerIdentityCache()

GlobalCallerIdentityCache is a global cache to be used by all controllers.

Functions

func AWSGetCallerIdentity added in v0.0.2

func AWSGetCallerIdentity(ctx context.Context, cfg aws.Config) (*sts.GetCallerIdentityOutput, error)

AWSGetCallerIdentity makes sends a request to AWS to get the caller identity.

func CredentialsIDSecret added in v0.0.2

func CredentialsIDSecret(data []byte, profile string) (aws.Credentials, error)

CredentialsIDSecret retrieves AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from the data which contains aws credentials under given profile Example: [default] aws_access_key_id = <YOUR_ACCESS_KEY_ID> aws_secret_access_key = <YOUR_SECRET_ACCESS_KEY>

func DefaultTerraformSetupBuilder added in v0.0.2

func DefaultTerraformSetupBuilder(ctx context.Context, c client.Client, mg resource.Managed, pc *v1beta1.ProviderConfig, ps *terraform.Setup) error

func GetAWSConfig added in v0.0.2

func GetAWSConfig(ctx context.Context, c client.Client, mg resource.Managed) (*aws.Config, error)

GetAWSConfig to produce a config that can be used to authenticate to AWS.

func GetAssumeRoleWithWebIdentityConfig added in v0.0.2

func GetAssumeRoleWithWebIdentityConfig(ctx context.Context, cfg *aws.Config, webID v1beta1.AssumeRoleWithWebIdentityOptions, tokenFile string) (*aws.Config, error)

GetAssumeRoleWithWebIdentityConfig returns an aws.Config capable of doing AssumeRoleWithWebIdentity.

func GetRoleChainConfig added in v0.0.2

func GetRoleChainConfig(ctx context.Context, pcs *v1beta1.ProviderConfigSpec, cfg *aws.Config) (*aws.Config, error)

GetRoleChainConfig returns an aws.Config capable of doing role chaining with AssumeRoleWithWebIdentity & AssumeRoles.

func LateInitializeStringPtr added in v0.0.2

func LateInitializeStringPtr(in *string, from *string) *string

LateInitializeStringPtr returns in if it's non-nil, otherwise returns from which is the backup for the cases in is nil.

func SelectTerraformSetup added in v0.0.2

func SelectTerraformSetup(log logging.Logger, config *SetupConfig) terraform.SetupFn

func SetAssumeRoleOptions added in v0.0.2

func SetAssumeRoleOptions(aro v1beta1.AssumeRoleOptions) func(*stscreds.AssumeRoleOptions)

SetAssumeRoleOptions sets options when Assuming an IAM Role

func SetResolver added in v0.0.2

func SetResolver(pc *v1beta1.ProviderConfig, cfg *aws.Config) *aws.Config

SetResolver parses annotations from the managed resource and returns a configuration accordingly.

func SetWebIdentityRoleOptions added in v0.0.2

func SetWebIdentityRoleOptions(opts v1beta1.AssumeRoleWithWebIdentityOptions) func(*stscreds.WebIdentityRoleOptions)

SetWebIdentityRoleOptions sets options when exchanging a WebIdentity Token for a Role

func UseDefault added in v0.0.2

func UseDefault(ctx context.Context, region string) (*aws.Config, error)

UseDefault loads the default AWS config with the specified region.

func UseProviderSecret added in v0.0.2

func UseProviderSecret(ctx context.Context, data []byte, profile, region string) (*aws.Config, error)

UseProviderSecret - AWS configuration which can be used to issue requests against AWS API

func UseUpbound added in v0.0.2

func UseUpbound(ctx context.Context, region string, pcs *v1beta1.ProviderConfigSpec) (*aws.Config, error)

UseUpbound calls sts.AssumeRoleWithWebIdentity using the configuration supplied in ProviderConfig's spec.credentials.assumeRoleWithWebIdentity and the identity supplied by the injected Upbound OIDC token. NOTE(hasheddan): this is the same functionality used for generic web identity token role assumption, but uses fields under Upbound in the ProviderConfig spec and the dedicated Upbound token injection path. This allows for clear separation of intent by users when exercising the functionality, and allows for uniformity across ProviderConfigs from other providers.

func UseWebIdentityToken added in v0.0.2

func UseWebIdentityToken(ctx context.Context, region string, pcs *v1beta1.ProviderConfigSpec) (*aws.Config, error)

UseWebIdentityToken calls sts.AssumeRoleWithWebIdentity using the configuration supplied in ProviderConfig's spec.credentials.assumeRoleWithWebIdentity.

Types

type AuthMethod added in v0.0.2

type AuthMethod func(context.Context, []byte, string, string) (*aws.Config, error)

AuthMethod is a method of authenticating to the AWS API

type CallerIdentityCache added in v0.0.2

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

CallerIdentityCache holds GetCallerIdentityOutput objects in memory so that we don't need to make API calls to AWS in every reconciliation of every resource. It has a maximum size that when it's reached, the entry that has the oldest access time will be removed from the cache, i.e. FIFO on last access time. Note that there is no need to invalidate the values in the cache because they never change so we don't need concurrency-safety to prevent access to an invalidated entry.

func NewCallerIdentityCache added in v0.0.2

func NewCallerIdentityCache(opts ...CallerIdentityCacheOption) *CallerIdentityCache

NewCallerIdentityCache returns a new empty *CallerIdentityCache.

func (*CallerIdentityCache) GetCallerIdentity added in v0.0.2

func (c *CallerIdentityCache) GetCallerIdentity(ctx context.Context, cfg aws.Config, creds aws.Credentials) (*sts.GetCallerIdentityOutput, error)

GetCallerIdentity returns the identity of the caller.

type CallerIdentityCacheOption added in v0.0.2

type CallerIdentityCacheOption func(*CallerIdentityCache)

CallerIdentityCacheOption lets you configure *CallerIdentityCache.

func WithCache added in v0.0.2

func WithCache(cache map[string]*callerIdentityCacheEntry) CallerIdentityCacheOption

WithCache lets you bootstrap with your own cache.

func WithGetCallerIdentityFn added in v0.0.2

func WithGetCallerIdentityFn(f GetCallerIdentityFn) CallerIdentityCacheOption

WithGetCallerIdentityFn lets you override the default GetCallerIdentityFn.

func WithMaxSize added in v0.0.2

func WithMaxSize(n int) CallerIdentityCacheOption

WithMaxSize lets you override the default MaxSize.

type GetCallerIdentityFn added in v0.0.2

type GetCallerIdentityFn func(ctx context.Context, cfg aws.Config) (*sts.GetCallerIdentityOutput, error)

GetCallerIdentityFn is the function type to call GetCallerIdentity API.

type SetupConfig added in v0.0.2

type SetupConfig struct {
	NativeProviderPath    *string
	NativeProviderSource  *string
	NativeProviderVersion *string
	TerraformVersion      *string
	DefaultScheduler      terraform.ProviderScheduler
	TerraformProvider     *schema.Provider
}

Jump to

Keyboard shortcuts

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