resiliencehub

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package resiliencehub emulates the AWS Resilience Hub control-plane API (aws-sdk-go-v2/service/resiliencehub, protocol restjson1).

See PARITY.md for the full pre-implementation audit this package was built from, including the honest-gap list for AssessmentSummary, ResiliencyScore, and the four recommendation families (SOP/alarm/test/component) plus the resource-grouping-recommendation feature -- all proprietary scoring/ML/curated-knowledge-base outputs this emulator cannot derive from the SDK and therefore never fabricates.

Index

Constants

View Source
const (
	AssessmentScheduleDisabled = "Disabled"
	AssessmentScheduleDaily    = "Daily"
)

AppAssessmentScheduleType wire values (types.AppAssessmentScheduleType).

View Source
const (
	AppComplianceStatusPolicyBreached  = "PolicyBreached"
	AppComplianceStatusPolicyMet       = "PolicyMet"
	AppComplianceStatusNotAssessed     = "NotAssessed"
	AppComplianceStatusChangesDetected = "ChangesDetected"
	AppComplianceStatusNotApplicable   = "NotApplicable"
	AppComplianceStatusMissingPolicy   = "MissingPolicy"
)

AppComplianceStatusType wire values (types.AppComplianceStatusType).

View Source
const (
	DriftStatusNotChecked  = "NotChecked"
	DriftStatusNotDetected = "NotDetected"
	DriftStatusDetected    = "Detected"
)

AppDriftStatusType / DriftStatus wire values -- both enums share the identical three string values (types.AppDriftStatusType, types.DriftStatus).

View Source
const (
	AppStatusActive   = "Active"
	AppStatusDeleting = "Deleting"
)

AppStatusType wire values (types.AppStatusType).

View Source
const (
	AssessmentStatusPending    = "Pending"
	AssessmentStatusInProgress = "InProgress"
	AssessmentStatusFailed     = "Failed"
	AssessmentStatusSuccess    = "Success"
)

AssessmentStatus wire values (types.AssessmentStatus) -- one of five identically-shaped Pending/InProgress/Failed/Success async status enums in this service (see also ResourceResolutionStatusType, ResourceImportStatusType, MetricsExportStatusType, ResourcesGroupingRecGenStatusType). PARITY.md's "Notes for the implementer" section is the source for treating all five as one generic timer-driven transition shape.

View Source
const (
	InvokerUser   = "User"
	InvokerSystem = "System"
)

AssessmentInvoker wire values (types.AssessmentInvoker).

View Source
const (
	ComplianceStatusPolicyBreached = "PolicyBreached"
	ComplianceStatusPolicyMet      = "PolicyMet"
	ComplianceStatusNotApplicable  = "NotApplicable"
	ComplianceStatusMissingPolicy  = "MissingPolicy"
)

ComplianceStatus wire values (types.ComplianceStatus) -- used by AppAssessment.ComplianceStatus and DisruptionCompliance.ComplianceStatus. This is a DISTINCT (four-value) enum from AppComplianceStatusType's six values above -- confirmed from types/enums.go, not assumed.

View Source
const (
	DisruptionTypeSoftware = "Software"
	DisruptionTypeHardware = "Hardware"
	DisruptionTypeAZ       = "AZ"
	DisruptionTypeRegion   = "Region"
)

DisruptionType wire values (types.DisruptionType) -- the four keys a ResiliencyPolicy.Policy map and an AppAssessment.Compliance map are keyed by.

View Source
const (
	TierMissionCritical = "MissionCritical"
	TierCritical        = "Critical"
	TierImportant       = "Important"
	TierCoreServices    = "CoreServices"
	TierNonCritical     = "NonCritical"
	TierNotApplicable   = "NotApplicable"
)

ResiliencyPolicyTier wire values (types.ResiliencyPolicyTier).

View Source
const (
	MappingTypeCfnStack       = "CfnStack"
	MappingTypeResource       = "Resource"
	MappingTypeAppRegistryApp = "AppRegistryApp"
	MappingTypeResourceGroup  = "ResourceGroup"
	MappingTypeTerraform      = "Terraform"
	MappingTypeEKS            = "EKS"
)

ResourceMappingType wire values (types.ResourceMappingType).

View Source
const (
	PhysicalIDTypeArn    = "Arn"
	PhysicalIDTypeNative = "Native"
)

PhysicalIdentifierType wire values (types.PhysicalIdentifierType).

View Source
const (
	ResourceSourceAppTemplate = "AppTemplate"
	ResourceSourceDiscovered  = "Discovered"
)

ResourceSourceType wire values (types.ResourceSourceType).

View Source
const (
	TemplateFormatCfnYaml = "CfnYaml"
	TemplateFormatCfnJSON = "CfnJson"
)

TemplateFormat wire values (types.TemplateFormat).

View Source
const (
	AsyncStatusPending    = "Pending"
	AsyncStatusInProgress = "InProgress"
	AsyncStatusFailed     = "Failed"
	AsyncStatusSuccess    = "Success"
)

RecommendationTemplateStatus / ResourceResolutionStatusType / ResourceImportStatusType / MetricsExportStatusType / ResourcesGroupingRecGenStatusType wire values -- all five (plus AssessmentStatus above) share the identical Pending/InProgress/Failed/ Success shape (confirmed identical string values across types/enums.go -- see PARITY.md).

View Source
const (
	RenderTypeAlarm = "Alarm"
	RenderTypeSop   = "Sop"
	RenderTypeTest  = "Test"
)

RenderRecommendationType wire values (types.RenderRecommendationType).

View Source
const (
	GroupingStatusAccepted        = "Accepted"
	GroupingStatusRejected        = "Rejected"
	GroupingStatusPendingDecision = "PendingDecision"
)

GroupingRecommendationStatusType wire values (types.GroupingRecommendationStatusType).

View Source
const (
	RecommendationStatusImplemented    = "Implemented"
	RecommendationStatusInactive       = "Inactive"
	RecommendationStatusNotImplemented = "NotImplemented"
	RecommendationStatusExcluded       = "Excluded"
)

RecommendationStatus wire values (types.RecommendationStatus).

View Source
const (
	DataLocationAnyLocation   = "AnyLocation"
	DataLocationSameContinent = "SameContinent"
	DataLocationSameCountry   = "SameCountry"
)

DataLocationConstraint wire values (types.DataLocationConstraint).

View Source
const (
	CostTierL1 = "L1"
	CostTierL2 = "L2"
	CostTierL3 = "L3"
	CostTierL4 = "L4"
)

EstimatedCostTier wire values (types.EstimatedCostTier).

View Source
const (
	PermissionModelLegacyIAMUser = "LegacyIAMUser"
	PermissionModelRoleBased     = "RoleBased"
)

PermissionModelType wire values (types.PermissionModelType).

Variables

View Source
var ErrNilAppContext = errors.New("AppContext is required")

ErrNilAppContext is returned by Provider.Init when appCtx is nil.

Functions

This section is empty.

Types

type App

type App struct {
	ID                                string
	ARN                               string
	Name                              string
	Description                       string
	CreationTime                      time.Time
	AssessmentSchedule                string
	AwsApplicationArn                 string
	ComplianceStatus                  string
	DriftStatus                       string
	EventSubscriptions                []EventSubscription
	LastAppComplianceEvaluationTime   time.Time
	LastDriftEvaluationTime           time.Time
	LastResiliencyScoreEvaluationTime time.Time
	PermissionModel                   *PermissionModel
	PolicyArn                         string
	Status                            string
	Tags                              *tags.Tags

	// Import is DescribeDraftAppVersionResourcesImportStatus's state --
	// draft-only, per PARITY.md.
	Import *ImportState

	// Draft is the mutable working version every App is created with.
	// Published holds every snapshot PublishAppVersion has produced, ordered
	// oldest-first (Number "1", "2", ...).
	Draft             *AppVersion
	Published         []*AppVersion
	NextVersionNumber int64
}

App is the internal state of one Resilience Hub application, a superset of types.App plus the draft/published AppVersion bookkeeping the wire type itself carries no fields for.

type AppAssessment

type AppAssessment struct {
	StartTime             time.Time
	EndTime               time.Time
	Compliance            map[string]DisruptionCompliance
	Policy                *ResiliencyPolicy
	ResiliencyScore       *ResiliencyScore
	ResourceErrorsDetails *ResourceErrorsDetails
	Tags                  *tags.Tags
	ARN                   string
	AppArn                string
	AppID                 string
	AppVersion            string
	AssessmentName        string
	Status                string
	Invoker               string
	ComplianceStatus      string
	DriftStatus           string
	Message               string
	VersionName           string
	ClientToken           string
}

AppAssessment is the internal state of one assessment run.

type AppComponent

type AppComponent struct {
	AdditionalInfo map[string][]string
	ID             string
	Name           string
	Type           string
}

AppComponent mirrors types.AppComponent.

type AppInputSource

type AppInputSource struct {
	EksSourceClusterNamespace *EksSourceClusterNamespace
	TerraformSource           *TerraformSource
	ImportType                string
	SourceArn                 string
	SourceName                string
	ResourceCount             int32
}

AppInputSource mirrors types.AppInputSource.

type AppVersion

type AppVersion struct {
	CreationTime     time.Time
	AdditionalInfo   map[string][]string
	Resolution       *ResolutionState
	Number           string
	VersionName      string
	TemplateBody     string
	AppComponents    []*AppComponent
	Resources        []*PhysicalResource
	ResourceMappings []ResourceMapping
	InputSources     []AppInputSource
}

AppVersion is the internal state of one version (draft, or a published numbered snapshot) of an App's template/resources/components. Number is either the draftVersion sentinel or a decimal string ("1", "2", ...).

type DisruptionCompliance

type DisruptionCompliance struct {
	ComplianceStatus    string
	Message             string
	RpoDescription      string
	RpoReferenceID      string
	RtoDescription      string
	RtoReferenceID      string
	AchievableRpoInSecs int32
	AchievableRtoInSecs int32
	CurrentRpoInSecs    int32
	CurrentRtoInSecs    int32
}

DisruptionCompliance mirrors types.DisruptionCompliance.

type EksSource

type EksSource struct {
	EksClusterArn string
	Namespaces    []string
}

EksSource mirrors types.EksSource.

type EksSourceClusterNamespace

type EksSourceClusterNamespace struct {
	EksClusterArn string
	Namespace     string
}

EksSourceClusterNamespace mirrors types.EksSourceClusterNamespace.

type EventSubscription

type EventSubscription struct {
	EventType   string
	Name        string
	SnsTopicArn string
}

EventSubscription mirrors types.EventSubscription.

type FailurePolicy

type FailurePolicy struct {
	RpoInSecs int32
	RtoInSecs int32
}

FailurePolicy mirrors types.FailurePolicy -- plain int32 (not pointers), always present on the wire.

type GroupingTask

type GroupingTask struct {
	GroupingID   string
	AppArn       string
	Status       string
	ErrorMessage string
}

GroupingTask is the internal state of one StartResourceGroupingRecommendationTask call. This backend always completes a grouping task with zero generated recommendations -- see PARITY.md's "Resource-grouping recommendations" gap: the real feature is an ML clustering heuristic with no public derivation rule, so returning none (rather than inventing plausible clusters) is the honest behavior.

type Handler

type Handler struct {
	Backend   *InMemoryBackend
	AccountID string
	Region    string
}

Handler is the HTTP handler for the AWS Resilience Hub API.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates a new Resilience Hub handler.

func (*Handler) ChaosOperations

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

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

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

ChaosRegions returns all regions this handler handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

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

ExtractOperation extracts the operation name from the request.

func (*Handler) ExtractResource

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

ExtractResource extracts the primary resource identifier from the request -- the ARN in the /tags/{resourceArn} path, or empty for every other (body-addressed) operation.

func (*Handler) GetSupportedOperations

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

GetSupportedOperations returns every operation this handler routes -- all 63 operations on the aws-sdk-go-v2/service/resiliencehub client, per sdk_completeness_test.go's empty exception list.

func (*Handler) Handler

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

Handler returns the Echo handler function for Resilience Hub requests.

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 stored state in the backend.

func (*Handler) Restore

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

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

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

RouteMatcher returns a matcher that reports true iff the request's method plus first path segment (e.g. "create-app" for POST /create-app, or "tags" for the /tags/{resourceArn} trio) is a key in routes(). Every operation but the tags trio is a fixed, literal, kebab-case action path with NO path parameters at all (confirmed by reading every op's own httpbinding.SplitURI(...) literal in the SDK's serializers.go -- see PARITY.md's routing section).

func (*Handler) Snapshot

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

Snapshot implements persistence.Persistable by delegating to the backend.

type ImportState

type ImportState struct {
	StatusChangeTime time.Time
	Status           string
	ErrorMessage     string
	ErrorDetails     []string
}

ImportState is the internal bookkeeping for one App's most recent ImportResourcesToDraftAppVersion call (draft-only, per PARITY.md).

type InMemoryBackend

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

InMemoryBackend is the in-memory store for AWS Resilience Hub.

A single coarse lock guards every collection below: operations routinely cross resource boundaries (StartAppAssessment reads an App+its bound ResiliencyPolicy and writes an AppAssessment; PublishAppVersion reads and deep-copies a draft AppVersion embedded on App; TagResource resolves an ARN into whichever of App/ResiliencyPolicy/AppAssessment it names), so the invariant boundary is the whole backend -- see .claude/memories/pkgs-catalog.md's locking rule.

func NewInMemoryBackend

func NewInMemoryBackend(ctx context.Context, accountID, region string) *InMemoryBackend

NewInMemoryBackend creates a new in-memory AWS Resilience Hub backend.

func (*InMemoryBackend) AcceptResourceGroupingRecommendations

func (b *InMemoryBackend) AcceptResourceGroupingRecommendations(
	appArn string, ids []string,
) ([]failedGroupingRecommendationEntryWire, error)

AcceptResourceGroupingRecommendations accepts recommendations by ID. Since no grouping recommendation is ever generated, every submitted ID necessarily fails to resolve -- a real, honest outcome, not a fabricated success.

func (*InMemoryBackend) AccountID

func (b *InMemoryBackend) AccountID() string

AccountID returns the account ID for this backend.

func (*InMemoryBackend) AddDraftAppVersionResourceMappings

func (b *InMemoryBackend) AddDraftAppVersionResourceMappings(
	appArn string, mappings []resourceMappingWire,
) (*App, []ResourceMapping, error)

AddDraftAppVersionResourceMappings appends resourceMappings to the App's draft version.

func (*InMemoryBackend) AppARN

func (b *InMemoryBackend) AppARN(id string) string

AppARN builds the ARN for an App ID. Confirmed shape (read verbatim from the SDK's own doc comments, repeated on every AppArn field across types/types.go): "arn:{partition}:resiliencehub:{region}:{account}:app/{app-id}".

func (*InMemoryBackend) AssessmentARN

func (b *InMemoryBackend) AssessmentARN(id string) string

AssessmentARN builds the ARN for an AppAssessment ID. DEVIATION FROM THE LITERAL SDK DOC COMMENT, DOCUMENTED: every AssessmentArn doc comment in this SDK module literally reads "arn:{partition}:resiliencehub:{region}:{account}:app-assessment/{app-id}" (PARITY.md read this verbatim and flagged it), which would make every assessment of the same App share one ARN -- that cannot be correct, since DescribeAppAssessment/DeleteAppAssessment must address one SPECIFIC assessment among potentially many for the same App (ListAppAssessments returns multiple). This is almost certainly a copy-paste doc-generation artifact in the upstream SDK (the same boilerplate sentence appears on App/AppAssessment/RecommendationTemplate ARN fields alike). This backend therefore mints a fresh, unique ID per assessment under the "app-assessment/" resource-type prefix instead of reusing the app-id verbatim -- see PARITY.md's judgment-call note.

func (*InMemoryBackend) BatchUpdateRecommendationStatus

func (b *InMemoryBackend) BatchUpdateRecommendationStatus(
	appArn string, entries []updateRecommendationStatusRequestEntryWire,
) (*App, []batchUpdateRecommendationStatusFailedEntryWire, error)

BatchUpdateRecommendationStatus includes/excludes operational recommendations by ReferenceId. Since this backend never generates real recommendations (see the four List* ops above), every entry submitted necessarily fails to resolve -- an honest, real outcome (every entry lands in FailedEntries with a real "not found" reason), not a fabricated success.

func (*InMemoryBackend) Close

func (b *InMemoryBackend) Close()

Close stops all scheduled state-transition timers so none outlives the backend. Safe to call multiple times.

func (*InMemoryBackend) CreateApp

func (b *InMemoryBackend) CreateApp(req *createAppRequest) (*App, error)

CreateApp creates a new Resilience Hub application, along with its implicit initial draft AppVersion (types.AppVersion is a bare *string with no enum trait -- "draft" is asserted from documented product behavior, not SDK-verified; see consts.go's draftVersion doc comment).

func (*InMemoryBackend) CreateAppVersionAppComponent

func (b *InMemoryBackend) CreateAppVersionAppComponent(
	appArn string, req *createAppVersionAppComponentRequest,
) (*App, *AppComponent, error)

CreateAppVersionAppComponent adds a new AppComponent to the App's draft version.

func (*InMemoryBackend) CreateAppVersionResource

func (b *InMemoryBackend) CreateAppVersionResource(
	appArn string, req *createAppVersionResourceRequest,
) (*App, *PhysicalResource, error)

CreateAppVersionResource adds a new manually-added resource to the App's draft version, auto-creating any AppComponent named in req.AppComponents that does not already exist.

func (*InMemoryBackend) CreateRecommendationTemplate

func (b *InMemoryBackend) CreateRecommendationTemplate(
	req *createRecommendationTemplateRequest,
) (*RecommendationTemplate, error)

CreateRecommendationTemplate creates a new recommendation template. Mechanically real (the template record itself is genuine, retrievable, deletable state) but its content is honestly trivial: since this backend never generates real SOP/alarm/test/component recommendations (see recommendations.go), RecommendationIDs/RecommendationTypes are always empty and TemplatesLocation is a synthetic, documented placeholder -- no actual S3 object is written (see PARITY.md's "Recommendation families" gap; s3 write-through is flagged there as a valid future enhancement, out of scope for this pass). This op is mechanically trivial (no real analysis to package), so it completes synchronously rather than through the Pending/InProgress timer the other four async families use.

func (*InMemoryBackend) CreateResiliencyPolicy

func (b *InMemoryBackend) CreateResiliencyPolicy(req *createResiliencyPolicyRequest) (*ResiliencyPolicy, error)

CreateResiliencyPolicy creates a new resiliency policy.

func (*InMemoryBackend) DeleteApp

func (b *InMemoryBackend) DeleteApp(appArn string, forceDelete bool) error

DeleteApp deletes the App identified by appArn. Rejected (ConflictException) unless forceDelete is set when the app still has an in-flight (Pending/ InProgress) assessment -- a real FK-integrity check, not a stub.

func (*InMemoryBackend) DeleteAppAssessment

func (b *InMemoryBackend) DeleteAppAssessment(assessmentArn string) (string, error)

DeleteAppAssessment deletes the assessment identified by assessmentArn. Rejected (ConflictException) while it is still Pending/InProgress.

func (*InMemoryBackend) DeleteAppInputSource

func (b *InMemoryBackend) DeleteAppInputSource(appArn, sourceArn string) (*App, *AppInputSource, error)

DeleteAppInputSource removes an input source (and any resources it solely produced -- this backend does not track per-resource provenance to that granularity, so only the AppInputSource bookkeeping entry is removed, a documented simplification) from the App's draft version.

func (*InMemoryBackend) DeleteAppVersionAppComponent

func (b *InMemoryBackend) DeleteAppVersionAppComponent(appArn, id string) (*App, *AppComponent, error)

DeleteAppVersionAppComponent deletes the component with the given id from the draft version. Rejected (ConflictException) if any resource is still assigned to it -- per the SDK's own doc comment ("You will not be able to delete an Application Component if it has resources associated with it").

func (*InMemoryBackend) DeleteAppVersionResource

func (b *InMemoryBackend) DeleteAppVersionResource(
	appArn string,
	loc findResourceLocator,
) (*App, *PhysicalResource, error)

DeleteAppVersionResource deletes the resource identified by loc from the draft version. Only manually-added (AppTemplate-sourced) resources may be deleted -- per DeleteAppVersionResource's own doc comment ("You can only delete a manually added resource").

func (*InMemoryBackend) DeleteRecommendationTemplate

func (b *InMemoryBackend) DeleteRecommendationTemplate(templateArn string) (string, error)

DeleteRecommendationTemplate deletes the template identified by templateArn. Unlike every other Create*/Delete*/Update* op in this service, this one does NOT accept ConflictException (confirmed by re-reading its own deserializeOpErrorDeleteRecommendationTemplate switch in the SDK -- see PARITY.md), so this deletion is never rejected for a conflicting state.

func (*InMemoryBackend) DeleteResiliencyPolicy

func (b *InMemoryBackend) DeleteResiliencyPolicy(policyArn string) error

DeleteResiliencyPolicy deletes the policy identified by policyArn. Rejected (ConflictException) while any App is still bound to it -- a real FK-integrity check, not a stub.

func (*InMemoryBackend) DescribeAppAssessment

func (b *InMemoryBackend) DescribeAppAssessment(assessmentArn string) (*AppAssessment, error)

DescribeAppAssessment returns a copy of the assessment identified by assessmentArn.

func (*InMemoryBackend) DescribeAppVersion

func (b *InMemoryBackend) DescribeAppVersion(appArn, appVersion string) (*App, *AppVersion, error)

DescribeAppVersion returns AdditionalInfo for (appArn, appVersion).

func (*InMemoryBackend) DescribeAppVersionAppComponent

func (b *InMemoryBackend) DescribeAppVersionAppComponent(appArn, appVersion, id string) (*App, *AppComponent, error)

DescribeAppVersionAppComponent returns the component named id in (appArn, appVersion) -- reads may target any version, draft or published.

func (*InMemoryBackend) DescribeAppVersionResource

func (b *InMemoryBackend) DescribeAppVersionResource(
	appArn, appVersion string, loc findResourceLocator,
) (*App, *PhysicalResource, error)

DescribeAppVersionResource returns the resource identified by loc in (appArn, appVersion) -- reads may target any version.

func (*InMemoryBackend) DescribeAppVersionResourcesResolutionStatus

func (b *InMemoryBackend) DescribeAppVersionResourcesResolutionStatus(
	appArn, appVersion, resolutionID string,
) (string, string, string, error)

DescribeAppVersionResourcesResolutionStatus returns the current resolution state for (appArn, appVersion).

func (*InMemoryBackend) DescribeAppVersionTemplate

func (b *InMemoryBackend) DescribeAppVersionTemplate(appArn, appVersion string) (string, error)

DescribeAppVersionTemplate returns the template body for (appArn, appVersion).

func (*InMemoryBackend) DescribeDraftAppVersionResourcesImportStatus

func (b *InMemoryBackend) DescribeDraftAppVersionResourcesImportStatus(appArn string) (*App, *ImportState, error)

DescribeDraftAppVersionResourcesImportStatus returns the App's current import status.

func (*InMemoryBackend) DescribeMetricsExport

func (b *InMemoryBackend) DescribeMetricsExport(metricsExportID string) (*MetricsExport, error)

DescribeMetricsExport returns the export identified by metricsExportID.

func (*InMemoryBackend) DescribeResiliencyPolicy

func (b *InMemoryBackend) DescribeResiliencyPolicy(policyArn string) (*ResiliencyPolicy, error)

DescribeResiliencyPolicy returns a copy of the policy identified by policyArn.

func (*InMemoryBackend) DescribeResourceGroupingRecommendationTask

func (b *InMemoryBackend) DescribeResourceGroupingRecommendationTask(appArn, groupingID string) (*GroupingTask, error)

DescribeResourceGroupingRecommendationTask returns the task identified by (appArn, groupingID).

func (*InMemoryBackend) GetApp

func (b *InMemoryBackend) GetApp(appArn string) (*App, error)

GetApp returns a copy of the App identified by appArn.

func (*InMemoryBackend) ImportResourcesToDraftAppVersion

func (b *InMemoryBackend) ImportResourcesToDraftAppVersion(
	appArn string, req *importResourcesToDraftAppVersionRequest,
) (*App, string, error)

ImportResourcesToDraftAppVersion kicks off an async import of resources from the given sources into the App's draft version.

func (*InMemoryBackend) ListAlarmRecommendations

func (b *InMemoryBackend) ListAlarmRecommendations(assessmentArn string) error

ListAlarmRecommendations always returns an empty list.

func (*InMemoryBackend) ListAppAssessmentComplianceDrifts

func (b *InMemoryBackend) ListAppAssessmentComplianceDrifts(assessmentArn string) error

ListAppAssessmentComplianceDrifts always returns an empty list: drift detection requires comparing a resource's compliance evaluation across two points in time using the same proprietary scoring model ResiliencyScore depends on -- see PARITY.md. An honestly-empty list is correct here, not a stub, since no drift is ever fabricated.

func (*InMemoryBackend) ListAppAssessmentResourceDrifts

func (b *InMemoryBackend) ListAppAssessmentResourceDrifts(assessmentArn string) error

ListAppAssessmentResourceDrifts always returns an empty list -- same honest-gap rationale as ListAppAssessmentComplianceDrifts.

func (*InMemoryBackend) ListAppAssessments

func (b *InMemoryBackend) ListAppAssessments(
	f listAssessmentsFilter,
	token string,
	limit int,
) page.Page[*AppAssessment]

ListAppAssessments returns a page of assessment summaries matching f.

func (*InMemoryBackend) ListAppComponentCompliances

func (b *InMemoryBackend) ListAppComponentCompliances(assessmentArn string) (*AppAssessment, []*AppComponent, error)

ListAppComponentCompliances returns one compliance entry per AppComponent on the assessed AppVersion, using the same documented coarse rule as buildComplianceMap.

func (*InMemoryBackend) ListAppComponentRecommendations

func (b *InMemoryBackend) ListAppComponentRecommendations(assessmentArn string) error

ListAppComponentRecommendations always returns an empty list.

func (*InMemoryBackend) ListAppInputSources

func (b *InMemoryBackend) ListAppInputSources(
	appArn, appVersion, token string,
	limit int,
) (page.Page[AppInputSource], error)

ListAppInputSources returns every input source on (appArn, appVersion).

func (*InMemoryBackend) ListAppVersionAppComponents

func (b *InMemoryBackend) ListAppVersionAppComponents(
	appArn, appVersion, token string, limit int,
) (*App, page.Page[*AppComponent], error)

ListAppVersionAppComponents returns every AppComponent on (appArn, appVersion).

func (*InMemoryBackend) ListAppVersionResourceMappings

func (b *InMemoryBackend) ListAppVersionResourceMappings(
	appArn, appVersion, token string, limit int,
) (page.Page[ResourceMapping], error)

ListAppVersionResourceMappings returns every ResourceMapping on (appArn, appVersion).

func (*InMemoryBackend) ListAppVersionResources

func (b *InMemoryBackend) ListAppVersionResources(
	appArn, appVersion, token string, limit int,
) (*App, *AppVersion, page.Page[*PhysicalResource], error)

ListAppVersionResources returns every PhysicalResource on (appArn, appVersion). resolutionId is accepted but not further filtered against -- this backend keeps only the latest resolution snapshot per version rather than a history of past resolutionIds, a documented simplification.

func (*InMemoryBackend) ListAppVersions

func (b *InMemoryBackend) ListAppVersions(
	appArn string, startTime, endTime time.Time, token string, limit int,
) (page.Page[appVersionSummaryWire], error)

ListAppVersions returns every version (draft plus each published snapshot) of the App identified by appArn, optionally filtered by [startTime, endTime] on CreationTime.

func (*InMemoryBackend) ListApps

func (b *InMemoryBackend) ListApps(f listAppsFilter, token string, limit int) page.Page[*App]

ListApps returns a page of Apps matching f.

func (*InMemoryBackend) ListMetrics

func (b *InMemoryBackend) ListMetrics()

ListMetrics always returns an empty result set. The real operation queries a historical metrics store (resiliency-score/compliance trends over time, filterable/sortable/aggregatable per Condition/Field/Sort) that this backend does not maintain -- ResiliencyScore itself is a documented placeholder (see PARITY.md), so there is no real time-series data to report metrics over without fabricating one. An honestly-empty result is correct here, not a stub.

func (*InMemoryBackend) ListRecommendationTemplates

func (b *InMemoryBackend) ListRecommendationTemplates(
	f listTemplatesFilter,
	token string,
	limit int,
) page.Page[*RecommendationTemplate]

ListRecommendationTemplates returns a page of templates matching f.

func (*InMemoryBackend) ListResiliencyPolicies

func (b *InMemoryBackend) ListResiliencyPolicies(policyName, token string, limit int) page.Page[*ResiliencyPolicy]

ListResiliencyPolicies returns a page of policies, optionally filtered by name.

func (*InMemoryBackend) ListResourceGroupingRecommendations

func (b *InMemoryBackend) ListResourceGroupingRecommendations(appArn string) error

ListResourceGroupingRecommendations always returns an empty list -- this backend's grouping tasks never generate real recommendations.

func (*InMemoryBackend) ListSopRecommendations

func (b *InMemoryBackend) ListSopRecommendations(assessmentArn string) error

ListSopRecommendations always returns an empty list.

func (*InMemoryBackend) ListSuggestedResiliencyPolicies

func (b *InMemoryBackend) ListSuggestedResiliencyPolicies(token string, limit int) page.Page[*ResiliencyPolicy]

ListSuggestedResiliencyPolicies returns the static suggested-policy reference table as a page.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(resourceArn string) (map[string]string, error)

ListTagsForResource returns the tags for the App, ResiliencyPolicy, or AppAssessment identified by resourceArn.

func (*InMemoryBackend) ListTestRecommendations

func (b *InMemoryBackend) ListTestRecommendations(assessmentArn string) error

ListTestRecommendations always returns an empty list.

func (*InMemoryBackend) ListUnsupportedAppVersionResources

func (b *InMemoryBackend) ListUnsupportedAppVersionResources(
	appArn, appVersion, token string, limit int,
) (*App, *AppVersion, page.Page[*PhysicalResource], error)

ListUnsupportedAppVersionResources returns every resource on (appArn, appVersion) whose ResourceType is not one of the two closed lists documented on types.PhysicalResourceId.Type -- real, derivable behavior (see consts.go's isSupportedResourceType), not a fabricated classification.

func (*InMemoryBackend) PolicyARN

func (b *InMemoryBackend) PolicyARN(id string) string

PolicyARN builds the ARN for a ResiliencyPolicy ID. Confirmed shape: "arn:{partition}:resiliencehub:{region}:{account}:resiliency-policy/{policy-id}".

func (*InMemoryBackend) PublishAppVersion

func (b *InMemoryBackend) PublishAppVersion(appArn, versionName string) (*App, string, error)

PublishAppVersion snapshots the App's current draft AppVersion into a new, immutable numbered version. The draft itself continues to be edited forward from where it was -- publishing only takes a deep-copy snapshot, it does not reset or replace the draft.

func (*InMemoryBackend) PutDraftAppVersionTemplate

func (b *InMemoryBackend) PutDraftAppVersionTemplate(appArn, templateBody string) (*App, error)

PutDraftAppVersionTemplate replaces the draft AppVersion's template body.

func (*InMemoryBackend) RecommendationTemplateARN

func (b *InMemoryBackend) RecommendationTemplateARN(id string) string

RecommendationTemplateARN builds the ARN for a RecommendationTemplate ID. UNCONFIRMED shape -- no doc comment in this SDK module describes RecommendationTemplateArn's resource-path segment (grepped, zero hits); "recommendation-template/{id}" is a defensible analogy to the confirmed app/resiliency-policy shapes, not a verified fact. See PARITY.md.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the AWS region this backend is configured for.

func (*InMemoryBackend) RejectResourceGroupingRecommendations

func (b *InMemoryBackend) RejectResourceGroupingRecommendations(
	appArn string, ids []string,
) ([]failedGroupingRecommendationEntryWire, error)

RejectResourceGroupingRecommendations rejects recommendations by ID -- same honest-failure rationale as AcceptResourceGroupingRecommendations.

func (*InMemoryBackend) RemoveDraftAppVersionResourceMappings

func (b *InMemoryBackend) RemoveDraftAppVersionResourceMappings(
	appArn string,
	req *removeDraftAppVersionResourceMappingsRequest,
) (*App, error)

RemoveDraftAppVersionResourceMappings removes resource mappings from the App's draft version matching any of the given name lists.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all stored state.

func (*InMemoryBackend) ResolveAppVersionResources

func (b *InMemoryBackend) ResolveAppVersionResources(appArn, appVersion string) (*App, string, string, error)

ResolveAppVersionResources kicks off an async resolution of (appArn, appVersion)'s ResourceMappings into concrete PhysicalResource entries. See resolveMappingsLocked for exactly which mapping types this backend genuinely resolves versus honestly leaves unresolved -- a scoped, documented judgment call (PARITY.md's "Resource mapping" section recommended deeper cross-service resolution; this pass resolves the "Resource" mapping type for real and honestly declines AppRegistryApp/ Terraform/CfnStack/ResourceGroup/EKS rather than fabricating discovered resources for them -- see PARITY.md's gaps section for why that is a narrower scope than the audit's recommendation).

func (*InMemoryBackend) Restore

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

Restore loads backend state from a JSON snapshot.

func (*InMemoryBackend) Snapshot

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

Snapshot serialises the backend state to JSON.

func (*InMemoryBackend) StartAppAssessment

func (b *InMemoryBackend) StartAppAssessment(req *startAppAssessmentRequest) (*AppAssessment, error)

StartAppAssessment starts a new (Pending -> InProgress -> Success) async assessment of (appArn, appVersion). See PARITY.md's honest-gap section: Summary/ResiliencyScore never carry fabricated content (Summary is always nil; ResiliencyScore.Score is always scorePlaceholder).

func (*InMemoryBackend) StartMetricsExport

func (b *InMemoryBackend) StartMetricsExport(req *startMetricsExportRequest) *MetricsExport

StartMetricsExport starts a new (Pending -> Success) async export of the current application-configuration metrics. Real async task bookkeeping; ExportLocation is a synthetic, documented placeholder -- no actual S3 object is written (matching CreateRecommendationTemplate's identical treatment of TemplatesLocation, see templates.go).

func (*InMemoryBackend) StartResourceGroupingRecommendationTask

func (b *InMemoryBackend) StartResourceGroupingRecommendationTask(appArn string) (*GroupingTask, error)

StartResourceGroupingRecommendationTask starts a new grouping- recommendation task for appArn. Real state (a genuine task record with real async transitions), honestly empty content (zero recommendations ever get generated).

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(_ context.Context, resourceArn string, newTags map[string]string) error

TagResource adds or updates tags on the App, ResiliencyPolicy, or AppAssessment identified by resourceArn.

func (*InMemoryBackend) TaggedResources

func (b *InMemoryBackend) TaggedResources() []TaggedEntry

TaggedResources returns every tagged App, ResiliencyPolicy, and AppAssessment, for the resourcegroupstaggingapi integration.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(_ context.Context, resourceArn string, tagKeys []string) error

UntagResource removes tags from the App, ResiliencyPolicy, or AppAssessment identified by resourceArn.

func (*InMemoryBackend) UpdateApp

func (b *InMemoryBackend) UpdateApp(appArn string, req *updateAppRequest) (*App, error)

UpdateApp applies a partial update to the App identified by appArn. ClearResiliencyPolicyArn is handled distinctly from an omitted PolicyArn (see PARITY.md's "App lifecycle" note): true clears the binding regardless of what PolicyArn carries, since a *bool -- unlike a *string -- can represent "explicitly clear" without colliding with "omitted".

func (*InMemoryBackend) UpdateAppVersion

func (b *InMemoryBackend) UpdateAppVersion(
	appArn string,
	additionalInfo map[string][]string,
) (*App, *AppVersion, error)

UpdateAppVersion updates AdditionalInfo on the draft AppVersion (this op takes no AppVersion parameter on the wire -- it always targets the draft, per PARITY.md's "operates on the draft only" invariant).

func (*InMemoryBackend) UpdateAppVersionAppComponent

func (b *InMemoryBackend) UpdateAppVersionAppComponent(
	appArn string, req *updateAppVersionAppComponentRequest, id string,
) (*App, *AppComponent, error)

UpdateAppVersionAppComponent updates the component with the given id on the draft version.

func (*InMemoryBackend) UpdateAppVersionResource

func (b *InMemoryBackend) UpdateAppVersionResource(
	appArn string, req *updateAppVersionResourceRequest, loc findResourceLocator,
) (*App, *PhysicalResource, error)

UpdateAppVersionResource updates the resource identified by loc on the draft version.

func (*InMemoryBackend) UpdateResiliencyPolicy

func (b *InMemoryBackend) UpdateResiliencyPolicy(
	policyArn string,
	req *updateResiliencyPolicyRequest,
) (*ResiliencyPolicy, error)

UpdateResiliencyPolicy applies a partial update to the policy identified by policyArn.

type LogicalResourceID

type LogicalResourceID struct {
	Identifier          string
	EksSourceName       string
	LogicalStackName    string
	ResourceGroupName   string
	TerraformSourceName string
}

LogicalResourceID mirrors types.LogicalResourceId.

type MetricsExport

type MetricsExport struct {
	CreationTime   time.Time
	ExportLocation *S3Location
	ID             string
	Status         string
	ErrorMessage   string
	BucketName     string
}

MetricsExport is the internal state of one StartMetricsExport call.

type PermissionModel

type PermissionModel struct {
	Type                 string
	InvokerRoleName      string
	CrossAccountRoleArns []string
}

PermissionModel mirrors types.PermissionModel.

type PhysicalResource

type PhysicalResource struct {
	LogicalResourceID  *LogicalResourceID
	PhysicalResourceID *PhysicalResourceID
	AdditionalInfo     map[string][]string
	ResourceType       string
	ParentResourceName string
	ResourceName       string
	SourceType         string
	AppComponents      []string
	Excluded           bool
}

PhysicalResource mirrors types.PhysicalResource.

type PhysicalResourceID

type PhysicalResourceID struct {
	Identifier   string
	Type         string
	AwsAccountID string
	AwsRegion    string
}

PhysicalResourceID mirrors types.PhysicalResourceId.

type Provider

type Provider struct{}

Provider implements service.Provider for AWS Resilience Hub.

func (*Provider) Init

Init initializes the Resilience Hub service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type RecommendationTemplate

type RecommendationTemplate struct {
	StartTime           time.Time
	EndTime             time.Time
	TemplatesLocation   *S3Location
	Tags                *tags.Tags
	ARN                 string
	AssessmentArn       string
	Name                string
	Format              string
	AppArn              string
	Message             string
	Status              string
	RecommendationTypes []string
	RecommendationIDs   []string
	NeedsReplacements   bool
}

RecommendationTemplate is the internal state of one recommendation template. TemplatesLocation is a synthetic, documented placeholder (bucket/prefix strings only): no actual S3 object is written -- see PARITY.md's "Recommendation families" gap. RecommendationIDs/ RecommendationTypes are always empty since this backend never generates real SOP/alarm/test/component recommendations to package.

type ResiliencyPolicy

type ResiliencyPolicy struct {
	CreationTime           time.Time
	Policy                 map[string]FailurePolicy
	Tags                   *tags.Tags
	ARN                    string
	Name                   string
	Tier                   string
	DataLocationConstraint string
	EstimatedCostTier      string
	Description            string
}

ResiliencyPolicy is the internal state of one resiliency policy.

type ResiliencyScore

type ResiliencyScore struct {
	DisruptionScore map[string]float64
	ComponentScore  map[string]ScoringComponentResiliencyScore
	Score           float64
}

ResiliencyScore mirrors types.ResiliencyScore. PLACEHOLDER ONLY: Score and DisruptionScore are outputs of AWS's proprietary resiliency-scoring model, which weighs resource redundancy, failover configuration, and backup posture across the real resource graph. No formula is derivable from the SDK (see PARITY.md's honest-gap section) -- this backend always sets Score to a fixed, documented placeholder (scorePlaceholder, see assessments.go) rather than inventing a number that would read as real analysis.

type ResolutionState

type ResolutionState struct {
	ResolutionID string
	Status       string
	ErrorMessage string
}

ResolutionState is the internal bookkeeping for one AppVersion's most recent ResolveAppVersionResources call.

type ResourceError

type ResourceError struct {
	LogicalResourceID  string
	PhysicalResourceID string
	Reason             string
}

ResourceError mirrors types.ResourceError.

type ResourceErrorsDetails

type ResourceErrorsDetails struct {
	ResourceErrors []ResourceError
	HasMoreErrors  bool
}

ResourceErrorsDetails mirrors types.ResourceErrorsDetails.

type ResourceMapping

type ResourceMapping struct {
	MappingType         string
	PhysicalResourceID  *PhysicalResourceID
	AppRegistryAppName  string
	EksSourceName       string
	LogicalStackName    string
	ResourceGroupName   string
	ResourceName        string
	TerraformSourceName string
}

ResourceMapping mirrors types.ResourceMapping.

type S3Location

type S3Location struct {
	Bucket string
	Prefix string
}

S3Location mirrors types.S3Location.

type ScoringComponentResiliencyScore

type ScoringComponentResiliencyScore struct {
	ExcludedCount    int64
	OutstandingCount int64
	PossibleScore    float64
	Score            float64
}

ScoringComponentResiliencyScore mirrors types.ScoringComponentResiliencyScore.

type TaggedEntry

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

TaggedEntry is one tagged resource, used by TaggedResources for the resourcegroupstaggingapi integration (cli.go's wireTaggingResilienceHub).

type TerraformSource

type TerraformSource struct {
	S3StateFileURL string
}

TerraformSource mirrors types.TerraformSource.

Jump to

Keyboard shortcuts

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