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 ¶
- Variables
- func EnabledRegions(ctx context.Context, cfg awssdk.Config) ([]string, error)
- func Load(ctx context.Context, profile string) (awssdk.Config, error)
- func NewAccounts(cfg awssdk.Config) accounts.Ports
- func NewPricing(cfg awssdk.Config) prices.PricingPort
- func NewSpot(cfg awssdk.Config) prices.SpotPort
- func Of(cfg awssdk.Config, creds *awssdk.Credentials) awssdk.Config
- type Region
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
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 ¶
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.
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 ¶
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 ¶
Discover is the ports of the region's discovery: the scan (ScanRegion with the region's ports, at now(); with the standalone scan too), 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.