awsutil

package
v3.44.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 36 Imported by: 1

Documentation

Index

Constants

View Source
const Default = "default"

Default is a generic constant for the word default

View Source
const ErrCodeInvalidAction = "InvalidAction"
View Source
const ErrCodeOperationNotPermitted = "OperationNotPermitted"
View Source
const (
	GlobalRegionID = "global"
)
View Source
const StateDeleted = "deleted"

StateDeleted is a generic constant for the word deleted for state

View Source
const StateDeleting = "deleting"

StateDeleting is a generic constant for the word deleting for state

View Source
const StateRejected = "rejected"

StateRejected is a generic constant for the word rejected for state

Variables

View Source
var (
	// DefaultRegionID The default region. Can be customized for non AWS implementations
	DefaultRegionID = "us-east-1"

	// DefaultAWSPartitionID The default aws partition. Can be customized for non AWS implementations
	DefaultAWSPartitionID = "aws"
)
View Source
var (
	RESecretHeader = regexp.MustCompile(`(?m:^([^:]*(Auth|Security)[^:]*):.*$)`)
)

Functions

func DumpRequest

func DumpRequest(r *http.Request) string

func DumpResponse

func DumpResponse(r *http.Response) string

func HideSecureHeaders

func HideSecureHeaders(dump []byte) []byte

func IsAWSError

func IsAWSError(err error, code string) bool

Types

type Account

type Account struct {
	*Credentials
	// contains filtered or unexported fields
}

func NewAccount

func NewAccount(creds *Credentials, endpoints config.CustomEndpoints) (*Account, error)

func (*Account) ARN

func (a *Account) ARN() string

ARN returns the STS Authenticated ARN for the account

func (*Account) Alias

func (a *Account) Alias() string

Alias returns the first alias for the account

func (*Account) Aliases

func (a *Account) Aliases() []string

Aliases returns the list of aliases for the account

func (*Account) DisabledRegions

func (a *Account) DisabledRegions() []string

DisabledRegions returns the list of regions that are disabled for the account

func (*Account) ID

func (a *Account) ID() string

ID returns the account ID

func (*Account) Regions

func (a *Account) Regions() []string

Regions returns the list of regions that are enabled for the account

func (*Account) ResourceTypeToServiceType

func (a *Account) ResourceTypeToServiceType(regionName, resourceType string) string

func (*Account) UserID

func (a *Account) UserID() string

UserID returns the authenticated user ID

type Credentials

type Credentials struct {
	Profile string

	AccessKeyID     string
	SecretAccessKey string
	SessionToken    string
	AssumeRoleArn   string
	ExternalID      string
	RoleSessionName string

	Credentials *credentials.Credentials

	CustomEndpoints config.CustomEndpoints
	// contains filtered or unexported fields
}

func (*Credentials) HasAwsCredentials

func (c *Credentials) HasAwsCredentials() bool

func (*Credentials) HasKeys

func (c *Credentials) HasKeys() bool

func (*Credentials) HasProfile

func (c *Credentials) HasProfile() bool

func (*Credentials) NewConfig added in v3.35.0

func (c *Credentials) NewConfig(ctx context.Context, region, serviceType string) (*aws.Config, error)

func (*Credentials) NewSession

func (c *Credentials) NewSession(region, serviceType string) (*session.Session, error)

func (*Credentials) Validate

func (c *Credentials) Validate() error

type SkipGlobal added in v3.35.0

type SkipGlobal struct{}

SkipGlobal returns ErrSkipRequest when operating in the global pseudo-region.

FUTURE: define mechanism for allowing specific resources, such as those in IAM, to override this skip.

The simplest way to do this would be to remove this middleware through functional options on relevant operations. e.g.:

 func isGlobalResource(o *iam.Options) {
	o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
		stack.Initialize.Remove(config.SkipGlobal{}.ID())
	})
 }

 // per-operation
 out, err := svc.ListRoles(context.Background(), nil, isGlobalResource)
 // on a client, if you know you're only operating in the context of global resources
 svc := iam.NewFromConfig(cfg, isGlobalResource)

You could also define some kind of "is global resource" Context flag, which SkipGlobal could react to. That may be preferrable to having SkipGlobal be exported from this package.

func (SkipGlobal) HandleInitialize added in v3.35.0

func (SkipGlobal) ID added in v3.35.0

func (SkipGlobal) ID() string

Jump to

Keyboard shortcuts

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