aws

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 32 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package aws holds the adapters of the estimate's ports over the AWS SDK for Go v2: a profile's shared configuration (SSO sessions included), the accounts it reaches (STS, Organizations), an account's clients in a region (the scan's, what a nap stops, the EKS clusters and their API), the Price List and Spot price history. Read-only: Describe, List and Get calls, and sts:AssumeRole (readonly_test.go). The adapters map the SDK's types to the ports' AWS JSON shapes field by field, and return the SDK's errors as they are (awserr reads them).

This file: the shared configuration, an account's credentials, the clients' retries and an account's clients in a region. Ports manager packages/estimate/src/bin.ts (awsOf: fromIni, the profile's credentials or a role's per account, portsOf) and packages/discovery/src/aws.ts (regionalClients).

Index

Constants

This section is empty.

Variables

View Source
var ReadOnlyOperations = []string{
	"autoscaling.DescribeAutoScalingGroups",
	"cloudwatch.GetMetricData",
	"ec2.DescribeInstances",
	"ec2.DescribeRegions",
	"ec2.DescribeSecurityGroups",
	"ec2.DescribeSpotPriceHistory",
	"ecs.DescribeServices",
	"ecs.DescribeTaskDefinition",
	"ecs.ListClusters",
	"ecs.ListServices",
	"eks.DescribeCluster",
	"eks.ListClusters",
	"elasticloadbalancingv2.DescribeListeners",
	"elasticloadbalancingv2.DescribeLoadBalancers",
	"elasticloadbalancingv2.DescribeRules",
	"elasticloadbalancingv2.DescribeTags",
	"elasticloadbalancingv2.DescribeTargetGroups",
	"elasticloadbalancingv2.DescribeTargetHealth",
	"organizations.DescribeOrganization",
	"organizations.ListAccountsForParent",
	"organizations.ListOrganizationalUnitsForParent",
	"organizations.ListRoots",
	"organizations.ListTagsForResource",
	"pricing.GetProducts",
	"rds.DescribeDBClusters",
	"rds.DescribeDBInstances",
	"sts.AssumeRole",
	"sts.GetCallerIdentity",
}

ReadOnlyOperations are the operations the adapters call, as <service>.<Operation>: the list the read-only test checks the sources against, and the README's permissions are checked against.

Functions

func EnabledRegions

func EnabledRegions(ctx context.Context, cfg awssdk.Config) ([]string, error)

EnabledRegions are the regions an account has enabled (opt-in regions only once opted in), asked in us-east-1 with the account's configuration (Of).

func Load

func Load(ctx context.Context, profile string) (awssdk.Config, error)

Load is a profile's shared configuration (~/.aws/config and credentials, or AWS_CONFIG_FILE and AWS_SHARED_CREDENTIALS_FILE; SSO sessions included). Its credentials are resolved when a call needs them, refreshed by the SDK. A profile missing from the config is an error carrying the SDK's message; an expired SSO session fails the first call with the SDK's message ("the SSO session has expired or is invalid", "cached SSO token is expired"), before anything is sent.

func NewAccounts

func NewAccounts(cfg awssdk.Config) accounts.Ports

NewAccounts is a profile's accounts.Ports: STS and Organizations in us-east-1, the SDK's standard retries.

func NewPricing

func NewPricing(cfg awssdk.Config) prices.PricingPort

NewPricing is the Price List API, asked in us-east-1 with the profile's configuration, the SDK's standard retries.

func NewSpot

func NewSpot(cfg awssdk.Config) prices.SpotPort

NewSpot is the Spot price history with the profile's configuration, an EC2 client made per region when first asked, the SDK's standard retries.

func Of

func Of(cfg awssdk.Config, creds *awssdk.Credentials) awssdk.Config

Of is an account's configuration: the profile's own (creds nil: the profile's own account, its credentials refreshed by the SDK) or with a role's credentials, as assumed (accounts.ReachedAccount's Credentials).

Types

type Region

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

Region is an account's clients in a region (discovery's regionalClients and the estimate's portsOf): ELB in adaptive retry mode; Auto Scaling, EC2, ECS, CloudWatch, EKS and RDS with the standard retryer; 5 attempts each, whatever the user's max_attempts or retry_mode (Node's explicit maxAttempts).

func NewRegion

func NewRegion(cfg awssdk.Config, region, reader string) *Region

NewRegion makes an account's clients in a region (cfg: the account's, from Of). reader names who reads the EKS clusters, in the reason of one it cannot read (the estimate: "the profile").

func (*Region) Discover

func (r *Region) Discover(where discover.Where, now func() time.Time) discover.RegionPorts

Discover is the ports of the region's discovery: the scan (ScanRegion with the region's ports, at now()), the Auto Scaling groups, rules by ARN, EC2 and what a nap stops. Make one Region per account and region (its EKS clusters are kept 15 minutes).

func (*Region) Metrics

func (r *Region) Metrics() metrics.CloudWatchPort

Metrics is the region's CloudWatch for the estimate's requests and uptime (metrics.RequestsAll, metrics.UptimeAll): the scan's adapter, in the estimate's port.

func (*Region) Scan

func (r *Region) Scan() discover.ScanPorts

Scan is the ports of the region's scan (discover.ScanRegion): ELB, Auto Scaling, EC2, ECS, CloudWatch and the EKS clusters.

func (*Region) Stopped

func (r *Region) Stopped() stopped.Ports

Stopped is the ports of what a nap stops in the region (stopped.Describe): EC2, ECS, RDS and the clusters' clients, the scan's.

Jump to

Keyboard shortcuts

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