aws

package
v0.0.0-...-8b2116b Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const CreateHostedZoneCommentLegacy = "Created by defang cli"

Variables

View Source
var (
	ErrZoneNotFound         = errors.New("the Route53 hosted zone was not found")
	ErrNoRecordFound        = errors.New("no Route53 record found in the hosted zone")
	ErrNoDelegationSetFound = errors.New("no Route53 delegation set found")
)
View Source
var NewS3FromConfig = func(cfg aws.Config) S3GetObjectAPI {
	return s3.NewFromConfig(cfg)
}
View Source
var NewSsmFromConfig = func(cfg aws.Config) SsmParametersAPI {
	return ssm.NewFromConfig(cfg)
}
View Source
var NewStsFromConfig = func(cfg aws.Config) StsClientAPI {
	return sts.NewFromConfig(cfg)
}

Functions

func CreateDelegationSet

func CreateDelegationSet(ctx context.Context, zoneId *string, r53 Route53API) (*types.DelegationSet, error)

func CreateHostedZone deprecated

func CreateHostedZone(ctx context.Context, domain string, r53 Route53API) (*types.HostedZone, error)

Deprecated: let Pulumi create the hosted zone

func DeleteDelegationSet

func DeleteDelegationSet(ctx context.Context, delegationSetId *string, r53 Route53API) error

func GetAccountID

func GetAccountID(arn string) string

func GetDelegationSetByZone

func GetDelegationSetByZone(ctx context.Context, zoneId *string, r53 Route53API) (*types.DelegationSet, error)

func GetHostedZoneTags

func GetHostedZoneTags(ctx context.Context, zoneId string, r53 Route53API) (map[string]string, error)

func GetHostedZonesByName

func GetHostedZonesByName(ctx context.Context, domain string, r53 Route53API) ([]*types.HostedZone, error)

func IsParameterNotFoundError deprecated

func IsParameterNotFoundError(err error) bool

Deprecated: use ErrParameterNotFound directly

func IsS3NoSuchKeyError deprecated

func IsS3NoSuchKeyError(err error) bool

Deprecated: use ErrNoSuchKey directly

func ListHostedZonesByDelegationSet

func ListHostedZonesByDelegationSet(ctx context.Context, delegationSetId *string, r53 Route53API) ([]types.HostedZone, error)

func ListResourceRecords

func ListResourceRecords(ctx context.Context, zoneId, recordName string, recordType types.RRType, r53 Route53API) ([]string, error)

func ListReusableDelegationSets

func ListReusableDelegationSets(ctx context.Context, r53 Route53API) ([]types.DelegationSet, error)

func LoadDefaultConfig

func LoadDefaultConfig(ctx context.Context, optFns ...func(*config.LoadOptions) error) (aws.Config, error)

func MakeARN

func MakeARN(partition, service, region, accountId, resourceId string) string

func PutSecretManagerSecret

func PutSecretManagerSecret(ctx context.Context, name, value string, svc SecretManagerAPI) (string, error)

func RetrieveToken

func RetrieveToken(ctx context.Context, tokenURL, clientID, authCode, verifier, redirectURI string) (*awsTokenCache, error)

RetrieveToken calls POST /v1/token with a DPoP-signed request and returns an awsTokenCache ready to be persisted.

Types

type Aws

type Aws struct {
	AccountID   string
	Region      Region
	TokenStore  tokenstore.TokenStore
	Credentials aws.CredentialsProvider
	// contains filtered or unexported fields
}

func (*Aws) Authenticate

func (a *Aws) Authenticate(ctx context.Context, interactive bool) error

Authenticate sets up AWS credentials for the session in order of preference:

  1. Existing default AWS credentials (env vars, ~/.aws/credentials, instance profile, etc.)
  2. Previously saved OAuth tokens from the TokenStore (auto-refreshed if expired)
  3. Interactive browser-based OAuth login

On success, a.Credentials is set so that subsequent calls to LoadConfig() use them.

func (*Aws) CheckImageExistOnPublicECR

func (a *Aws) CheckImageExistOnPublicECR(ctx context.Context, repo, tag string) (bool, error)

func (*Aws) CrossDeviceLogin

func (a *Aws) CrossDeviceLogin(ctx context.Context) (*awsTokenCache, error)

CrossDeviceLogin runs the cross-device flow for remote/SSH sessions where the browser runs on a different machine. It prints the auth URL and prompts the user to paste the base64-encoded verification code displayed in their browser. TODO: Support cross device login workflow with a flag

func (*Aws) DeleteSecrets

func (a *Aws) DeleteSecrets(ctx context.Context, names ...string) error

func (*Aws) GetStackAwsProfileRoleArn

func (a *Aws) GetStackAwsProfileRoleArn(ctx context.Context) (string, string, error)

func (*Aws) InteractiveLogin

func (a *Aws) InteractiveLogin(ctx context.Context) (*awsTokenCache, error)

InteractiveLogin runs the same-device AWS Sign-In OAuth2 + PKCE + DPoP browser flow:

  1. Starts a local HTTP server on a random port to receive the redirect
  2. Builds the authorization URL and prompts the user to open it (Enter opens browser)
  3. Waits for the callback with code+state
  4. Exchanges the code for AWS credentials via DPoP-signed token request

func (*Aws) IsValidSecret

func (a *Aws) IsValidSecret(ctx context.Context, name string) (bool, error)

func (*Aws) ListSecrets

func (a *Aws) ListSecrets(ctx context.Context) ([]string, error)

func (*Aws) ListSecretsByPrefix

func (a *Aws) ListSecretsByPrefix(ctx context.Context, prefix string) ([]string, error)

func (*Aws) LoadConfig

func (a *Aws) LoadConfig(ctx context.Context) (aws.Config, error)

func (*Aws) MakeRegionalARN

func (a *Aws) MakeRegionalARN(service, resourceId string) string

func (*Aws) PutSecret

func (a *Aws) PutSecret(ctx context.Context, name, value string) error

func (*Aws) RevokeDefaultSecurityGroupRules

func (a *Aws) RevokeDefaultSecurityGroupRules(ctx context.Context, sgId string) error

type ErrNoSuchKey

type ErrNoSuchKey = types.NoSuchKey

type ErrParameterNotFound

type ErrParameterNotFound = types.ParameterNotFound

type MockS3ClientAPI

type MockS3ClientAPI struct{}

func (MockS3ClientAPI) GetObject

func (MockS3ClientAPI) GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)

type MockStsClientAPI

type MockStsClientAPI struct{}

func (MockStsClientAPI) AssumeRole

func (MockStsClientAPI) AssumeRole(ctx context.Context, params *sts.AssumeRoleInput, optFns ...func(*sts.Options)) (*sts.AssumeRoleOutput, error)

func (MockStsClientAPI) GetCallerIdentity

func (MockStsClientAPI) GetCallerIdentity(ctx context.Context, params *sts.GetCallerIdentityInput, optFns ...func(*sts.Options)) (*sts.GetCallerIdentityOutput, error)

type PublicECRAPI

type PublicECRAPI interface {
	GetAuthorizationToken(ctx context.Context, params *ecrpublic.GetAuthorizationTokenInput, optFns ...func(*ecrpublic.Options)) (*ecrpublic.GetAuthorizationTokenOutput, error)
}

type Region

type Region = r53types.VPCRegion

type Route53API

type Route53API interface {
	CreateHostedZone(ctx context.Context, params *route53.CreateHostedZoneInput, optFns ...func(*route53.Options)) (*route53.CreateHostedZoneOutput, error)
	CreateReusableDelegationSet(ctx context.Context, params *route53.CreateReusableDelegationSetInput, optFns ...func(*route53.Options)) (*route53.CreateReusableDelegationSetOutput, error)
	DeleteReusableDelegationSet(ctx context.Context, params *route53.DeleteReusableDelegationSetInput, optFns ...func(*route53.Options)) (*route53.DeleteReusableDelegationSetOutput, error)
	GetHostedZone(ctx context.Context, params *route53.GetHostedZoneInput, optFns ...func(*route53.Options)) (*route53.GetHostedZoneOutput, error)
	ListReusableDelegationSets(ctx context.Context, params *route53.ListReusableDelegationSetsInput, optFns ...func(*route53.Options)) (*route53.ListReusableDelegationSetsOutput, error)

	ListHostedZones(ctx context.Context, params *route53.ListHostedZonesInput, optFns ...func(*route53.Options)) (*route53.ListHostedZonesOutput, error)
	ListHostedZonesByName(ctx context.Context, params *route53.ListHostedZonesByNameInput, optFns ...func(*route53.Options)) (*route53.ListHostedZonesByNameOutput, error)
	ListResourceRecordSets(ctx context.Context, params *route53.ListResourceRecordSetsInput, optFns ...func(*route53.Options)) (*route53.ListResourceRecordSetsOutput, error)
	ListTagsForResource(ctx context.Context, params *route53.ListTagsForResourceInput, optFns ...func(*route53.Options)) (*route53.ListTagsForResourceOutput, error)
}

type S3GetObjectAPI

type S3GetObjectAPI interface {
	GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
}

type SsmParametersAPI

type SsmParametersAPI interface {
	DescribeParameters(ctx context.Context, params *ssm.DescribeParametersInput, optFns ...func(*ssm.Options)) (*ssm.DescribeParametersOutput, error)
	PutParameter(ctx context.Context, params *ssm.PutParameterInput, optFns ...func(*ssm.Options)) (*ssm.PutParameterOutput, error)
	DeleteParameters(ctx context.Context, params *ssm.DeleteParametersInput, optFns ...func(*ssm.Options)) (*ssm.DeleteParametersOutput, error)
	GetParameters(ctx context.Context, params *ssm.GetParametersInput, optFns ...func(*ssm.Options)) (*ssm.GetParametersOutput, error)
	GetParametersByPath(ctx context.Context, params *ssm.GetParametersByPathInput, optFns ...func(*ssm.Options)) (*ssm.GetParametersByPathOutput, error)
}

type StsClientAPI

type StsClientAPI interface {
	GetCallerIdentity(ctx context.Context, params *sts.GetCallerIdentityInput, optFns ...func(*sts.Options)) (*sts.GetCallerIdentityOutput, error)
	AssumeRole(ctx context.Context, params *sts.AssumeRoleInput, optFns ...func(*sts.Options)) (*sts.AssumeRoleOutput, error)
}

type TokenExchangeRequest

type TokenExchangeRequest struct {
	ClientID     string `json:"clientId"`
	GrantType    string `json:"grantType"` // "authorization_code" or "refresh_token"
	Code         string `json:"code,omitempty"`
	CodeVerifier string `json:"codeVerifier,omitempty"`
	RedirectURI  string `json:"redirectUri,omitempty"`
	RefreshToken string `json:"refreshToken,omitempty"`
}

Directories

Path Synopsis
cfn
ecs

Jump to

Keyboard shortcuts

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