awssts

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package awssts answers one question: which AWS account is this credential in.

ONE CALL, AND IT EXISTS FOR A REFUSAL. `billet acceptance` stands up a deployment that launches real compute and then destroys everything it finds belonging to itself, and the instruction an operator gives it is "do that in account N". Without asking, "account N" is a comment: the command would run against whatever credential happened to be in the environment, which on a developer's machine is routinely the wrong one.

A LEAF BESIDE internal/awssig, for the reason internal/awsquota is one: the provider packages are siblings that may not import each other, and this is not a compute backend at all.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAccount = errors.New("awssts: the response carried no account id")

ErrNoAccount is what a caller gets when the response carried no account.

SEPARATE FROM A TRANSPORT FAILURE, because the two mean opposite things to a refusal: "I could not ask" must never read as "the account does not match".

Functions

func Endpoint

func Endpoint(region string) (string, string)

Endpoint returns the STS endpoint and signing region for an AWS region.

REGIONAL RATHER THAN GLOBAL, deliberately. The global endpoint (sts.amazonaws.com) exists and works, and using it would mean a GovCloud or China credential signing against a host in the commercial partition — which fails, and fails with an authentication error rather than anything that names the partition. A regional endpoint is derived from the region billet was already told to use.

Types

type Client

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

Client calls GetCallerIdentity.

func New

func New(region, endpoint string, creds awscreds.Source, httpClient *http.Client) *Client

New builds a client for one region. An empty endpoint takes the regional one.

func (*Client) Whoami

func (c *Client) Whoami(ctx context.Context) (Identity, error)

Whoami answers who this credential is.

THREE ANSWERS, NOT TWO. A successful call with an account, a call that could not be made, and a call that answered without one — the last is ErrNoAccount, so a caller comparing accounts can refuse rather than compare against "".

type Identity

type Identity struct {
	// Account is the twelve-digit account id — the only field billet compares.
	Account string
	// ARN and UserID are reported, never matched. An acceptance run prints them
	// so a person reading a log can see WHICH principal did the work, which is
	// the question that follows "was it the right account".
	ARN    string
	UserID string
}

Identity is who a credential belongs to.

Jump to

Keyboard shortcuts

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