resourceexplorer2

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 27 Imported by: 0

README

Resourceexplorer2

Parity grade: B · SDK aws-sdk-go-v2/service/resourceexplorer2@v1.33.4 · last audited 2026-10-18 (e1a1dfbea)

Coverage

Metric Value
PARITY entries audited 27 (27 ok)
Feature families 5 (5 ok)
Known gaps 13
Structural gaps (can't be emulated) 1
Deferred items 0
Resource leaks clean
Known gaps
  • GetServiceIndex: not implemented; service-linked indexes are created by AWS services and no emulator path creates one
  • GetServiceView: not implemented; same reason as GetServiceIndex
  • ListServiceIndexes: not implemented; same reason as GetServiceIndex
  • ListServiceViews: not implemented; same reason as GetServiceIndex
  • ListStreamingAccessForServices: not implemented; no service streaming access is ever granted
  • ListSupportedResourceTypes: 46 curated types, not the full AWS catalog
  • Search: keywords match as case-insensitive substrings over the ARN and tag text, not as AWS tokens; the application filter is unsupported and an unknown filter is treated as a keyword
  • Search: only services wired into the tagging aggregation (and the five EC2 kinds) are indexed; other emulated services are invisible
  • GetManagedView: the two managed views (SSM, Resilience Hub) are emulator-defined; real names, ARNs and policies are unverified
  • ListIndexesForMembers: no organization membership or delegated-administrator check
  • CreateView: organization and OU scopes are accepted without validating them against Organizations
  • ConflictException: several conflict and validation cases (view without an index, aggregator rules, duplicate type update) use codes chosen from documented behaviour, not from SDK evidence
  • MaxResults: the 1-100 (views 1-20) ranges are not in the SDK and are unverified
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.

  • Indexing is instantaneous and always complete: there is no crawler, so LastReportedAt is the query time and replication lag between Regions cannot occur.

More

Documentation

Overview

Package resourceexplorer2 emulates the AWS Resource Explorer control and search plane.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SupportedServices

func SupportedServices() []string

SupportedServices lists the distinct services of the searchable resource types.

Types

type AccountState

type AccountState struct {
	AggregatorBlockedUntil time.Time `json:"aggregatorBlockedUntil"`
	AccountID              string    `json:"accountID"`
}

AccountState holds account-wide index bookkeeping.

type CreateViewInput

type CreateViewInput struct {
	Filters            *SearchFilter
	Tags               map[string]string
	ViewName           string
	ClientToken        string
	Scope              string
	IncludedProperties []IncludedProperty
}

CreateViewInput carries CreateView arguments.

type DefaultView

type DefaultView struct {
	Key     string `json:"key"`
	ViewARN string `json:"viewArn"`
}

DefaultView records the default view of an account in a Region; Key is "account|region".

type ErrorDetail

type ErrorDetail struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

ErrorDetail is a per-Region failure recorded by a setup task.

type Handler

type Handler struct {
	Backend *InMemoryBackend

	DefaultRegion string
	// contains filtered or unexported fields
}

Handler serves the Resource Explorer REST-JSON API.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler wraps a backend.

func (*Handler) ChaosOperations

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

ChaosOperations lists the fault-injectable operations.

func (*Handler) ChaosRegions

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

ChaosRegions lists the regions this handler serves.

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.

func (*Handler) ExtractResource

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

ExtractResource returns the ARN path label, when the operation has one.

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 Resource Explorer state; one coarse lock guards every table.

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 (*InMemoryBackend) AssociateDefaultView

func (b *InMemoryBackend) AssociateDefaultView(ctx context.Context, viewARN string) (string, error)

AssociateDefaultView makes a view the default for the caller's Region.

func (*InMemoryBackend) BatchGetView

func (b *InMemoryBackend) BatchGetView(ctx context.Context, arns []string) ([]ViewWire, []ViewError, error)

BatchGetView returns the requested views and an error entry for each that cannot be returned.

func (*InMemoryBackend) CreateIndex

func (b *InMemoryBackend) CreateIndex(ctx context.Context, token string, tags map[string]string) (*IndexChange, error)

CreateIndex creates the LOCAL index of the caller's account in the caller's Region.

func (*InMemoryBackend) CreateSetup

func (b *InMemoryBackend) CreateSetup(
	ctx context.Context,
	regions []string,
	viewName string,
	aggregators []string,
) (string, error)

CreateSetup creates an index and default view in each Region, optionally making one an aggregator.

func (*InMemoryBackend) CreateView

func (b *InMemoryBackend) CreateView(ctx context.Context, in *CreateViewInput) (*ViewWire, error)

CreateView creates a view in the caller's Region.

func (*InMemoryBackend) DeleteIndex

func (b *InMemoryBackend) DeleteIndex(ctx context.Context, indexARN string) (*IndexChange, error)

DeleteIndex deletes the index and every view in its Region.

func (*InMemoryBackend) DeleteSetup

func (b *InMemoryBackend) DeleteSetup(ctx context.Context, regions []string, all bool) (string, error)

DeleteSetup deletes the index of the listed Regions, or of every Region.

func (*InMemoryBackend) DeleteView

func (b *InMemoryBackend) DeleteView(ctx context.Context, viewARN string) (string, error)

DeleteView removes a view, clearing it as the default when it was.

func (*InMemoryBackend) DisassociateDefaultView

func (b *InMemoryBackend) DisassociateDefaultView(ctx context.Context)

DisassociateDefaultView clears the default view of the caller's Region.

func (*InMemoryBackend) GetAccountLevelServiceConfiguration

func (b *InMemoryBackend) GetAccountLevelServiceConfiguration(ctx context.Context) OrgConfiguration

GetAccountLevelServiceConfiguration reports organization-wide access for Resource Explorer.

func (*InMemoryBackend) GetDefaultView

func (b *InMemoryBackend) GetDefaultView(ctx context.Context) string

GetDefaultView returns the default view ARN of the caller's Region, or "".

func (*InMemoryBackend) GetIndex

func (b *InMemoryBackend) GetIndex(ctx context.Context) (*IndexDetail, error)

GetIndex returns the caller's index in the caller's Region.

func (*InMemoryBackend) GetManagedView

func (b *InMemoryBackend) GetManagedView(account, region, viewARN string) (*ManagedViewWire, error)

GetManagedView returns a managed view by ARN.

func (*InMemoryBackend) GetSetup

func (b *InMemoryBackend) GetSetup(
	ctx context.Context, taskID, token string, maxResults int,
) (page.Page[RegionStatusWire], error)

GetSetup reports the live status of a setup task per Region.

func (*InMemoryBackend) GetView

func (b *InMemoryBackend) GetView(ctx context.Context, viewARN string) (*ViewWire, map[string]string, error)

GetView returns a view and its tags.

func (*InMemoryBackend) ListIndexes

func (b *InMemoryBackend) ListIndexes(
	ctx context.Context, regions []string, typ, token string, maxResults int,
) (page.Page[IndexSummary], error)

ListIndexes lists the caller's indexes across every Region.

func (*InMemoryBackend) ListIndexesForMembers

func (b *InMemoryBackend) ListIndexesForMembers(
	accounts []string, token string, maxResults int,
) (page.Page[MemberIndex], error)

ListIndexesForMembers lists the indexes of the given accounts.

func (*InMemoryBackend) ListManagedViews

func (b *InMemoryBackend) ListManagedViews(
	region, principal, token string, maxResults int,
) (page.Page[string], error)

ListManagedViews lists managed view ARNs, optionally for one trusted service.

func (*InMemoryBackend) ListResources

func (b *InMemoryBackend) ListResources(
	ctx context.Context, filter *SearchFilter, viewARN, token string, maxResults int,
) (*SearchResult, error)

ListResources lists the resources a view exposes, narrowed by an optional filter.

func (*InMemoryBackend) ListSupportedResourceTypes

func (b *InMemoryBackend) ListSupportedResourceTypes(token string, maxResults int) (page.Page[SupportedType], error)

ListSupportedResourceTypes pages the catalog of searchable resource types.

func (*InMemoryBackend) ListTagsForResource

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

ListTagsForResource returns the tags of an index or view.

func (*InMemoryBackend) ListViews

func (b *InMemoryBackend) ListViews(ctx context.Context, token string, maxResults int) (page.Page[string], error)

ListViews lists the view ARNs of the caller's Region.

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) Search

func (b *InMemoryBackend) Search(
	ctx context.Context, query, viewARN, token string, maxResults int,
) (*SearchResult, error)

Search returns the resources matching query within the view, newest-index semantics aside, ordered by ARN.

func (*InMemoryBackend) SetLifecycleDelay

func (b *InMemoryBackend) SetLifecycleDelay(d time.Duration)

SetLifecycleDelay keeps indexes in CREATING, UPDATING and DELETING for d; zero settles immediately.

func (*InMemoryBackend) SetOrgAccess

func (b *InMemoryBackend) SetOrgAccess(o OrgAccess)

SetOrgAccess wires the Organizations service-access lookup.

func (*InMemoryBackend) SetResourceSource

func (b *InMemoryBackend) SetResourceSource(s ResourceSource)

SetResourceSource wires the enumeration of searchable resources.

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, resourceARN string, add map[string]string) error

TagResource adds tags to an index or view.

func (*InMemoryBackend) UntagResource

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

UntagResource removes tags by key.

func (*InMemoryBackend) UpdateIndexType

func (b *InMemoryBackend) UpdateIndexType(ctx context.Context, indexARN, typ string) (*IndexChange, error)

UpdateIndexType converts the index between LOCAL and AGGREGATOR.

func (*InMemoryBackend) UpdateView

func (b *InMemoryBackend) UpdateView(
	ctx context.Context, viewARN string, filters *SearchFilter, props []IncludedProperty, propsSet bool,
) (*ViewWire, error)

UpdateView changes the filter and included properties of a view; nil arguments are left alone.

type IncludedProperty

type IncludedProperty struct {
	Name string `json:"Name"`
}

IncludedProperty names a property returned by searches through a view.

type Index

type Index struct {
	CreatedAt     time.Time         `json:"createdAt"`
	LastUpdatedAt time.Time         `json:"lastUpdatedAt"`
	SettleAt      time.Time         `json:"settleAt"`
	Tags          map[string]string `json:"tags,omitempty"`
	ARN           string            `json:"arn"`
	Region        string            `json:"region"`
	AccountID     string            `json:"accountID"`
	Type          string            `json:"type"`
	State         string            `json:"state"`
	Transition    string            `json:"transition,omitempty"`
}

Index is the per-Region index of an account. State is the settled state; Transition is shown until SettleAt.

type IndexChange

type IndexChange struct {
	CreatedAt     *time.Time `json:"CreatedAt,omitempty"`
	LastUpdatedAt *time.Time `json:"LastUpdatedAt,omitempty"`
	Arn           string     `json:"Arn"`
	State         string     `json:"State"`
	Type          string     `json:"Type,omitempty"`
}

IndexChange is the output of CreateIndex, UpdateIndexType and DeleteIndex.

type IndexDetail

type IndexDetail struct {
	CreatedAt       time.Time         `json:"CreatedAt"`
	LastUpdatedAt   time.Time         `json:"LastUpdatedAt"`
	Tags            map[string]string `json:"Tags,omitempty"`
	Arn             string            `json:"Arn"`
	State           string            `json:"State"`
	Type            string            `json:"Type"`
	ReplicatingFrom []string          `json:"ReplicatingFrom,omitempty"`
	ReplicatingTo   []string          `json:"ReplicatingTo,omitempty"`
}

IndexDetail is the GetIndex output.

type IndexStatusWire

type IndexStatusWire struct {
	ErrorDetails *ErrorDetail  `json:"ErrorDetails,omitempty"`
	Index        *IndexSummary `json:"Index,omitempty"`
	Status       string        `json:"Status"`
}

IndexStatusWire is the IndexStatus shape.

type IndexSummary

type IndexSummary struct {
	Arn    string `json:"Arn"`
	Region string `json:"Region"`
	Type   string `json:"Type"`
}

IndexSummary is the Index shape returned by ListIndexes.

type ManagedViewWire

type ManagedViewWire struct {
	Filters            *SearchFilter      `json:"Filters,omitempty"`
	LastUpdatedAt      string             `json:"LastUpdatedAt"`
	ManagedViewArn     string             `json:"ManagedViewArn"`
	ManagedViewName    string             `json:"ManagedViewName"`
	Owner              string             `json:"Owner"`
	ResourcePolicy     string             `json:"ResourcePolicy"`
	Scope              string             `json:"Scope"`
	TrustedService     string             `json:"TrustedService"`
	Version            string             `json:"Version"`
	IncludedProperties []IncludedProperty `json:"IncludedProperties,omitempty"`
}

ManagedViewWire is the ManagedView shape.

type MemberIndex

type MemberIndex struct {
	AccountID string `json:"AccountId"`
	Arn       string `json:"Arn"`
	Region    string `json:"Region"`
	Type      string `json:"Type"`
}

MemberIndex is an index of a member account.

type OrgAccess

type OrgAccess interface {
	ServiceAccessEnabled(principal string) bool
}

OrgAccess reports whether a service principal has organization-wide access enabled.

type OrgConfiguration

type OrgConfiguration struct {
	AWSServiceAccessStatus string `json:"AWSServiceAccessStatus"`
	ServiceLinkedRole      string `json:"ServiceLinkedRole,omitempty"`
}

OrgConfiguration is the GetAccountLevelServiceConfiguration output.

type PropertyWire

type PropertyWire struct {
	LastReportedAt time.Time `json:"LastReportedAt"`
	Data           any       `json:"Data"`
	Name           string    `json:"Name"`
}

PropertyWire is a resource property.

type Provider

type Provider struct{}

Provider implements service.Provider for AWS Resource Explorer.

func (*Provider) Init

Init builds the backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type RegionStatusWire

type RegionStatusWire struct {
	Index  *IndexStatusWire `json:"Index,omitempty"`
	View   *ViewStatusWire  `json:"View,omitempty"`
	Region string           `json:"Region"`
}

RegionStatusWire is the RegionStatus shape.

type ResourceSource

type ResourceSource interface {
	Resources(ctx context.Context) []SourceResource
}

ResourceSource enumerates the resources visible in the Region carried by ctx.

type ResourceWire

type ResourceWire struct {
	LastReportedAt  time.Time      `json:"LastReportedAt"`
	Arn             string         `json:"Arn"`
	CfnResourceType string         `json:"CfnResourceType,omitempty"`
	OwningAccountID string         `json:"OwningAccountId"`
	Region          string         `json:"Region"`
	ResourceType    string         `json:"ResourceType"`
	Service         string         `json:"Service"`
	Properties      []PropertyWire `json:"Properties,omitempty"`
}

ResourceWire is a search hit.

type SearchFilter

type SearchFilter struct {
	FilterString string `json:"FilterString"`
}

SearchFilter is a view or ListResources filter.

type SearchResult

type SearchResult struct {
	ViewARN   string
	Next      string
	Resources []ResourceWire
	Total     int
	Complete  bool
}

SearchResult is the output of Search and ListResources.

type SetupTask

type SetupTask struct {
	ID        string       `json:"id"`
	AccountID string       `json:"accountID"`
	Kind      string       `json:"kind"`
	Regions   []TaskRegion `json:"regions"`
}

SetupTask is a CreateResourceExplorerSetup or DeleteResourceExplorerSetup run.

type SourceResource

type SourceResource struct {
	Tags map[string]string
	ARN  string
}

SourceResource is one resource the emulator can search.

type SupportedType

type SupportedType struct {
	Service      string   `json:"Service"`
	ResourceType string   `json:"ResourceType"`
	CFNTypes     []string `json:"CFNResourceTypes,omitempty"`
}

SupportedType is one entry of ListSupportedResourceTypes.

type TaskRegion

type TaskRegion struct {
	IndexErr    *ErrorDetail `json:"indexErr,omitempty"`
	ViewErr     *ErrorDetail `json:"viewErr,omitempty"`
	Region      string       `json:"region"`
	IndexARN    string       `json:"indexArn,omitempty"`
	ViewARN     string       `json:"viewArn,omitempty"`
	IndexStatus string       `json:"indexStatus"`
	ViewStatus  string       `json:"viewStatus"`
}

TaskRegion is the outcome of a setup task in one Region.

type View

type View struct {
	LastUpdatedAt      time.Time         `json:"lastUpdatedAt"`
	Tags               map[string]string `json:"tags,omitempty"`
	ARN                string            `json:"arn"`
	Name               string            `json:"name"`
	Region             string            `json:"region"`
	AccountID          string            `json:"accountID"`
	Scope              string            `json:"scope"`
	FilterString       string            `json:"filterString"`
	IncludedProperties []string          `json:"includedProperties,omitempty"`
}

View is a saved search scope in one Region.

type ViewError

type ViewError struct {
	ErrorMessage string `json:"ErrorMessage"`
	ViewArn      string `json:"ViewArn"`
}

ViewError is a BatchGetView failure.

type ViewStatusWire

type ViewStatusWire struct {
	ErrorDetails *ErrorDetail `json:"ErrorDetails,omitempty"`
	View         *ViewWire    `json:"View,omitempty"`
	Status       string       `json:"Status"`
}

ViewStatusWire is the ViewStatus shape.

type ViewWire

type ViewWire struct {
	LastUpdatedAt      time.Time          `json:"LastUpdatedAt"`
	Filters            *SearchFilter      `json:"Filters,omitempty"`
	Owner              string             `json:"Owner"`
	Scope              string             `json:"Scope"`
	ViewArn            string             `json:"ViewArn"`
	ViewName           string             `json:"ViewName"`
	IncludedProperties []IncludedProperty `json:"IncludedProperties,omitempty"`
}

ViewWire is the View shape.

Jump to

Keyboard shortcuts

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