Documentation
¶
Overview ¶
Package awsinv reads an AWS resource's tags from an organization-level inventory.
The tags patchy needs are not reliably in the payload that brought the finding. A scanner delivery describes the resource (ARN, type, account), but its tags are optional, point-in-time extras, so ownership is looked up separately. Two inventories can answer, and which one an estate has is a deployment fact: AWS Config with an organization aggregator (common in large enterprises, where Config already runs estate-wide for compliance) or an organization-wide AWS Resource Explorer view (free, and available without Config). Exactly one is configured. Both answer the same question, so nothing downstream can tell them apart.
Credentials come from the SDK default chain. In-cluster that means EKS Pod Identity, IRSA, or web-identity federation, so no key material exists anywhere. This read-only lookup is the only reason context-controller talks to AWS.
The client is one struct with one lookup method, so the enhancer that uses it can be tested against a hand-written fake, and neither the enhancer nor anything in pkg/ names an AWS SDK type.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("resource not found in aws inventory")
ErrNotFound reports that the inventory has no record of the resource. It is a permanent answer: the resource may have been deleted since the finding was raised, be of a type the inventory does not record, or not be indexed yet. Callers do not retry it.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client reads resource tags from one of the two inventories. This package declares no interface for it: the consumer declares the one-method interface it needs, and Client satisfies it.
func New ¶
New builds a client for the configured backend and verifies the backend is usable: the aggregator exists, or the view exists and includes the tags property. Without that property every lookup would "succeed" with no tags, so New fails instead. Credentials come from the SDK default chain (EKS Pod Identity or IRSA on EKS, web-identity federation elsewhere), so no key material exists anywhere.
func (*Client) Close ¶
Close releases nothing, since the SDK clients hold no connection of their own. It exists so the enhancer can treat both cloud clients alike.
func (*Client) TagsFor ¶
TagsFor returns the tags of one resource, named by its ARN. The ARN is an exact identifier in both inventories, so there is no fallback search: a miss means the resource is unrecorded, not misspelled.
ErrNotFound is final; every other error is worth retrying. The enhancer chain uses that to decide between advancing a finding and holding it for another try.
type Config ¶
type Config struct {
// ConfigAggregator queries an AWS Config aggregator.
ConfigAggregator *ConfigAggregator
// ResourceExplorer searches a Resource Explorer view.
ResourceExplorer *ResourceExplorer
}
Config selects exactly one inventory backend.
type ConfigAggregator ¶
type ConfigAggregator struct {
// Name of the aggregator.
Name string
// Region is the aggregator's region.
Region string
}
ConfigAggregator names the AWS Config configuration aggregator to query.
type ResourceExplorer ¶
type ResourceExplorer struct {
// ViewARN of the organization-wide view.
ViewARN string
}
ResourceExplorer names the Resource Explorer view to search. The region the view lives in is read from its ARN.