Documentation
¶
Overview ¶
Package accounts says which accounts an estimate reaches (vision docs/specs/2026-10-10-savings-estimate-design.md §4, decision 4): an organization's active accounts when the profile may list them, else its own account only, and why. The profile's own account uses its own credentials; the others a role given or supposed (OrganizationAccountAccessRole), assumed when an account's turn comes (the sessions last an hour) — a refusal lists the account apart with AWS's reason and the fix. Restricted to the accounts given with --accounts: one not reached is listed apart with why; none of them, refused. Several profiles (such as one SSO profile per account): each reaches its accounts, merged; an account a profile logs in to directly is reached with it, never through another's role; --accounts restricts the merged accounts.
Ports manager packages/estimate/src/accounts.ts (AccountsPorts, reachAccounts, reachProfiles).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
Role string
Only []string
Now func() time.Time
Unreachable *Unreachables
// Profile names the profile in what is said; Say says each step (nil: nothing); Listing passes the organization's
// walk on as it goes (nil: nothing). The user, 2026-10-14: a large organization took a while without a word.
Profile string
Say func(line string)
Listing func(discover.InventoryProgress)
}
Options of Reach and ReachProfiles. Only: the accounts given with --accounts (nil: every account reached). Now: the clock (time.Now when nil). Unreachable: where the accounts refusing their role are listed, shared by several profiles (a new list when nil).
type Ports ¶
type Ports interface {
Whoami(ctx context.Context) (string, error)
Organization(ctx context.Context) (string, error)
// Inventory walks the organization, saying how far it is (progress nil: silent).
Inventory(ctx context.Context, progress func(discover.InventoryProgress)) (discover.OrgInventory, error)
Assume(ctx context.Context, account, role string) (aws.Credentials, error)
}
Ports are a profile's calls that reach accounts (Node's AccountsPorts): its own account (GetCallerIdentity), its organization (DescribeOrganization), the organization's active accounts (the inventory) and a role assumed in an account (AssumeRole).
type Reached ¶
type Reached struct {
Organization *string `json:"organization"`
Why *string `json:"why"`
Accounts []ReachedAccount `json:"accounts"`
Unreachable *Unreachables `json:"unreachable"`
Listed int `json:"listed"`
}
Reached is what an estimate reaches: the organization (nil when none, or several profiles in different ones), why only some accounts are (nil when all), the accounts, those not reached, and Listed, how many were reached before --accounts restricted them.
func ReachProfiles ¶
ReachProfiles gives the accounts several profiles reach, merged in their order: an account reached by several, with the profile whose own account it is when one is (and the name another knows); the organization when they share one; each profile's why. One profile: as reached alone (Node's reachProfiles). A profile that fails names itself in the error's message.
type ReachedAccount ¶
type ReachedAccount struct {
Account string `json:"account"`
Name string `json:"name"`
Own bool `json:"own,omitempty"`
Profile string `json:"profile,omitempty"`
// Credentials are the account's: nil for the profile's own account, else
// its role's, assumed when first asked and again five minutes before they
// expire; a refusal is kept and said once.
Credentials func(ctx context.Context) (*aws.Credentials, error) `json:"-"`
}
ReachedAccount is an account reached. Own: the profile's own account, whose Credentials are nil (the profile's own); Profile: the profile reaching it.
type Unreachable ¶
type Unreachable struct {
Account string `json:"account"`
Name string `json:"name"`
Reason string `json:"reason"`
Fix string `json:"fix"`
}
Unreachable is an account not reached, why, and how to include it.
type Unreachables ¶
type Unreachables struct {
// contains filtered or unexported fields
}
Unreachables lists the accounts not reached: those --accounts names that are not, and those refusing their role, as their turn comes. Safe for concurrent use; written as a JSON array.
func (*Unreachables) List ¶
func (u *Unreachables) List() []Unreachable
List is a copy of the accounts listed so far.
func (*Unreachables) MarshalJSON ¶
func (u *Unreachables) MarshalJSON() ([]byte, error)
MarshalJSON writes the list.