Documentation
¶
Overview ¶
Package resourceexplorer2 emulates the AWS Resource Explorer control and search plane.
Index ¶
- func SupportedServices() []string
- type AccountState
- type CreateViewInput
- type DefaultView
- type ErrorDetail
- type Handler
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Snapshot(ctx context.Context) []byte
- type InMemoryBackend
- func (b *InMemoryBackend) AccountID() string
- func (b *InMemoryBackend) AssociateDefaultView(ctx context.Context, viewARN string) (string, error)
- func (b *InMemoryBackend) BatchGetView(ctx context.Context, arns []string) ([]ViewWire, []ViewError, error)
- func (b *InMemoryBackend) CreateIndex(ctx context.Context, token string, tags map[string]string) (*IndexChange, error)
- func (b *InMemoryBackend) CreateSetup(ctx context.Context, regions []string, viewName string, aggregators []string) (string, error)
- func (b *InMemoryBackend) CreateView(ctx context.Context, in *CreateViewInput) (*ViewWire, error)
- func (b *InMemoryBackend) DeleteIndex(ctx context.Context, indexARN string) (*IndexChange, error)
- func (b *InMemoryBackend) DeleteSetup(ctx context.Context, regions []string, all bool) (string, error)
- func (b *InMemoryBackend) DeleteView(ctx context.Context, viewARN string) (string, error)
- func (b *InMemoryBackend) DisassociateDefaultView(ctx context.Context)
- func (b *InMemoryBackend) GetAccountLevelServiceConfiguration(ctx context.Context) OrgConfiguration
- func (b *InMemoryBackend) GetDefaultView(ctx context.Context) string
- func (b *InMemoryBackend) GetIndex(ctx context.Context) (*IndexDetail, error)
- func (b *InMemoryBackend) GetManagedView(account, region, viewARN string) (*ManagedViewWire, error)
- func (b *InMemoryBackend) GetSetup(ctx context.Context, taskID, token string, maxResults int) (page.Page[RegionStatusWire], error)
- func (b *InMemoryBackend) GetView(ctx context.Context, viewARN string) (*ViewWire, map[string]string, error)
- func (b *InMemoryBackend) ListIndexes(ctx context.Context, regions []string, typ, token string, maxResults int) (page.Page[IndexSummary], error)
- func (b *InMemoryBackend) ListIndexesForMembers(accounts []string, token string, maxResults int) (page.Page[MemberIndex], error)
- func (b *InMemoryBackend) ListManagedViews(region, principal, token string, maxResults int) (page.Page[string], error)
- func (b *InMemoryBackend) ListResources(ctx context.Context, filter *SearchFilter, viewARN, token string, ...) (*SearchResult, error)
- func (b *InMemoryBackend) ListSupportedResourceTypes(token string, maxResults int) (page.Page[SupportedType], error)
- func (b *InMemoryBackend) ListTagsForResource(ctx context.Context, resourceARN string) (map[string]string, error)
- func (b *InMemoryBackend) ListViews(ctx context.Context, token string, maxResults int) (page.Page[string], error)
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) Search(ctx context.Context, query, viewARN, token string, maxResults int) (*SearchResult, error)
- func (b *InMemoryBackend) SetLifecycleDelay(d time.Duration)
- func (b *InMemoryBackend) SetOrgAccess(o OrgAccess)
- func (b *InMemoryBackend) SetResourceSource(s ResourceSource)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) TagResource(ctx context.Context, resourceARN string, add map[string]string) error
- func (b *InMemoryBackend) UntagResource(ctx context.Context, resourceARN string, keys []string) error
- func (b *InMemoryBackend) UpdateIndexType(ctx context.Context, indexARN, typ string) (*IndexChange, error)
- func (b *InMemoryBackend) UpdateView(ctx context.Context, viewARN string, filters *SearchFilter, ...) (*ViewWire, error)
- type IncludedProperty
- type Index
- type IndexChange
- type IndexDetail
- type IndexStatusWire
- type IndexSummary
- type ManagedViewWire
- type MemberIndex
- type OrgAccess
- type OrgConfiguration
- type PropertyWire
- type Provider
- type RegionStatusWire
- type ResourceSource
- type ResourceWire
- type SearchFilter
- type SearchResult
- type SetupTask
- type SourceResource
- type SupportedType
- type TaskRegion
- type View
- type ViewError
- type ViewStatusWire
- type ViewWire
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 ¶
DefaultView records the default view of an account in a Region; Key is "account|region".
type ErrorDetail ¶
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 (*Handler) ChaosOperations ¶
ChaosOperations lists the fault-injectable operations.
func (*Handler) ChaosRegions ¶
ChaosRegions lists the regions this handler serves.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase service name for fault rules.
func (*Handler) ExtractOperation ¶
ExtractOperation returns the operation name.
func (*Handler) ExtractResource ¶
ExtractResource returns the ARN path label, when the operation has one.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations lists every implemented operation.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the echo handler.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) RouteMatcher ¶
RouteMatcher matches by SigV4 signing name (or SDK user agent) plus a known path shape.
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 ¶
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 ¶
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) 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 ¶
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 ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init builds the backend and handler.
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 ¶
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 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.