Documentation
¶
Index ¶
- Variables
- type AccessPreview
- type AccessPreviewStatus
- type AccessSpec
- type AnalyzedResource
- type Analyzer
- type AnalyzerStatus
- type AnalyzerType
- type ArchiveRule
- type FilterCriterion
- type Finding
- type FindingRecommendation
- type FindingStatus
- type Handler
- 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) AddAnalyzedResource(analyzerArn, resourceArn, resourceType string, isPublic bool) (*AnalyzedResource, error)
- func (b *InMemoryBackend) AddFinding(analyzerName, resourceType, resourceArn string, action []string, ...) (*Finding, error)
- func (b *InMemoryBackend) ApplyArchiveRule(analyzerArn, ruleName string) error
- func (b *InMemoryBackend) CancelPolicyGeneration(jobID string) error
- func (b *InMemoryBackend) CreateAccessPreview(analyzerArn string) (*AccessPreview, error)
- func (b *InMemoryBackend) CreateAnalyzer(name string, analyzerType AnalyzerType, tags map[string]string) (*Analyzer, error)
- func (b *InMemoryBackend) CreateArchiveRule(analyzerName, ruleName string, filter map[string]FilterCriterion) (*ArchiveRule, error)
- func (b *InMemoryBackend) CreateServiceLinkedAnalyzer(analyzerType AnalyzerType) (*Analyzer, error)
- func (b *InMemoryBackend) DeleteAnalyzer(name string) error
- func (b *InMemoryBackend) DeleteArchiveRule(analyzerName, ruleName string) error
- func (b *InMemoryBackend) GenerateFindingRecommendation(analyzerArn, findingID string) error
- func (b *InMemoryBackend) GetAccessPreview(accessPreviewID string) (*AccessPreview, error)
- func (b *InMemoryBackend) GetAnalyzedResource(analyzerArn, resourceArn string) (*AnalyzedResource, error)
- func (b *InMemoryBackend) GetAnalyzer(name string) (*Analyzer, error)
- func (b *InMemoryBackend) GetArchiveRule(analyzerName, ruleName string) (*ArchiveRule, error)
- func (b *InMemoryBackend) GetFinding(analyzerName, findingID string) (*Finding, error)
- func (b *InMemoryBackend) GetFindingRecommendation(analyzerArn, findingID string) (*FindingRecommendation, error)
- func (b *InMemoryBackend) GetFindingV2(analyzerArn, findingID string) (*Finding, error)
- func (b *InMemoryBackend) GetFindingsStatistics(analyzerArn string) (map[string]int, error)
- func (b *InMemoryBackend) GetPolicyGeneration(jobID string) (*PolicyGeneration, error)
- func (b *InMemoryBackend) ListAccessPreviewFindings(accessPreviewID string, maxResults int, nextToken string) ([]*Finding, string, error)
- func (b *InMemoryBackend) ListAccessPreviews(analyzerArn string) ([]*AccessPreview, error)
- func (b *InMemoryBackend) ListAnalyzedResources(analyzerArn, resourceType string, maxResults int, nextToken string) ([]*AnalyzedResource, string, error)
- func (b *InMemoryBackend) ListAnalyzers(analyzerType string) ([]*Analyzer, error)
- func (b *InMemoryBackend) ListArchiveRules(analyzerName string) ([]*ArchiveRule, error)
- func (b *InMemoryBackend) ListFindings(analyzerName string, _ map[string]FilterCriterion, status string, ...) ([]*Finding, string, error)
- func (b *InMemoryBackend) ListFindingsV2(analyzerArn, status string, maxResults int, nextToken string) ([]*Finding, string, error)
- func (b *InMemoryBackend) ListPolicyGenerations(principalArn string) ([]*PolicyGeneration, error)
- func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) StartPolicyGeneration(principalArn string) (*PolicyGeneration, error)
- func (b *InMemoryBackend) StartResourceScan(analyzerARN string, _ string) error
- func (b *InMemoryBackend) TagResource(resourceARN string, kv map[string]string) error
- func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error
- func (b *InMemoryBackend) UpdateAnalyzer(name string) (*Analyzer, error)
- func (b *InMemoryBackend) UpdateArchiveRule(analyzerName, ruleName string, filter map[string]FilterCriterion) (*ArchiveRule, error)
- func (b *InMemoryBackend) UpdateFindings(analyzerName string, findingIDs []string, status FindingStatus) error
- type PolicyCheckResult
- type PolicyGeneration
- type PolicyGenerationStatus
- type Provider
- type StorageBackend
- type ValidatePolicyFinding
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAnalyzerNotFound is returned when the named analyzer does not exist. ErrAnalyzerNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrAnalyzerAlreadyExists is returned when creating a duplicate analyzer. ErrAnalyzerAlreadyExists = awserr.New("ConflictException", awserr.ErrConflict) // ErrArchiveRuleNotFound is returned when the named archive rule does not exist. ErrArchiveRuleNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrArchiveRuleAlreadyExists is returned when creating a duplicate archive rule. ErrArchiveRuleAlreadyExists = awserr.New("ConflictException", awserr.ErrConflict) // ErrFindingNotFound is returned when a finding ID is not found. ErrFindingNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrValidation is returned on invalid input. ErrValidation = awserr.New("ValidationException", awserr.ErrInvalidParameter) )
var ErrAccessPreviewNotFound = newNotFoundErr("AccessPreviewNotFound")
ErrAccessPreviewNotFound is returned when an access preview is not found.
var ErrAnalyzedResourceNotFound = newNotFoundErr("AnalyzedResourceNotFound")
ErrAnalyzedResourceNotFound is returned when an analyzed resource is not found.
var ErrNilAppContext = errors.New("accessanalyzer: nil app context")
ErrNilAppContext is returned when Init is called with a nil AppContext.
var ErrPolicyGenerationNotFound = newNotFoundErr("PolicyGenerationNotFound")
ErrPolicyGenerationNotFound is returned when a policy generation job is not found.
Functions ¶
This section is empty.
Types ¶
type AccessPreview ¶
type AccessPreview struct {
CreatedAt time.Time
ID string
AnalyzerArn string
Status AccessPreviewStatus
}
AccessPreview represents an access preview.
type AccessPreviewStatus ¶
type AccessPreviewStatus string
AccessPreviewStatus represents the status of an access preview.
const ( AccessPreviewStatusCompleted AccessPreviewStatus = "COMPLETED" AccessPreviewStatusCreating AccessPreviewStatus = "CREATING" AccessPreviewStatusFailed AccessPreviewStatus = "FAILED" )
type AccessSpec ¶
AccessSpec is the access argument shape for CheckAccessNotGranted.
type AnalyzedResource ¶
type AnalyzedResource struct {
AnalyzedAt time.Time
CreatedAt time.Time
UpdatedAt time.Time
ResourceArn string
ResourceType string
AnalyzerArn string
IsPublic bool
}
AnalyzedResource represents a resource analyzed by an analyzer.
type Analyzer ¶
type Analyzer struct {
Tags map[string]string `json:"tags,omitempty"`
LastResourceAnalyzedAt *time.Time `json:"lastResourceAnalyzedAt,omitempty"`
CreatedAt time.Time `json:"createdAt"`
Arn string `json:"arn"`
Name string `json:"name"`
Type AnalyzerType `json:"type"`
Status AnalyzerStatus `json:"status"`
}
Analyzer represents an IAM Access Analyzer analyzer.
type AnalyzerStatus ¶
type AnalyzerStatus string
AnalyzerStatus represents the status of an analyzer.
const ( AnalyzerStatusActive AnalyzerStatus = "ACTIVE" AnalyzerStatusCreating AnalyzerStatus = "CREATING" AnalyzerStatusDisabled AnalyzerStatus = "DISABLED" AnalyzerStatusFailed AnalyzerStatus = "FAILED" )
type AnalyzerType ¶
type AnalyzerType string
AnalyzerType represents the type of an Access Analyzer analyzer.
const ( AnalyzerTypeAccount AnalyzerType = "ACCOUNT" AnalyzerTypeOrganization AnalyzerType = "ORGANIZATION" AnalyzerTypeAccountUnusedAccess AnalyzerType = "ACCOUNT_UNUSED_ACCESS" AnalyzerTypeOrganizationUnusedAccess AnalyzerType = "ORGANIZATION_UNUSED_ACCESS" )
type ArchiveRule ¶
type ArchiveRule struct {
Filter map[string]FilterCriterion `json:"filter"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
RuleName string `json:"ruleName"`
AnalyzerName string `json:"-"`
}
ArchiveRule represents an archive rule for an analyzer.
AnalyzerName identifies the owning analyzer. It is never part of the wire response (archiveRuleToJSON in handler_archive_rules.go builds that by hand), so it is tagged json:"-"; it exists purely so archiveRuleKeyFn (store_setup.go) can derive the composite "analyzerName|ruleName" store.Table key from the value alone, matching the primary key of the map[string]map[string]*ArchiveRule this type used to live in.
type FilterCriterion ¶
type FilterCriterion struct {
Contains []string `json:"contains,omitempty"`
Eq []string `json:"eq,omitempty"`
Exists *bool `json:"exists,omitempty"`
Neq []string `json:"neq,omitempty"`
}
FilterCriterion is a single criterion in a finding filter.
type Finding ¶
type Finding struct {
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"createdAt"`
Principal map[string]string `json:"principal,omitempty"`
Condition map[string]string `json:"condition,omitempty"`
IsPublic *bool `json:"isPublic,omitempty"`
ID string `json:"id"`
AnalyzerArn string `json:"analyzerArn"`
Status FindingStatus `json:"status"`
ResourceType string `json:"resourceType"`
ResourceArn string `json:"resourceArn"`
Action []string `json:"action,omitempty"`
}
Finding represents a single IAM Access Analyzer finding.
type FindingRecommendation ¶
type FindingRecommendation struct {
CompletedAt *time.Time
StartedAt time.Time
ID string
AnalyzerArn string
RecommendationType string
Status string
}
FindingRecommendation represents a recommendation record for a finding.
type FindingStatus ¶
type FindingStatus string
FindingStatus represents the status of a finding.
const ( FindingStatusActive FindingStatus = "ACTIVE" FindingStatusArchived FindingStatus = "ARCHIVED" FindingStatusResolved FindingStatus = "RESOLVED" )
type Handler ¶
type Handler struct {
Backend StorageBackend
}
Handler handles Access Analyzer HTTP requests.
func (*Handler) ExtractOperation ¶
ExtractOperation extracts the operation name from the request.
func (*Handler) ExtractResource ¶
ExtractResource extracts the resource identifier from the request.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations returns every operation this handler routes, across all operation families (analyzers, archive rules, findings, analyzed resources, generated policies, access previews, policy validation, tags).
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler function.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) Restore ¶
Restore implements persistence.Persistable by delegating to the backend. See Snapshot's doc comment for why this delegation was previously missing.
func (*Handler) RouteMatcher ¶
RouteMatcher returns a function that matches Access Analyzer requests by path prefix. For /tags/{ARN} paths, only matches when the ARN belongs to Access Analyzer (i.e. contains ":access-analyzer:") to avoid intercepting tag requests for other services.
func (*Handler) Snapshot ¶
Snapshot implements persistence.Persistable by delegating to the backend.
Before this Phase 3.3 conversion, InMemoryBackend already implemented Snapshot/Restore, but Handler never delegated to them -- setupPersistence in cli.go only registers a service.Registerable with the persistence.Manager if the Handler itself (the value actually returned by Provider.Init and passed to setupPersistence) satisfies the Snapshot/ Restore duck-typed interface, so Access Analyzer state was silently never persisted at all. Adding this method (and Restore below) is the dead-wiring fix that makes the backend's (now registry-backed) persistence reachable.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend implements StorageBackend using in-memory maps.
func NewInMemoryBackend ¶
func NewInMemoryBackend(accountID, region string) *InMemoryBackend
NewInMemoryBackend constructs a new InMemoryBackend.
func (*InMemoryBackend) AccountID ¶
func (b *InMemoryBackend) AccountID() string
AccountID returns the backend's account ID.
func (*InMemoryBackend) AddAnalyzedResource ¶
func (b *InMemoryBackend) AddAnalyzedResource( analyzerArn, resourceArn, resourceType string, isPublic bool, ) (*AnalyzedResource, error)
AddAnalyzedResource adds a synthetic analyzed resource (for testing).
func (*InMemoryBackend) AddFinding ¶
func (b *InMemoryBackend) AddFinding( analyzerName, resourceType, resourceArn string, action []string, principal map[string]string, isPublic *bool, ) (*Finding, error)
AddFinding adds a synthetic finding to an analyzer (for testing / resource scan simulation).
func (*InMemoryBackend) ApplyArchiveRule ¶
func (b *InMemoryBackend) ApplyArchiveRule(analyzerArn, ruleName string) error
ApplyArchiveRule applies all archive rules for an analyzer to its findings. Findings that match any archive rule filter are archived.
func (*InMemoryBackend) CancelPolicyGeneration ¶
func (b *InMemoryBackend) CancelPolicyGeneration(jobID string) error
CancelPolicyGeneration cancels a policy generation job.
func (*InMemoryBackend) CreateAccessPreview ¶
func (b *InMemoryBackend) CreateAccessPreview(analyzerArn string) (*AccessPreview, error)
CreateAccessPreview creates a new access preview.
func (*InMemoryBackend) CreateAnalyzer ¶
func (b *InMemoryBackend) CreateAnalyzer( name string, analyzerType AnalyzerType, tags map[string]string, ) (*Analyzer, error)
CreateAnalyzer creates a new analyzer.
func (*InMemoryBackend) CreateArchiveRule ¶
func (b *InMemoryBackend) CreateArchiveRule( analyzerName, ruleName string, filter map[string]FilterCriterion, ) (*ArchiveRule, error)
CreateArchiveRule adds an archive rule to an analyzer and immediately archives all active findings for that analyzer (AWS auto-apply behavior).
func (*InMemoryBackend) CreateServiceLinkedAnalyzer ¶
func (b *InMemoryBackend) CreateServiceLinkedAnalyzer(analyzerType AnalyzerType) (*Analyzer, error)
CreateServiceLinkedAnalyzer creates an analyzer with a generated service-linked name.
func (*InMemoryBackend) DeleteAnalyzer ¶
func (b *InMemoryBackend) DeleteAnalyzer(name string) error
DeleteAnalyzer removes an analyzer and all its findings and archive rules.
func (*InMemoryBackend) DeleteArchiveRule ¶
func (b *InMemoryBackend) DeleteArchiveRule(analyzerName, ruleName string) error
DeleteArchiveRule removes an archive rule.
func (*InMemoryBackend) GenerateFindingRecommendation ¶
func (b *InMemoryBackend) GenerateFindingRecommendation(analyzerArn, findingID string) error
GenerateFindingRecommendation records a recommendation request for a finding.
func (*InMemoryBackend) GetAccessPreview ¶
func (b *InMemoryBackend) GetAccessPreview(accessPreviewID string) (*AccessPreview, error)
GetAccessPreview returns an access preview by ID.
func (*InMemoryBackend) GetAnalyzedResource ¶
func (b *InMemoryBackend) GetAnalyzedResource(analyzerArn, resourceArn string) (*AnalyzedResource, error)
GetAnalyzedResource returns an analyzed resource for an analyzer by resource ARN.
func (*InMemoryBackend) GetAnalyzer ¶
func (b *InMemoryBackend) GetAnalyzer(name string) (*Analyzer, error)
GetAnalyzer returns the named analyzer.
func (*InMemoryBackend) GetArchiveRule ¶
func (b *InMemoryBackend) GetArchiveRule(analyzerName, ruleName string) (*ArchiveRule, error)
GetArchiveRule returns the named archive rule.
func (*InMemoryBackend) GetFinding ¶
func (b *InMemoryBackend) GetFinding(analyzerName, findingID string) (*Finding, error)
GetFinding returns a finding by ID.
func (*InMemoryBackend) GetFindingRecommendation ¶
func (b *InMemoryBackend) GetFindingRecommendation( analyzerArn, findingID string, ) (*FindingRecommendation, error)
GetFindingRecommendation returns recommendations for a finding.
func (*InMemoryBackend) GetFindingV2 ¶
func (b *InMemoryBackend) GetFindingV2(analyzerArn, findingID string) (*Finding, error)
GetFindingV2 returns a finding in V2 format (same data, different shape).
func (*InMemoryBackend) GetFindingsStatistics ¶
func (b *InMemoryBackend) GetFindingsStatistics(analyzerArn string) (map[string]int, error)
GetFindingsStatistics returns counts of findings by status for an analyzer.
func (*InMemoryBackend) GetPolicyGeneration ¶
func (b *InMemoryBackend) GetPolicyGeneration(jobID string) (*PolicyGeneration, error)
GetPolicyGeneration returns a policy generation job by ID.
func (*InMemoryBackend) ListAccessPreviewFindings ¶
func (b *InMemoryBackend) ListAccessPreviewFindings( accessPreviewID string, maxResults int, nextToken string, ) ([]*Finding, string, error)
ListAccessPreviewFindings returns findings from the analyzer associated with the preview.
func (*InMemoryBackend) ListAccessPreviews ¶
func (b *InMemoryBackend) ListAccessPreviews(analyzerArn string) ([]*AccessPreview, error)
ListAccessPreviews returns all access previews for a given analyzerArn.
func (*InMemoryBackend) ListAnalyzedResources ¶
func (b *InMemoryBackend) ListAnalyzedResources( analyzerArn, resourceType string, maxResults int, nextToken string, ) ([]*AnalyzedResource, string, error)
ListAnalyzedResources returns analyzed resources for an analyzer, optionally filtered by type.
func (*InMemoryBackend) ListAnalyzers ¶
func (b *InMemoryBackend) ListAnalyzers(analyzerType string) ([]*Analyzer, error)
ListAnalyzers returns all analyzers, optionally filtered by type.
func (*InMemoryBackend) ListArchiveRules ¶
func (b *InMemoryBackend) ListArchiveRules(analyzerName string) ([]*ArchiveRule, error)
ListArchiveRules returns all archive rules for an analyzer.
func (*InMemoryBackend) ListFindings ¶
func (b *InMemoryBackend) ListFindings( analyzerName string, _ map[string]FilterCriterion, status string, maxResults int, nextToken string, ) ([]*Finding, string, error)
ListFindings returns findings for an analyzer, optionally filtered.
func (*InMemoryBackend) ListFindingsV2 ¶
func (b *InMemoryBackend) ListFindingsV2( analyzerArn, status string, maxResults int, nextToken string, ) ([]*Finding, string, error)
ListFindingsV2 returns findings in V2 format for an analyzer identified by ARN.
func (*InMemoryBackend) ListPolicyGenerations ¶
func (b *InMemoryBackend) ListPolicyGenerations(principalArn string) ([]*PolicyGeneration, error)
ListPolicyGenerations returns all policy generation jobs, optionally filtered by principalArn.
func (*InMemoryBackend) ListTagsForResource ¶
func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)
ListTagsForResource returns all tags for a resource.
func (*InMemoryBackend) Region ¶
func (b *InMemoryBackend) Region() string
Region returns the backend's region.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore deserializes state from JSON. It implements persistence.Persistable.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serializes current state to JSON. It implements persistence.Persistable.
func (*InMemoryBackend) StartPolicyGeneration ¶
func (b *InMemoryBackend) StartPolicyGeneration(principalArn string) (*PolicyGeneration, error)
StartPolicyGeneration creates a new policy generation job.
func (*InMemoryBackend) StartResourceScan ¶
func (b *InMemoryBackend) StartResourceScan(analyzerARN string, _ string) error
StartResourceScan records that a scan was initiated for a resource (no-op in simulation).
func (*InMemoryBackend) TagResource ¶
func (b *InMemoryBackend) TagResource(resourceARN string, kv map[string]string) error
TagResource sets tags on a resource by ARN.
func (*InMemoryBackend) UntagResource ¶
func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error
UntagResource removes tags from a resource by ARN.
func (*InMemoryBackend) UpdateAnalyzer ¶
func (b *InMemoryBackend) UpdateAnalyzer(name string) (*Analyzer, error)
UpdateAnalyzer updates an analyzer (currently a no-op — configuration not stored).
func (*InMemoryBackend) UpdateArchiveRule ¶
func (b *InMemoryBackend) UpdateArchiveRule( analyzerName, ruleName string, filter map[string]FilterCriterion, ) (*ArchiveRule, error)
UpdateArchiveRule replaces the filter on an archive rule.
func (*InMemoryBackend) UpdateFindings ¶
func (b *InMemoryBackend) UpdateFindings( analyzerName string, findingIDs []string, status FindingStatus, ) error
UpdateFindings archives or marks active the specified findings.
type PolicyCheckResult ¶
type PolicyCheckResult struct {
Result string `json:"result"`
Message string `json:"message"`
Reasons []map[string]any `json:"reasons,omitempty"`
}
PolicyCheckResult holds a structured check result returned to callers.
func CheckAccessNotGranted ¶
func CheckAccessNotGranted(policyDoc string, accesses []AccessSpec) PolicyCheckResult
CheckAccessNotGranted returns PASS if the policy does NOT grant any of the specified accesses.
func CheckNoNewAccess ¶
func CheckNoNewAccess(existingDoc, newDoc string) PolicyCheckResult
CheckNoNewAccess returns PASS if newPolicyDoc does not grant access beyond existingPolicyDoc.
func CheckNoPublicAccess ¶
func CheckNoPublicAccess(policyDoc string) PolicyCheckResult
CheckNoPublicAccess returns PASS if the policy has no public-access Allow statements.
type PolicyGeneration ¶
type PolicyGeneration struct {
CompletedOn *time.Time
StartedOn time.Time
JobID string
PrincipalArn string
Status PolicyGenerationStatus
}
PolicyGeneration represents a policy generation job.
type PolicyGenerationStatus ¶
type PolicyGenerationStatus string
PolicyGenerationStatus represents the status of a policy generation job.
const ( PolicyGenerationStatusRunning PolicyGenerationStatus = "RUNNING" PolicyGenerationStatusSucceeded PolicyGenerationStatus = "SUCCEEDED" PolicyGenerationStatusFailed PolicyGenerationStatus = "FAILED" PolicyGenerationStatusCanceled PolicyGenerationStatus = "CANCELED" )
type Provider ¶
type Provider struct{}
Provider implements service.Provider for IAM Access Analyzer.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the Access Analyzer service backend and handler.
type StorageBackend ¶
type StorageBackend interface {
// Analyzer operations
CreateAnalyzer(name string, analyzerType AnalyzerType, tags map[string]string) (*Analyzer, error)
GetAnalyzer(name string) (*Analyzer, error)
ListAnalyzers(analyzerType string) ([]*Analyzer, error)
DeleteAnalyzer(name string) error
UpdateAnalyzer(name string) (*Analyzer, error)
CreateServiceLinkedAnalyzer(analyzerType AnalyzerType) (*Analyzer, error)
// Archive rule operations
CreateArchiveRule(analyzerName, ruleName string, filter map[string]FilterCriterion) (*ArchiveRule, error)
GetArchiveRule(analyzerName, ruleName string) (*ArchiveRule, error)
ListArchiveRules(analyzerName string) ([]*ArchiveRule, error)
DeleteArchiveRule(analyzerName, ruleName string) error
UpdateArchiveRule(analyzerName, ruleName string, filter map[string]FilterCriterion) (*ArchiveRule, error)
ApplyArchiveRule(analyzerArn, ruleName string) error
// Finding operations
AddFinding(
analyzerName, resourceType, resourceArn string,
action []string,
principal map[string]string,
isPublic *bool,
) (*Finding, error)
GetFinding(analyzerName, findingID string) (*Finding, error)
ListFindings(
analyzerName string,
filter map[string]FilterCriterion,
status string,
maxResults int,
nextToken string,
) ([]*Finding, string, error)
UpdateFindings(analyzerName string, findingIDs []string, status FindingStatus) error
GetFindingV2(analyzerArn, findingID string) (*Finding, error)
ListFindingsV2(analyzerArn, status string, maxResults int, nextToken string) ([]*Finding, string, error)
GetFindingsStatistics(analyzerArn string) (map[string]int, error)
// Finding recommendations
GenerateFindingRecommendation(analyzerArn, findingID string) error
GetFindingRecommendation(analyzerArn, findingID string) (*FindingRecommendation, error)
// Analyzed resources
AddAnalyzedResource(analyzerArn, resourceArn, resourceType string, isPublic bool) (*AnalyzedResource, error)
GetAnalyzedResource(analyzerArn, resourceArn string) (*AnalyzedResource, error)
ListAnalyzedResources(
analyzerArn, resourceType string,
maxResults int,
nextToken string,
) ([]*AnalyzedResource, string, error)
// Scan
StartResourceScan(analyzerARN, resourceARN string) error
// Policy generation
StartPolicyGeneration(principalArn string) (*PolicyGeneration, error)
GetPolicyGeneration(jobID string) (*PolicyGeneration, error)
CancelPolicyGeneration(jobID string) error
ListPolicyGenerations(principalArn string) ([]*PolicyGeneration, error)
// Access previews
CreateAccessPreview(analyzerArn string) (*AccessPreview, error)
GetAccessPreview(accessPreviewID string) (*AccessPreview, error)
ListAccessPreviews(analyzerArn string) ([]*AccessPreview, error)
ListAccessPreviewFindings(accessPreviewID string, maxResults int, nextToken string) ([]*Finding, string, error)
// Tag operations
TagResource(resourceARN string, kv map[string]string) error
UntagResource(resourceARN string, tagKeys []string) error
ListTagsForResource(resourceARN string) (map[string]string, error)
// Lifecycle
Reset()
Region() string
AccountID() string
Snapshot(ctx context.Context) []byte
Restore(ctx context.Context, data []byte) error
}
StorageBackend defines the interface for Access Analyzer backend implementations. All mutating methods must be safe for concurrent use.
type ValidatePolicyFinding ¶
type ValidatePolicyFinding struct {
FindingType string `json:"findingType"`
IssueCode string `json:"issueCode"`
LearnMoreLink string `json:"learnMoreLink"`
Locations []map[string]any `json:"locations"`
}
ValidatePolicyFinding is a single finding from policy validation.
func ValidatePolicy ¶
func ValidatePolicy(policyDoc, policyType string) []ValidatePolicyFinding
ValidatePolicy checks a policy document for structural and semantic errors.
Source Files
¶
- access_previews.go
- analyzed_resources.go
- analyzers.go
- archive_rules.go
- errors.go
- findings.go
- generated_policies.go
- handler.go
- handler_access_previews.go
- handler_analyzed_resources.go
- handler_analyzers.go
- handler_archive_rules.go
- handler_findings.go
- handler_generated_policies.go
- handler_policy_validation.go
- handler_tags.go
- interfaces.go
- models.go
- persistence.go
- policy_analysis.go
- provider.go
- store.go
- store_setup.go
- tags.go