oam

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 25 Imported by: 0

README

Oam

Parity grade: B · SDK aws-sdk-go-v2/service/oam@v1.31.4 · last audited 2026-10-18 (64eb45859)

Coverage

Metric Value
PARITY entries audited 15 (15 ok)
Feature families 3 (3 ok)
Known gaps 4
Structural gaps (can't be emulated) 1
Deferred items 0
Resource leaks clean
Known gaps
  • SinkPolicyDenied: a policy that does not allow the caller is reported as InvalidParameterException because OAM models no access-denied exception; the live error code is not verified
  • Quotas: the one sink per account and Region limit and the one link per source account, Region and sink limit follow AWS documentation and are not verified against the live API
  • LabelTemplate: without an Organizations directory $AccountName, $AccountEmail and $AccountEmailNoDomain all resolve to the account ID
  • CloudFormation: AWS::Oam::Sink and AWS::Oam::Link are not provisioned by the CloudFormation emulator
Structural gaps

These do not block an A grade — no implementation could produce real data here because the underlying data source cannot exist in an emulator.

  • No cross-account data plane: linked metrics, log groups and traces are not shared into the monitoring account because the emulated CloudWatch, Logs and X-Ray backends have no cross-account query path.

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConflict             = errors.New("conflict")
	ErrInvalidParameter     = errors.New("invalid parameter")
	ErrMissingParameter     = errors.New("missing required parameter")
	ErrResourceNotFound     = errors.New("resource not found")
	ErrServiceQuotaExceeded = errors.New("service quota exceeded")
	ErrTooManyTags          = errors.New("too many tags")
)

Sentinels, one per exception in the pinned SDK's error set.

Functions

This section is empty.

Types

type AccountDirectory

type AccountDirectory interface {
	AccountInfo(accountID string) (AccountInfo, bool)
}

AccountDirectory resolves account details from the organization, when one is wired.

type AccountInfo

type AccountInfo struct {
	Name  string
	Email string
	OrgID string
}

AccountInfo describes an account for link labels and sink policy conditions.

type Handler

type Handler struct {
	Backend *InMemoryBackend
	// contains filtered or unexported fields
}

Handler serves the CloudWatch Observability Access Manager REST-JSON API.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler wraps a backend.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations returns the fault-injectable operations.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns the regions served.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase service name for fault rules.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation returns the operation name for metrics.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource returns the ARN label for metrics.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations lists every implemented operation.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher matches by SigV4 signing name (or SDK user agent) plus a known path shape.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable.

type InMemoryBackend

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

InMemoryBackend is the OAM state; one coarse lock guards both tables.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates an empty backend.

func (*InMemoryBackend) AccountID

func (b *InMemoryBackend) AccountID() string

AccountID returns the default account.

func (b *InMemoryBackend) CreateLink(ctx context.Context, in LinkInput) (*Link, error)

CreateLink links the caller's account and Region to a sink, subject to the sink policy.

func (*InMemoryBackend) CreateSink

func (b *InMemoryBackend) CreateSink(ctx context.Context, name string, tagMap map[string]string) (*Sink, error)

CreateSink creates a sink in the caller's account and Region.

func (b *InMemoryBackend) DeleteLink(ctx context.Context, identifier string) error

DeleteLink removes a link.

func (*InMemoryBackend) DeleteSink

func (b *InMemoryBackend) DeleteSink(ctx context.Context, identifier string) error

DeleteSink deletes a sink that has no links.

func (b *InMemoryBackend) GetLink(ctx context.Context, identifier string) (*Link, error)

GetLink returns a link by ARN or ID.

func (*InMemoryBackend) GetSink

func (b *InMemoryBackend) GetSink(ctx context.Context, identifier string) (*Sink, error)

GetSink returns a sink by ARN or ID.

func (*InMemoryBackend) GetSinkPolicy

func (b *InMemoryBackend) GetSinkPolicy(ctx context.Context, identifier string) (*Sink, error)

GetSinkPolicy returns the sink and its policy.

func (b *InMemoryBackend) ListAttachedLinks(
	ctx context.Context, sinkIdentifier, token string, maxResults *int32,
) (page.Page[*Link], error)

ListAttachedLinks returns the links attached to one of the caller's sinks.

func (b *InMemoryBackend) ListLinks(ctx context.Context, token string, maxResults *int32) (page.Page[*Link], error)

ListLinks returns the caller's links in creation order.

func (*InMemoryBackend) ListSinks

func (b *InMemoryBackend) ListSinks(ctx context.Context, token string, maxResults *int32) (page.Page[*Sink], error)

ListSinks returns the caller's sinks in creation order.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(ctx context.Context, resource string) (map[string]string, error)

ListTagsForResource returns the tags of a sink or link.

func (*InMemoryBackend) PutSinkPolicy

func (b *InMemoryBackend) PutSinkPolicy(ctx context.Context, identifier, policy string) (*Sink, error)

PutSinkPolicy sets the sink policy.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the default region.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears every table.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads a snapshot; an incompatible version is discarded.

func (*InMemoryBackend) SetAccountDirectory

func (b *InMemoryBackend) SetAccountDirectory(d AccountDirectory)

SetAccountDirectory wires the Organizations lookup.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(ctx context.Context, resource string, add map[string]string) error

TagResource adds or replaces tags on a sink or link.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(ctx context.Context, resource string, keys []string) error

UntagResource removes tags by key.

func (b *InMemoryBackend) UpdateLink(
	ctx context.Context, identifier string, resourceTypes []string, cfg *LinkConfig,
) (*Link, error)

UpdateLink replaces a link's resource types and, when given, its filters.

type Link struct {
	Tags           map[string]string `json:"tags,omitempty"`
	LogGroupFilter *string           `json:"logGroupFilter,omitempty"`
	MetricFilter   *string           `json:"metricFilter,omitempty"`
	ARN            string            `json:"arn"`
	ID             string            `json:"id"`
	Label          string            `json:"label"`
	LabelTemplate  string            `json:"labelTemplate"`
	SinkARN        string            `json:"sinkArn"`
	Account        string            `json:"account"`
	Region         string            `json:"region"`
	ResourceTypes  []string          `json:"resourceTypes"`
	Seq            int64             `json:"seq"`
}

Link is a source-account link to a sink.

type LinkConfig

type LinkConfig struct {
	LogGroupFilter *string
	MetricFilter   *string
}

LinkConfig is the optional filter set of a link.

type LinkInput

type LinkInput struct {
	Config        LinkConfig
	Tags          map[string]string
	SinkARN       string
	LabelTemplate string
	ResourceTypes []string
}

LinkInput carries the editable fields of CreateLink.

type Provider

type Provider struct{}

Provider implements service.Provider for CloudWatch Observability Access Manager.

func (*Provider) Init

Init builds the backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type Sink

type Sink struct {
	Tags      map[string]string `json:"tags,omitempty"`
	ARN       string            `json:"arn"`
	ID        string            `json:"id"`
	Name      string            `json:"name"`
	Account   string            `json:"account"`
	Region    string            `json:"region"`
	Policy    string            `json:"policy,omitempty"`
	Seq       int64             `json:"seq"`
	HasPolicy bool              `json:"hasPolicy,omitempty"`
}

Sink is a monitoring-account sink.

Jump to

Keyboard shortcuts

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