Documentation
¶
Index ¶
- Variables
- type ActionTarget
- type AdminAccount
- type AggregatorV2
- type AutomationRule
- type AutomationRuleMetadata
- type AutomationRuleV2
- type ConfigurationPolicy
- type ConfigurationPolicyAssociation
- type ConnectorV2
- type CspmConnector
- type FindingAggregator
- 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 Hub
- type HubV2
- type HubV2Feature
- type InMemoryBackend
- func (b *InMemoryBackend) AcceptAdministratorInvitation(administratorID, invitationID string) error
- func (b *InMemoryBackend) AcceptInvitation(masterID, invitationID string) error
- func (b *InMemoryBackend) AccountID() string
- func (b *InMemoryBackend) BatchDeleteAutomationRules(automationRulesArns []string) ([]string, []map[string]any)
- func (b *InMemoryBackend) BatchDisableStandards(subscriptionArns []string) ([]*StandardsSubscription, []map[string]any)
- func (b *InMemoryBackend) BatchEnableStandards(requests []map[string]any) ([]*StandardsSubscription, []map[string]any)
- func (b *InMemoryBackend) BatchGetAutomationRules(automationRulesArns []string) ([]*AutomationRule, []map[string]any)
- func (b *InMemoryBackend) BatchGetConfigurationPolicyAssociations(requests []map[string]any) ([]*ConfigurationPolicyAssociation, []map[string]any)
- func (b *InMemoryBackend) BatchGetSecurityControls(securityControlIDs []string) ([]*SecurityControl, []map[string]any)
- func (b *InMemoryBackend) BatchGetStandardsControlAssociations(requests []map[string]any) ([]*StandardsControlAssociation, []map[string]any)
- func (b *InMemoryBackend) BatchUpdateAutomationRules(updates []map[string]any) ([]string, []map[string]any)
- func (b *InMemoryBackend) BatchUpdateFindings(findingIdentifiers []map[string]any, updates map[string]any) ([]map[string]any, []map[string]any)
- func (b *InMemoryBackend) BatchUpdateFindingsV2(findingIdentifiers []map[string]any, metadataUids []string, ...) ([]map[string]any, []map[string]any)
- func (b *InMemoryBackend) BatchUpdateStandardsControlAssociations(updates []map[string]any) ([]map[string]any, error)
- func (b *InMemoryBackend) CreateActionTarget(name, description, id string) (string, error)
- func (b *InMemoryBackend) CreateAggregatorV2(regionLinkingMode string, regions []string) (*AggregatorV2, error)
- func (b *InMemoryBackend) CreateAutomationRule(rule map[string]any) (string, string)
- func (b *InMemoryBackend) CreateAutomationRuleV2(ruleName, ruleStatus, description string, criteria map[string]any, ...) (*AutomationRuleV2, error)
- func (b *InMemoryBackend) CreateConfigurationPolicy(name, description string, policy map[string]any, tags map[string]string) (*ConfigurationPolicy, error)
- func (b *InMemoryBackend) CreateConnector(name, description string, provider map[string]any, tags map[string]string) (*CspmConnector, error)
- func (b *InMemoryBackend) CreateConnectorV2(name, description string, provider map[string]any, tags map[string]string) (*ConnectorV2, error)
- func (b *InMemoryBackend) CreateFindingAggregator(regionLinkingMode string, regions []string) (*FindingAggregator, error)
- func (b *InMemoryBackend) CreateInsight(name, groupByAttribute string, filters map[string]any) (string, error)
- func (b *InMemoryBackend) CreateMembers(accounts []map[string]any) ([]*Member, []map[string]any)
- func (b *InMemoryBackend) CreateTicketV2(connectorID, findingMetadataUID, mode string) (*TicketV2, error)
- func (b *InMemoryBackend) DeclineInvitations(accountIDs []string) ([]map[string]any, []map[string]any)
- func (b *InMemoryBackend) DeleteActionTarget(actionTargetArn string) (string, error)
- func (b *InMemoryBackend) DeleteAggregatorV2(arn string) error
- func (b *InMemoryBackend) DeleteAutomationRuleV2(identifier string) error
- func (b *InMemoryBackend) DeleteConfigurationPolicy(identifier string) error
- func (b *InMemoryBackend) DeleteConnector(connectorID string) (string, error)
- func (b *InMemoryBackend) DeleteConnectorV2(connectorID string) error
- func (b *InMemoryBackend) DeleteFindingAggregator(arn string) error
- func (b *InMemoryBackend) DeleteInsight(insightArn string) (string, error)
- func (b *InMemoryBackend) DeleteInvitations(accountIDs []string) ([]map[string]any, []map[string]any)
- func (b *InMemoryBackend) DeleteMembers(accountIDs []string) ([]string, []map[string]any)
- func (b *InMemoryBackend) DescribeActionTargets(actionTargetArns []string, nextToken string, maxResults int) ([]*ActionTarget, string)
- func (b *InMemoryBackend) DescribeHub() (*Hub, error)
- func (b *InMemoryBackend) DescribeOrganizationConfiguration() *OrgConfig
- func (b *InMemoryBackend) DescribeProducts(productArn, nextToken string, maxResults int) ([]*Product, string)
- func (b *InMemoryBackend) DescribeProductsV2(nextToken string, maxResults int) ([]*Product, string)
- func (b *InMemoryBackend) DescribeSecurityHubV2() (*HubV2, error)
- func (b *InMemoryBackend) DescribeStandards(nextToken string, maxResults int) ([]*Standard, string)
- func (b *InMemoryBackend) DescribeStandardsControls(subscriptionArn, nextToken string, maxResults int) ([]*StandardsControl, string)
- func (b *InMemoryBackend) DisableHub() error
- func (b *InMemoryBackend) DisableImportFindingsForProduct(productSubscriptionArn string) error
- func (b *InMemoryBackend) DisableOrganizationAdminAccount(accountID string) error
- func (b *InMemoryBackend) DisableSecurityHubFeatureV2(featureName string) error
- func (b *InMemoryBackend) DisableSecurityHubV2() error
- func (b *InMemoryBackend) DisassociateFromAdministratorAccount() error
- func (b *InMemoryBackend) DisassociateFromMasterAccount() error
- func (b *InMemoryBackend) DisassociateMembers(accountIDs []string) error
- func (b *InMemoryBackend) EnableHub(enableDefaultStandards bool, tags map[string]string) error
- func (b *InMemoryBackend) EnableImportFindingsForProduct(productArn string) (string, error)
- func (b *InMemoryBackend) EnableOrganizationAdminAccount(accountID string) error
- func (b *InMemoryBackend) EnableSecurityHubFeatureV2(featureName string) error
- func (b *InMemoryBackend) EnableSecurityHubV2(tags map[string]string) error
- func (b *InMemoryBackend) GenerateRecommendedPolicyV2(metadataUID string) (*RecommendedPolicyV2, error)
- func (b *InMemoryBackend) GetAdministratorAccount() (*AdminAccount, error)
- func (b *InMemoryBackend) GetAggregatorV2(arn string) (*AggregatorV2, error)
- func (b *InMemoryBackend) GetAutomationRuleV2(identifier string) (*AutomationRuleV2, error)
- func (b *InMemoryBackend) GetConfigurationPolicy(identifier string) (*ConfigurationPolicy, error)
- func (b *InMemoryBackend) GetConfigurationPolicyAssociation(targetID, targetType string) (*ConfigurationPolicyAssociation, error)
- func (b *InMemoryBackend) GetConnector(connectorID string) (*CspmConnector, error)
- func (b *InMemoryBackend) GetConnectorV2(connectorID string) (*ConnectorV2, error)
- func (b *InMemoryBackend) GetEnabledStandards(subscriptionArns []string, nextToken string, maxResults int) ([]*StandardsSubscription, string)
- func (b *InMemoryBackend) GetFindingAggregator(arn string) (*FindingAggregator, error)
- func (b *InMemoryBackend) GetFindingHistory(ident map[string]any, startTime, endTime string, nextToken string, ...) ([]map[string]any, string)
- func (b *InMemoryBackend) GetFindingStatisticsV2(groupByFields []string) []map[string]any
- func (b *InMemoryBackend) GetFindings(filters map[string]any, sortCriteria []map[string]any, nextToken string, ...) ([]map[string]any, string)
- func (b *InMemoryBackend) GetFindingsTrendsV2(startTime, endTime string) []map[string]any
- func (b *InMemoryBackend) GetFindingsV2(filters map[string]any, sortCriteria []map[string]any, nextToken string, ...) ([]map[string]any, string)
- func (b *InMemoryBackend) GetInsightResults(insightArn string) (*InsightResults, error)
- func (b *InMemoryBackend) GetInsights(insightArns []string, nextToken string, maxResults int) ([]*Insight, string, error)
- func (b *InMemoryBackend) GetInvitationsCount() int
- func (b *InMemoryBackend) GetMasterAccount() (*AdminAccount, error)
- func (b *InMemoryBackend) GetMembers(accountIDs []string) ([]*Member, []map[string]any)
- func (b *InMemoryBackend) GetRecommendedPolicyV2(metadataUID string) (*RecommendedPolicyV2, error)
- func (b *InMemoryBackend) GetResourcesStatisticsV2(groupByFields []string) []map[string]any
- func (b *InMemoryBackend) GetResourcesTrendsV2(startTime, endTime string) []map[string]any
- func (b *InMemoryBackend) GetResourcesV2(filters map[string]any, nextToken string, maxResults int) ([]map[string]any, string)
- func (b *InMemoryBackend) GetSecurityControlDefinition(securityControlID string) (*SecurityControlDefinition, error)
- func (b *InMemoryBackend) ImportFindings(findings []map[string]any) (int, int, []map[string]any)
- func (b *InMemoryBackend) InviteMembers(accountIDs []string) []map[string]any
- func (b *InMemoryBackend) ListAggregatorsV2(nextToken string, maxResults int) ([]*AggregatorV2, string)
- func (b *InMemoryBackend) ListAutomationRules(nextToken string, maxResults int) ([]*AutomationRuleMetadata, string)
- func (b *InMemoryBackend) ListAutomationRulesV2(nextToken string, maxResults int) ([]*AutomationRuleV2, string)
- func (b *InMemoryBackend) ListConfigurationPolicies(nextToken string, maxResults int) ([]*ConfigurationPolicy, string)
- func (b *InMemoryBackend) ListConfigurationPolicyAssociations(filterPolicyID, filterType, nextToken string, maxResults int) ([]*ConfigurationPolicyAssociation, string)
- func (b *InMemoryBackend) ListConnectors(connectorStatus, enablementStatus, providerName, nextToken string, ...) ([]*CspmConnector, string)
- func (b *InMemoryBackend) ListConnectorsV2(nextToken string, maxResults int) ([]*ConnectorV2, string)
- func (b *InMemoryBackend) ListEnabledProductsForImport(nextToken string, maxResults int) ([]string, string)
- func (b *InMemoryBackend) ListFindingAggregators(nextToken string, maxResults int) ([]*FindingAggregator, string)
- func (b *InMemoryBackend) ListInvitations(nextToken string, maxResults int) ([]*Invitation, string)
- func (b *InMemoryBackend) ListMembers(onlyAssociated bool, nextToken string, maxResults int) ([]*Member, string)
- func (b *InMemoryBackend) ListOrganizationAdminAccounts(nextToken string, maxResults int) ([]*OrgAdminAccount, string)
- func (b *InMemoryBackend) ListSecurityControlDefinitions(_, nextToken string, maxResults int) ([]*SecurityControlDefinition, string)
- func (b *InMemoryBackend) ListStandardsControlAssociations(securityControlID, nextToken string, maxResults int) ([]*StandardsControlAssociation, string)
- func (b *InMemoryBackend) ListTagsForResource(resourceArn string) (map[string]string, error)
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) RegisterConnectorV2(_, authState string) (*ConnectorV2, error)
- 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) StartConfigurationPolicyAssociation(configPolicyIdentifier, targetID, targetType string) (*ConfigurationPolicyAssociation, error)
- func (b *InMemoryBackend) StartConfigurationPolicyDisassociation(configPolicyIdentifier, targetID, targetType string) error
- func (b *InMemoryBackend) TagResource(resourceArn string, tags map[string]string) error
- func (b *InMemoryBackend) TaggedResources() []TaggedEntry
- func (b *InMemoryBackend) UntagResource(resourceArn string, tagKeys []string) error
- func (b *InMemoryBackend) UpdateActionTarget(actionTargetArn, name, description string) error
- func (b *InMemoryBackend) UpdateAggregatorV2(arn, regionLinkingMode string, regions []string) (*AggregatorV2, error)
- func (b *InMemoryBackend) UpdateAutomationRuleV2(identifier string, updates map[string]any) (*AutomationRuleV2, error)
- func (b *InMemoryBackend) UpdateConfigurationPolicy(identifier, name, description string, policy map[string]any) (*ConfigurationPolicy, error)
- func (b *InMemoryBackend) UpdateConnector(connectorID, description string, provider map[string]any) (*CspmConnector, error)
- func (b *InMemoryBackend) UpdateConnectorV2(connectorID, name, description string, provider map[string]any) (*ConnectorV2, error)
- func (b *InMemoryBackend) UpdateFindingAggregator(arn, regionLinkingMode string, regions []string) (*FindingAggregator, error)
- func (b *InMemoryBackend) UpdateFindings(filters map[string]any, note map[string]any, recordState string) error
- func (b *InMemoryBackend) UpdateHubConfiguration(autoEnableControls *bool, autoEnableStandards *string, ...) error
- func (b *InMemoryBackend) UpdateInsight(insightArn, name, groupByAttribute string, filters map[string]any) error
- func (b *InMemoryBackend) UpdateOrganizationConfiguration(autoEnable bool, autoEnableStandards string, orgConfigType string) error
- func (b *InMemoryBackend) UpdateSecurityControl(securityControlID string, parameters map[string]any, _ string) error
- func (b *InMemoryBackend) UpdateStandardsControl(controlArn, controlStatus, disabledReason string) error
- type Insight
- type InsightResults
- type Invitation
- type Member
- type OrgAdminAccount
- type OrgConfig
- type Product
- type Provider
- type RecommendedPolicyV2
- type SecurityControl
- type SecurityControlDefinition
- type Standard
- type StandardsControl
- type StandardsControlAssociation
- type StandardsSubscription
- type StorageBackend
- type TaggedEntry
- type TicketV2
Constants ¶
This section is empty.
Variables ¶
var ( ErrHubNotEnabled = errors.New("SecurityHub is not enabled") ErrHubAlreadyExists = errors.New("SecurityHub is already enabled") ErrNotFound = errors.New("not found") ErrInvalidInput = errors.New("invalid input") ErrAlreadyExists = errors.New("resource already exists") )
var ErrNilAppContext = errors.New("securityhub: nil app context")
ErrNilAppContext is returned when Init is called with a nil AppContext.
Functions ¶
This section is empty.
Types ¶
type ActionTarget ¶
type ActionTarget struct {
ActionTargetArn string `json:"ActionTargetArn"`
Name string `json:"Name"`
Description string `json:"Description"`
}
ActionTarget represents a custom action target.
type AdminAccount ¶
type AdminAccount struct {
AccountId string `json:"AccountId"` //nolint:revive,staticcheck // existing issue.
InvitationId string `json:"InvitationId"` //nolint:revive,staticcheck // existing issue.
InvitedAt string `json:"InvitedAt"`
MemberStatus string `json:"MemberStatus"`
}
AdminAccount represents the administrator account relationship. It wires the real securityhub@v1.75.4 types.Invitation shape (GetAdministratorAccountOutput. Administrator / GetMasterAccountOutput.Master are both *types.Invitation), whose status member is "MemberStatus" -- the same real field the sibling Invitation model (used by ListInvitations) already names correctly.
type AggregatorV2 ¶
type AggregatorV2 struct {
AggregatorV2Arn string `json:"AggregatorV2Arn"`
AggregationRegion string `json:"AggregationRegion"`
RegionLinkingMode string `json:"RegionLinkingMode"`
CreatedAt string `json:"CreatedAt"`
UpdatedAt string `json:"UpdatedAt"`
Regions []string `json:"Regions"`
}
AggregatorV2 represents a Security Hub V2 cross-region aggregator.
type AutomationRule ¶
type AutomationRule struct {
Criteria map[string]any `json:"Criteria"`
RuleArn string `json:"RuleArn"`
RuleStatus string `json:"RuleStatus"`
RuleName string `json:"RuleName"`
Description string `json:"Description"`
CreatedAt string `json:"CreatedAt"`
UpdatedAt string `json:"UpdatedAt"`
CreatedBy string `json:"CreatedBy"`
Actions []map[string]any `json:"Actions"`
RuleOrder int32 `json:"RuleOrder"`
IsTerminal bool `json:"IsTerminal"`
}
AutomationRule is the full rule returned by BatchGetAutomationRules.
type AutomationRuleMetadata ¶
type AutomationRuleMetadata struct {
RuleArn string
RuleStatus string
RuleName string
Description string
CreatedAt string
UpdatedAt string
CreatedBy string
RuleOrder int32
IsTerminal bool
}
AutomationRuleMetadata is the summary view returned by ListAutomationRules.
type AutomationRuleV2 ¶
type AutomationRuleV2 struct {
Identifier string `json:"RuleId"`
RuleArn string `json:"RuleArn"`
RuleName string `json:"RuleName"`
RuleStatus string `json:"RuleStatus"`
Description string `json:"Description"`
CreatedAt string `json:"CreatedAt"`
UpdatedAt string `json:"UpdatedAt"`
Criteria map[string]any `json:"Criteria"`
Actions []map[string]any `json:"Actions"`
RuleOrder float64 `json:"RuleOrder"`
}
AutomationRuleV2 represents a Security Hub V2 automation rule. Identifier is the store key (also the URL path segment); on the wire it is "RuleId" (securityhub@v1.75.4 types.go:905-935), not "Identifier" -- see automationRuleV2ToResponse. Unlike the V1 AutomationRule, the real V2 shape has no IsTerminal member at all.
type ConfigurationPolicy ¶
type ConfigurationPolicy struct {
ConfigurationPolicy map[string]any `json:"ConfigurationPolicy"`
Tags map[string]string `json:"Tags"`
Arn string `json:"Arn"`
Id string `json:"Id"` //nolint:revive,staticcheck // existing issue.
Name string `json:"Name"`
Description string `json:"Description"`
CreatedAt string `json:"CreatedAt"`
UpdatedAt string `json:"UpdatedAt"`
}
ConfigurationPolicy represents a Security Hub central configuration policy.
type ConfigurationPolicyAssociation ¶
type ConfigurationPolicyAssociation struct {
ConfigurationPolicyId string `json:"ConfigurationPolicyId"` //nolint:revive,staticcheck // existing issue.
TargetId string `json:"TargetId"` //nolint:revive,staticcheck // existing issue.
TargetType string `json:"TargetType"`
AssociationType string `json:"AssociationType"`
UpdatedAt string `json:"UpdatedAt"`
AssociationStatus string `json:"AssociationStatus"`
AssociationStatusMessage string `json:"AssociationStatusMessage"`
}
ConfigurationPolicyAssociation represents an association between a policy and a target.
type ConnectorV2 ¶
type ConnectorV2 struct {
Provider map[string]any `json:"Provider"`
Tags map[string]string `json:"Tags"`
ConnectorId string `json:"ConnectorId"` //nolint:revive,staticcheck // existing issue.
ConnectorArn string `json:"ConnectorArn"`
Name string `json:"Name"`
Description string `json:"Description"`
CreatedAt string `json:"CreatedAt"`
UpdatedAt string `json:"UpdatedAt"`
ConnectorStatus string `json:"ConnectorStatus"`
}
ConnectorV2 represents a Security Hub V2 connector.
type CspmConnector ¶ added in v1.2.0
type CspmConnector struct {
Provider map[string]any `json:"Provider"`
Tags map[string]string `json:"Tags"`
ConnectorId string `json:"ConnectorId"` //nolint:revive,staticcheck // existing issue.
ConnectorArn string `json:"ConnectorArn"`
Name string `json:"Name"`
Description string `json:"Description"`
CreatedAt string `json:"CreatedAt"`
LastUpdatedAt string `json:"LastUpdatedAt"`
CreatedBy string `json:"CreatedBy"`
EnablementStatus string `json:"EnablementStatus"`
// ConnectorStatus/HealthMessage/HealthCheckedAt make up the connector's
// health check (types.CspmHealthCheck) -- kept as flat fields here rather
// than a nested struct since nothing else needs to address them as a unit.
ConnectorStatus string `json:"ConnectorStatus"`
HealthMessage string `json:"HealthMessage"`
HealthCheckedAt string `json:"HealthCheckedAt"`
ProviderName string `json:"ProviderName"`
}
CspmConnector represents a Security Hub CSPM connector to a third-party cloud provider (currently Azure only, per the real API's CspmProviderConfiguration/CspmProviderDetail unions -- see connectors.go). Provider holds the raw tagged-union wire value (e.g. {"Azure": {AWSConfigConnectorArn, AzureRegions, ScopeConfiguration}}) exactly as sent/returned on the wire, so Get/List responses can echo it back without re-deriving the union shape.
type FindingAggregator ¶
type FindingAggregator struct {
FindingAggregatorArn string `json:"FindingAggregatorArn"`
FindingAggregationRegion string `json:"FindingAggregationRegion"`
RegionLinkingMode string `json:"RegionLinkingMode"`
Regions []string `json:"Regions"`
}
FindingAggregator represents a Security Hub finding aggregator for cross-region aggregation.
type Handler ¶
type Handler struct {
Backend StorageBackend
}
Handler handles SecurityHub HTTP requests.
func (*Handler) ChaosOperations ¶
ChaosOperations returns the operations for chaos engineering.
func (*Handler) ChaosRegions ¶
ChaosRegions returns the regions for chaos engineering.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the service name for chaos engineering.
func (*Handler) ExtractOperation ¶
ExtractOperation classifies the request into an operation name.
func (*Handler) ExtractResource ¶
ExtractResource returns the resource identifier from the request.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations returns every operation name this handler routes.
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) RouteMatcher ¶
RouteMatcher returns a function that matches SecurityHub requests by path. For /findings and /tags paths, uses the Authorization header to disambiguate from other services (e.g. Macie2) that share those path prefixes.
type Hub ¶
type Hub struct {
HubArn string `json:"HubArn"`
SubscribedAt string `json:"SubscribedAt"`
AutoEnableStandards string `json:"AutoEnableStandards"`
ControlFindingGenerator string `json:"ControlFindingGenerator"`
AutoEnableControls bool `json:"AutoEnableControls"`
}
Hub represents the SecurityHub configuration.
type HubV2 ¶
type HubV2 struct {
Features map[string]*HubV2Feature `json:"Features"`
HubV2Arn string `json:"HubV2Arn"`
CreatedAt string `json:"CreatedAt"`
UpdatedAt string `json:"UpdatedAt"`
}
HubV2 represents the Security Hub V2 configuration.
type HubV2Feature ¶ added in v1.2.0
type HubV2Feature struct {
FeatureStatus string `json:"FeatureStatus"`
UpdatedAt string `json:"UpdatedAt"`
}
HubV2Feature represents one opt-in Security Hub V2 feature's enablement status (see EnableSecurityHubFeatureV2/DisableSecurityHubFeatureV2), mirroring the real SDK's types.FeatureDetail{FeatureStatus, UpdatedAt}.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend is the in-memory implementation of StorageBackend.
func NewInMemoryBackend ¶
func NewInMemoryBackend(accountID, region string) *InMemoryBackend
NewInMemoryBackend creates a new in-memory backend.
func (*InMemoryBackend) AcceptAdministratorInvitation ¶
func (b *InMemoryBackend) AcceptAdministratorInvitation(administratorID, invitationID string) error
func (*InMemoryBackend) AcceptInvitation ¶
func (b *InMemoryBackend) AcceptInvitation(masterID, invitationID string) error
func (*InMemoryBackend) AccountID ¶
func (b *InMemoryBackend) AccountID() string
func (*InMemoryBackend) BatchDeleteAutomationRules ¶
func (b *InMemoryBackend) BatchDeleteAutomationRules(automationRulesArns []string) ([]string, []map[string]any)
func (*InMemoryBackend) BatchDisableStandards ¶
func (b *InMemoryBackend) BatchDisableStandards( subscriptionArns []string, ) ([]*StandardsSubscription, []map[string]any)
func (*InMemoryBackend) BatchEnableStandards ¶
func (b *InMemoryBackend) BatchEnableStandards(requests []map[string]any) ([]*StandardsSubscription, []map[string]any)
func (*InMemoryBackend) BatchGetAutomationRules ¶
func (b *InMemoryBackend) BatchGetAutomationRules(automationRulesArns []string) ([]*AutomationRule, []map[string]any)
func (*InMemoryBackend) BatchGetConfigurationPolicyAssociations ¶
func (b *InMemoryBackend) BatchGetConfigurationPolicyAssociations( requests []map[string]any, ) ([]*ConfigurationPolicyAssociation, []map[string]any)
func (*InMemoryBackend) BatchGetSecurityControls ¶
func (b *InMemoryBackend) BatchGetSecurityControls(securityControlIDs []string) ([]*SecurityControl, []map[string]any)
func (*InMemoryBackend) BatchGetStandardsControlAssociations ¶
func (b *InMemoryBackend) BatchGetStandardsControlAssociations( requests []map[string]any, ) ([]*StandardsControlAssociation, []map[string]any)
func (*InMemoryBackend) BatchUpdateAutomationRules ¶
func (*InMemoryBackend) BatchUpdateFindings ¶
func (*InMemoryBackend) BatchUpdateFindingsV2 ¶
func (b *InMemoryBackend) BatchUpdateFindingsV2( findingIdentifiers []map[string]any, metadataUids []string, updates map[string]any, ) ([]map[string]any, []map[string]any)
BatchUpdateFindingsV2 updates findings identified either by findingIdentifiers (types.OcsfFindingIdentifier: CloudAccountUid + FindingInfoUid + MetadataProductUid) or metadataUids (a finding's metadata.uid). This backend maps CloudAccountUid/FindingInfoUid/ MetadataProductUid onto the AwsAccountId/Id/ProductArn of the same ASFF-shaped store BatchImportFindings populates -- there is no separate V2 ingestion operation in the real API, so this is the only way BatchUpdateFindingsV2 can resolve a finding in this mock.
metadataUids can never resolve: this backend has no OCSF ingestion path that would ever hand a caller a metadata.uid to reference, so every metadataUids entry is reported unprocessed (ResourceNotFoundException).
func (*InMemoryBackend) BatchUpdateStandardsControlAssociations ¶
func (*InMemoryBackend) CreateActionTarget ¶
func (b *InMemoryBackend) CreateActionTarget(name, description, id string) (string, error)
func (*InMemoryBackend) CreateAggregatorV2 ¶
func (b *InMemoryBackend) CreateAggregatorV2(regionLinkingMode string, regions []string) (*AggregatorV2, error)
func (*InMemoryBackend) CreateAutomationRule ¶
func (b *InMemoryBackend) CreateAutomationRule(rule map[string]any) (string, string)
func (*InMemoryBackend) CreateAutomationRuleV2 ¶
func (*InMemoryBackend) CreateConfigurationPolicy ¶
func (b *InMemoryBackend) CreateConfigurationPolicy( name, description string, policy map[string]any, tags map[string]string, ) (*ConfigurationPolicy, error)
func (*InMemoryBackend) CreateConnector ¶ added in v1.2.0
func (b *InMemoryBackend) CreateConnector( name, description string, provider map[string]any, tags map[string]string, ) (*CspmConnector, error)
CreateConnector creates a CSPM connector to a third-party cloud provider (currently Azure only -- the real CspmProviderConfiguration union has a single Azure member).
Unlike Connectors V2 (which has a dedicated RegisterConnectorV2 operation to complete an out-of-band OAuth-style handshake), the real CreateConnector surface has NO companion "complete authorization" operation at all. Establishing connectivity to the provider account requires a purely external, provider-side step (e.g. granting the AWSConfigConnectorArn role access in the Azure portal) that this mock has no API-observable signal for. A newly created connector is therefore left at EnablementStatus=PENDING_ENABLEMENT with health ConnectorStatus=UNKNOWN permanently -- it is never auto-advanced to CONNECTED/ENABLED, since doing so would fabricate a transition no real client-visible action caused. See PARITY.md for the documented gap this leaves (GetConnector/ListConnectors can never observe a CONNECTED connector against this backend).
func (*InMemoryBackend) CreateConnectorV2 ¶
func (b *InMemoryBackend) CreateConnectorV2( name, description string, provider map[string]any, tags map[string]string, ) (*ConnectorV2, error)
func (*InMemoryBackend) CreateFindingAggregator ¶
func (b *InMemoryBackend) CreateFindingAggregator( regionLinkingMode string, regions []string, ) (*FindingAggregator, error)
func (*InMemoryBackend) CreateInsight ¶
func (*InMemoryBackend) CreateMembers ¶
func (*InMemoryBackend) CreateTicketV2 ¶
func (b *InMemoryBackend) CreateTicketV2(connectorID, findingMetadataUID, mode string) (*TicketV2, error)
func (*InMemoryBackend) DeclineInvitations ¶
func (*InMemoryBackend) DeleteActionTarget ¶
func (b *InMemoryBackend) DeleteActionTarget(actionTargetArn string) (string, error)
func (*InMemoryBackend) DeleteAggregatorV2 ¶
func (b *InMemoryBackend) DeleteAggregatorV2(arn string) error
func (*InMemoryBackend) DeleteAutomationRuleV2 ¶
func (b *InMemoryBackend) DeleteAutomationRuleV2(identifier string) error
func (*InMemoryBackend) DeleteConfigurationPolicy ¶
func (b *InMemoryBackend) DeleteConfigurationPolicy(identifier string) error
func (*InMemoryBackend) DeleteConnector ¶ added in v1.2.0
func (b *InMemoryBackend) DeleteConnector(connectorID string) (string, error)
DeleteConnector removes a connector. The real DeleteConnectorOutput reports the connector's EnablementStatus (PENDING_DELETION -- AWS may take time to tear down the provider-side connection) rather than confirming full removal. This mock has no background worker to model that async deletion window, so the record is removed immediately, but the response still reports PENDING_DELETION for wire fidelity with the real (eventually consistent) API.
func (*InMemoryBackend) DeleteConnectorV2 ¶
func (b *InMemoryBackend) DeleteConnectorV2(connectorID string) error
func (*InMemoryBackend) DeleteFindingAggregator ¶
func (b *InMemoryBackend) DeleteFindingAggregator(arn string) error
func (*InMemoryBackend) DeleteInsight ¶
func (b *InMemoryBackend) DeleteInsight(insightArn string) (string, error)
func (*InMemoryBackend) DeleteInvitations ¶
func (*InMemoryBackend) DeleteMembers ¶
func (b *InMemoryBackend) DeleteMembers(accountIDs []string) ([]string, []map[string]any)
func (*InMemoryBackend) DescribeActionTargets ¶
func (b *InMemoryBackend) DescribeActionTargets( actionTargetArns []string, nextToken string, maxResults int, ) ([]*ActionTarget, string)
func (*InMemoryBackend) DescribeHub ¶
func (b *InMemoryBackend) DescribeHub() (*Hub, error)
func (*InMemoryBackend) DescribeOrganizationConfiguration ¶
func (b *InMemoryBackend) DescribeOrganizationConfiguration() *OrgConfig
func (*InMemoryBackend) DescribeProducts ¶
func (b *InMemoryBackend) DescribeProducts(productArn, nextToken string, maxResults int) ([]*Product, string)
func (*InMemoryBackend) DescribeProductsV2 ¶
func (b *InMemoryBackend) DescribeProductsV2(nextToken string, maxResults int) ([]*Product, string)
func (*InMemoryBackend) DescribeSecurityHubV2 ¶
func (b *InMemoryBackend) DescribeSecurityHubV2() (*HubV2, error)
func (*InMemoryBackend) DescribeStandards ¶
func (b *InMemoryBackend) DescribeStandards(nextToken string, maxResults int) ([]*Standard, string)
func (*InMemoryBackend) DescribeStandardsControls ¶
func (b *InMemoryBackend) DescribeStandardsControls( subscriptionArn, nextToken string, maxResults int, ) ([]*StandardsControl, string)
func (*InMemoryBackend) DisableHub ¶
func (b *InMemoryBackend) DisableHub() error
func (*InMemoryBackend) DisableImportFindingsForProduct ¶
func (b *InMemoryBackend) DisableImportFindingsForProduct(productSubscriptionArn string) error
func (*InMemoryBackend) DisableOrganizationAdminAccount ¶
func (b *InMemoryBackend) DisableOrganizationAdminAccount(accountID string) error
func (*InMemoryBackend) DisableSecurityHubFeatureV2 ¶ added in v1.2.0
func (b *InMemoryBackend) DisableSecurityHubFeatureV2(featureName string) error
DisableSecurityHubFeatureV2 disables an opt-in Security Hub V2 feature. Mirrors EnableSecurityHubFeatureV2's gating and idempotency: requires SecurityHub V2 to be enabled, and disabling an already-DISABLED (or never enabled) feature is a no-op success rather than an error, per the real API's documented "no changes are made" guarantee.
func (*InMemoryBackend) DisableSecurityHubV2 ¶
func (b *InMemoryBackend) DisableSecurityHubV2() error
func (*InMemoryBackend) DisassociateFromAdministratorAccount ¶
func (b *InMemoryBackend) DisassociateFromAdministratorAccount() error
func (*InMemoryBackend) DisassociateFromMasterAccount ¶
func (b *InMemoryBackend) DisassociateFromMasterAccount() error
func (*InMemoryBackend) DisassociateMembers ¶
func (b *InMemoryBackend) DisassociateMembers(accountIDs []string) error
func (*InMemoryBackend) EnableHub ¶
func (b *InMemoryBackend) EnableHub(enableDefaultStandards bool, tags map[string]string) error
func (*InMemoryBackend) EnableImportFindingsForProduct ¶
func (b *InMemoryBackend) EnableImportFindingsForProduct(productArn string) (string, error)
func (*InMemoryBackend) EnableOrganizationAdminAccount ¶
func (b *InMemoryBackend) EnableOrganizationAdminAccount(accountID string) error
func (*InMemoryBackend) EnableSecurityHubFeatureV2 ¶ added in v1.2.0
func (b *InMemoryBackend) EnableSecurityHubFeatureV2(featureName string) error
EnableSecurityHubFeatureV2 enables an opt-in Security Hub V2 feature (e.g. NETWORK_SCANNING) for the account/region. Per the real API's documented behavior that the service must be enabled before a feature can be enabled, this requires SecurityHub V2 itself to already be enabled -- there is no standalone feature-enablement state independent of the V2 hub. The operation is idempotent: re-enabling an already-ENABLED feature is a silent no-op (no UpdatedAt bump), per the real API's documented "no changes are made" guarantee.
func (*InMemoryBackend) EnableSecurityHubV2 ¶
func (b *InMemoryBackend) EnableSecurityHubV2(tags map[string]string) error
func (*InMemoryBackend) GenerateRecommendedPolicyV2 ¶
func (b *InMemoryBackend) GenerateRecommendedPolicyV2(metadataUID string) (*RecommendedPolicyV2, error)
func (*InMemoryBackend) GetAdministratorAccount ¶
func (b *InMemoryBackend) GetAdministratorAccount() (*AdminAccount, error)
func (*InMemoryBackend) GetAggregatorV2 ¶
func (b *InMemoryBackend) GetAggregatorV2(arn string) (*AggregatorV2, error)
func (*InMemoryBackend) GetAutomationRuleV2 ¶
func (b *InMemoryBackend) GetAutomationRuleV2(identifier string) (*AutomationRuleV2, error)
func (*InMemoryBackend) GetConfigurationPolicy ¶
func (b *InMemoryBackend) GetConfigurationPolicy(identifier string) (*ConfigurationPolicy, error)
func (*InMemoryBackend) GetConfigurationPolicyAssociation ¶
func (b *InMemoryBackend) GetConfigurationPolicyAssociation( targetID, targetType string, ) (*ConfigurationPolicyAssociation, error)
func (*InMemoryBackend) GetConnector ¶ added in v1.2.0
func (b *InMemoryBackend) GetConnector(connectorID string) (*CspmConnector, error)
GetConnector retrieves a connector by ID or ARN.
func (*InMemoryBackend) GetConnectorV2 ¶
func (b *InMemoryBackend) GetConnectorV2(connectorID string) (*ConnectorV2, error)
func (*InMemoryBackend) GetEnabledStandards ¶
func (b *InMemoryBackend) GetEnabledStandards( subscriptionArns []string, nextToken string, maxResults int, ) ([]*StandardsSubscription, string)
func (*InMemoryBackend) GetFindingAggregator ¶
func (b *InMemoryBackend) GetFindingAggregator(arn string) (*FindingAggregator, error)
func (*InMemoryBackend) GetFindingHistory ¶
func (*InMemoryBackend) GetFindingStatisticsV2 ¶
func (b *InMemoryBackend) GetFindingStatisticsV2(groupByFields []string) []map[string]any
func (*InMemoryBackend) GetFindings ¶
func (*InMemoryBackend) GetFindingsTrendsV2 ¶
func (b *InMemoryBackend) GetFindingsTrendsV2(startTime, endTime string) []map[string]any
GetFindingsTrendsV2 returns a single TrendsMetricsResult data point (Timestamp + TrendsValues.SeverityTrends -- securityhub@v1.75.4 types/types.go:19869-19896) aggregating every stored finding's severity. The real GetFindingsTrendsV2Input has no GroupByAttribute member at all (api_op_GetFindingsTrendsV2.go:22-46); this backend has no time-bucketed analytics engine, so unlike the real per-Granularity series this always returns one point for the whole store, timestamped at endTime.
func (*InMemoryBackend) GetFindingsV2 ¶
func (*InMemoryBackend) GetInsightResults ¶
func (b *InMemoryBackend) GetInsightResults(insightArn string) (*InsightResults, error)
func (*InMemoryBackend) GetInsights ¶
func (*InMemoryBackend) GetInvitationsCount ¶
func (b *InMemoryBackend) GetInvitationsCount() int
func (*InMemoryBackend) GetMasterAccount ¶
func (b *InMemoryBackend) GetMasterAccount() (*AdminAccount, error)
func (*InMemoryBackend) GetMembers ¶
func (b *InMemoryBackend) GetMembers(accountIDs []string) ([]*Member, []map[string]any)
func (*InMemoryBackend) GetRecommendedPolicyV2 ¶
func (b *InMemoryBackend) GetRecommendedPolicyV2(metadataUID string) (*RecommendedPolicyV2, error)
func (*InMemoryBackend) GetResourcesStatisticsV2 ¶
func (b *InMemoryBackend) GetResourcesStatisticsV2(groupByFields []string) []map[string]any
func (*InMemoryBackend) GetResourcesTrendsV2 ¶
func (b *InMemoryBackend) GetResourcesTrendsV2(startTime, endTime string) []map[string]any
GetResourcesTrendsV2 returns a single ResourcesTrendsMetricsResult data point (Timestamp + TrendsValues.ResourcesCount.AllResources -- securityhub@v1.75.4 types/types.go:18189-18203,18244-18252,18051-18059). The real GetResourcesTrendsV2Input has no GroupByAttribute member (api_op_GetResourcesTrendsV2.go:22-46); this backend has no time-bucketed analytics engine, so unlike the real per-Granularity series this always returns one point for the whole store, timestamped at endTime.
func (*InMemoryBackend) GetResourcesV2 ¶
func (*InMemoryBackend) GetSecurityControlDefinition ¶
func (b *InMemoryBackend) GetSecurityControlDefinition(securityControlID string) (*SecurityControlDefinition, error)
func (*InMemoryBackend) ImportFindings ¶
func (*InMemoryBackend) InviteMembers ¶
func (b *InMemoryBackend) InviteMembers(accountIDs []string) []map[string]any
func (*InMemoryBackend) ListAggregatorsV2 ¶
func (b *InMemoryBackend) ListAggregatorsV2(nextToken string, maxResults int) ([]*AggregatorV2, string)
func (*InMemoryBackend) ListAutomationRules ¶
func (b *InMemoryBackend) ListAutomationRules(nextToken string, maxResults int) ([]*AutomationRuleMetadata, string)
func (*InMemoryBackend) ListAutomationRulesV2 ¶
func (b *InMemoryBackend) ListAutomationRulesV2(nextToken string, maxResults int) ([]*AutomationRuleV2, string)
func (*InMemoryBackend) ListConfigurationPolicies ¶
func (b *InMemoryBackend) ListConfigurationPolicies(nextToken string, maxResults int) ([]*ConfigurationPolicy, string)
func (*InMemoryBackend) ListConfigurationPolicyAssociations ¶
func (b *InMemoryBackend) ListConfigurationPolicyAssociations( filterPolicyID, filterType, nextToken string, maxResults int, ) ([]*ConfigurationPolicyAssociation, string)
func (*InMemoryBackend) ListConnectors ¶ added in v1.2.0
func (b *InMemoryBackend) ListConnectors( connectorStatus, enablementStatus, providerName, nextToken string, maxResults int, ) ([]*CspmConnector, string)
ListConnectors lists connectors, optionally filtered by connectivity status, enablement status, and/or provider name -- the same three filters the real ListConnectorsInput exposes as query parameters.
func (*InMemoryBackend) ListConnectorsV2 ¶
func (b *InMemoryBackend) ListConnectorsV2(nextToken string, maxResults int) ([]*ConnectorV2, string)
func (*InMemoryBackend) ListEnabledProductsForImport ¶
func (b *InMemoryBackend) ListEnabledProductsForImport(nextToken string, maxResults int) ([]string, string)
func (*InMemoryBackend) ListFindingAggregators ¶
func (b *InMemoryBackend) ListFindingAggregators(nextToken string, maxResults int) ([]*FindingAggregator, string)
func (*InMemoryBackend) ListInvitations ¶
func (b *InMemoryBackend) ListInvitations(nextToken string, maxResults int) ([]*Invitation, string)
func (*InMemoryBackend) ListMembers ¶
func (*InMemoryBackend) ListOrganizationAdminAccounts ¶
func (b *InMemoryBackend) ListOrganizationAdminAccounts(nextToken string, maxResults int) ([]*OrgAdminAccount, string)
func (*InMemoryBackend) ListSecurityControlDefinitions ¶
func (b *InMemoryBackend) ListSecurityControlDefinitions( _, nextToken string, maxResults int, ) ([]*SecurityControlDefinition, string)
func (*InMemoryBackend) ListStandardsControlAssociations ¶
func (b *InMemoryBackend) ListStandardsControlAssociations( securityControlID, nextToken string, maxResults int, ) ([]*StandardsControlAssociation, string)
func (*InMemoryBackend) ListTagsForResource ¶
func (b *InMemoryBackend) ListTagsForResource(resourceArn string) (map[string]string, error)
func (*InMemoryBackend) Region ¶
func (b *InMemoryBackend) Region() string
func (*InMemoryBackend) RegisterConnectorV2 ¶
func (b *InMemoryBackend) RegisterConnectorV2(_, authState string) (*ConnectorV2, error)
RegisterConnectorV2 completes the OAuth 2.0 authorization-code flow the real RegisterConnectorV2Input carries: AuthCode and AuthState, nothing else (securityhub@v1.75.4 api_op_RegisterConnectorV2.go:26-40) -- there is no ConnectorId input member at all. AuthState's on-wire content is opaque to any real AWS client: it is minted server-side, handed back verbatim by the OAuth provider, and only this backend ever inspects it. This backend's convention is that AuthState IS the connector ID it was minted for, so decoding it back to a connector is a direct lookup rather than a guess at AWS's internal encoding. AuthCode is accepted (real clients must send it) but not persisted: nothing in ConnectorV2 models it, and no RegisterConnectorV2 output field echoes it back either.
func (*InMemoryBackend) Reset ¶
func (b *InMemoryBackend) Reset()
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
func (*InMemoryBackend) StartConfigurationPolicyAssociation ¶
func (b *InMemoryBackend) StartConfigurationPolicyAssociation( configPolicyIdentifier, targetID, targetType string, ) (*ConfigurationPolicyAssociation, error)
func (*InMemoryBackend) StartConfigurationPolicyDisassociation ¶
func (b *InMemoryBackend) StartConfigurationPolicyDisassociation( configPolicyIdentifier, targetID, targetType string, ) error
func (*InMemoryBackend) TagResource ¶
func (b *InMemoryBackend) TagResource(resourceArn string, tags map[string]string) error
func (*InMemoryBackend) TaggedResources ¶ added in v1.3.1
func (b *InMemoryBackend) TaggedResources() []TaggedEntry
TaggedResources returns every Security Hub resource ARN that currently has at least one tag applied via TagResource.
func (*InMemoryBackend) UntagResource ¶
func (b *InMemoryBackend) UntagResource(resourceArn string, tagKeys []string) error
func (*InMemoryBackend) UpdateActionTarget ¶
func (b *InMemoryBackend) UpdateActionTarget(actionTargetArn, name, description string) error
func (*InMemoryBackend) UpdateAggregatorV2 ¶
func (b *InMemoryBackend) UpdateAggregatorV2(arn, regionLinkingMode string, regions []string) (*AggregatorV2, error)
func (*InMemoryBackend) UpdateAutomationRuleV2 ¶
func (b *InMemoryBackend) UpdateAutomationRuleV2( identifier string, updates map[string]any, ) (*AutomationRuleV2, error)
func (*InMemoryBackend) UpdateConfigurationPolicy ¶
func (b *InMemoryBackend) UpdateConfigurationPolicy( identifier, name, description string, policy map[string]any, ) (*ConfigurationPolicy, error)
func (*InMemoryBackend) UpdateConnector ¶ added in v1.2.0
func (b *InMemoryBackend) UpdateConnector( connectorID, description string, provider map[string]any, ) (*CspmConnector, error)
UpdateConnector updates a connector's description and/or provider scope configuration (AzureRegions/ScopeConfiguration -- the real AzureUpdateConfiguration shape has no AWSConfigConnectorArn field, so that value is always preserved from the original CreateConnector call, merged with the new fields rather than replaced wholesale).
A configuration change requires re-validation against the provider, so the connector's EnablementStatus moves to PENDING_UPDATE. As with CreateConnector, there is no out-of-band signal this mock can observe to advance it back to ENABLED, so it is left at PENDING_UPDATE -- see CreateConnector's doc comment for the same honest-lifecycle rationale.
func (*InMemoryBackend) UpdateConnectorV2 ¶
func (b *InMemoryBackend) UpdateConnectorV2( connectorID, name, description string, provider map[string]any, ) (*ConnectorV2, error)
func (*InMemoryBackend) UpdateFindingAggregator ¶
func (b *InMemoryBackend) UpdateFindingAggregator( arn, regionLinkingMode string, regions []string, ) (*FindingAggregator, error)
func (*InMemoryBackend) UpdateFindings ¶
func (*InMemoryBackend) UpdateHubConfiguration ¶
func (b *InMemoryBackend) UpdateHubConfiguration( autoEnableControls *bool, autoEnableStandards *string, controlFindingGenerator *string, ) error
func (*InMemoryBackend) UpdateInsight ¶
func (b *InMemoryBackend) UpdateInsight(insightArn, name, groupByAttribute string, filters map[string]any) error
func (*InMemoryBackend) UpdateOrganizationConfiguration ¶
func (b *InMemoryBackend) UpdateOrganizationConfiguration( autoEnable bool, autoEnableStandards string, orgConfigType string, ) error
func (*InMemoryBackend) UpdateSecurityControl ¶
func (*InMemoryBackend) UpdateStandardsControl ¶
func (b *InMemoryBackend) UpdateStandardsControl(controlArn, controlStatus, disabledReason string) error
type Insight ¶
type Insight struct {
Filters map[string]any `json:"Filters"`
InsightArn string `json:"InsightArn"`
Name string `json:"Name"`
GroupByAttribute string `json:"GroupByAttribute"`
}
Insight represents a SecurityHub insight.
type InsightResults ¶
type InsightResults struct {
InsightArn string
GroupByAttribute string
ResultValues []map[string]any
}
InsightResults holds GetInsightResults response data.
type Invitation ¶
type Invitation struct {
AccountId string `json:"AccountId"` //nolint:revive,staticcheck // existing issue.
InvitationId string `json:"InvitationId"` //nolint:revive,staticcheck // existing issue.
InvitedAt string `json:"InvitedAt"`
MemberStatus string `json:"MemberStatus"`
}
Invitation represents a pending invitation.
type Member ¶
type Member struct {
AccountId string `json:"AccountId"` //nolint:revive,staticcheck // existing issue.
AdministratorId string `json:"AdministratorId"` //nolint:revive,staticcheck // existing issue.
MasterId string `json:"MasterId"` // deprecated alias //nolint:revive,staticcheck // existing issue.
Email string `json:"Email"`
MemberStatus string `json:"MemberStatus"`
InvitedAt string `json:"InvitedAt"`
UpdatedAt string `json:"UpdatedAt"`
}
Member represents a Security Hub member account.
type OrgAdminAccount ¶
type OrgAdminAccount struct {
AccountId string `json:"AccountId"` //nolint:revive,staticcheck // existing issue.
Status string `json:"Status"`
}
OrgAdminAccount represents an organization admin account.
type OrgConfig ¶
type OrgConfig struct {
AutoEnableStandards string `json:"AutoEnableStandards"`
OrganizationConfigurationType string `json:"OrganizationConfigurationType"`
AutoEnable bool `json:"AutoEnable"`
MemberAccountLimitReached bool `json:"MemberAccountLimitReached"`
}
OrgConfig represents the organization configuration.
type Product ¶
type Product struct {
ProductArn string
ProductName string
CompanyName string
Description string
MarketplaceURL string
ActivationURL string
ProductSubscriptionResourcePolicy string
Categories []string
IntegrationTypes []string
}
Product represents an integration product.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for AWS SecurityHub.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the SecurityHub service backend and handler.
type RecommendedPolicyV2 ¶
type RecommendedPolicyV2 struct {
MetadataUid string `json:"MetadataUid"` //nolint:revive,staticcheck // existing issue.
Policy string `json:"Policy"`
GenerationTime string `json:"GenerationTime"`
}
RecommendedPolicyV2 represents a recommended IAM policy.
type SecurityControl ¶
type SecurityControl struct {
SecurityControlID string
SecurityControlArn string
Title string
Description string
RemediationURL string
SeverityRating string
SecurityControlStatus string
UpdateStatus string
Parameters map[string]any
LastUpdateReason string
}
SecurityControl represents the current state of a security control.
type SecurityControlDefinition ¶
type SecurityControlDefinition struct {
ParameterDefinitions map[string]any
SecurityControlID string
Title string
Description string
RemediationURL string
SeverityRating string
CurrentRegionAvailability string
CustomizableProperties []string
}
SecurityControlDefinition represents a security control definition.
type Standard ¶
type Standard struct {
StandardsManagedBy map[string]any
StandardsArn string
Name string
Description string
EnabledByDefault bool
}
Standard represents an available standard.
type StandardsControl ¶
type StandardsControl struct {
StandardsControlArn string `json:"StandardsControlArn"`
ControlStatus string `json:"ControlStatus"`
DisabledReason string `json:"DisabledReason"`
ControlStatusUpdatedAt string `json:"ControlStatusUpdatedAt"`
ControlID string `json:"ControlId"`
Title string `json:"Title"`
Description string `json:"Description"`
RemediationURL string `json:"RemediationUrl"`
SeverityRating string `json:"SeverityRating"`
RelatedRequirements []string `json:"RelatedRequirements"`
}
StandardsControl represents a control in an enabled standard.
type StandardsControlAssociation ¶
type StandardsControlAssociation struct {
SecurityControlID string
StandardsArn string
AssociationStatus string
RelatedRequirements []string
UpdatedAt string
UpdatedReason string
StandardsControlTitle string
StandardsControlDescription string
StandardsControlArns []string
}
StandardsControlAssociation represents association between security control and standard.
type StandardsSubscription ¶
type StandardsSubscription struct {
StandardsInput map[string]string `json:"StandardsInput"`
StatusReason map[string]any `json:"StatusReason"`
StandardsSubscriptionArn string `json:"StandardsSubscriptionArn"`
StandardsArn string `json:"StandardsArn"`
StandardsStatus string `json:"StandardsStatus"`
}
StandardsSubscription represents an enabled standard.
type StorageBackend ¶
type StorageBackend interface {
// Hub management
EnableHub(enableDefaultStandards bool, tags map[string]string) error
DisableHub() error
DescribeHub() (*Hub, error)
UpdateHubConfiguration(autoEnableControls *bool, autoEnableStandards *string, controlFindingGenerator *string) error
// Findings
ImportFindings(findings []map[string]any) (int, int, []map[string]any)
GetFindings(
filters map[string]any,
sortCriteria []map[string]any,
nextToken string,
maxResults int,
) ([]map[string]any, string)
UpdateFindings(filters map[string]any, note map[string]any, recordState string) error
BatchUpdateFindings(
findingIdentifiers []map[string]any,
updates map[string]any,
) ([]map[string]any, []map[string]any)
GetFindingHistory(
findingIdentifier map[string]any,
startTime, endTime string,
nextToken string,
maxResults int,
) ([]map[string]any, string)
// Insights
CreateInsight(name, groupByAttribute string, filters map[string]any) (string, error)
GetInsights(insightArns []string, nextToken string, maxResults int) ([]*Insight, string, error)
UpdateInsight(insightArn, name, groupByAttribute string, filters map[string]any) error
DeleteInsight(insightArn string) (string, error)
GetInsightResults(insightArn string) (*InsightResults, error)
// Standards
BatchEnableStandards(requests []map[string]any) ([]*StandardsSubscription, []map[string]any)
BatchDisableStandards(subscriptionArns []string) ([]*StandardsSubscription, []map[string]any)
GetEnabledStandards(subscriptionArns []string, nextToken string, maxResults int) ([]*StandardsSubscription, string)
DescribeStandards(nextToken string, maxResults int) ([]*Standard, string)
DescribeStandardsControls(subscriptionArn, nextToken string, maxResults int) ([]*StandardsControl, string)
UpdateStandardsControl(controlArn, controlStatus, disabledReason string) error
ListStandardsControlAssociations(
securityControlID, nextToken string,
maxResults int,
) ([]*StandardsControlAssociation, string)
BatchGetStandardsControlAssociations(requests []map[string]any) ([]*StandardsControlAssociation, []map[string]any)
BatchUpdateStandardsControlAssociations(updates []map[string]any) ([]map[string]any, error)
// Action Targets
CreateActionTarget(name, description, id string) (string, error)
DescribeActionTargets(actionTargetArns []string, nextToken string, maxResults int) ([]*ActionTarget, string)
UpdateActionTarget(actionTargetArn, name, description string) error
DeleteActionTarget(actionTargetArn string) (string, error)
// Products
DescribeProducts(productArn, nextToken string, maxResults int) ([]*Product, string)
EnableImportFindingsForProduct(productArn string) (string, error)
DisableImportFindingsForProduct(productSubscriptionArn string) error
ListEnabledProductsForImport(nextToken string, maxResults int) ([]string, string)
// Security Controls
GetSecurityControlDefinition(securityControlID string) (*SecurityControlDefinition, error)
ListSecurityControlDefinitions(
standardsArn, nextToken string,
maxResults int,
) ([]*SecurityControlDefinition, string)
BatchGetSecurityControls(securityControlIDs []string) ([]*SecurityControl, []map[string]any)
UpdateSecurityControl(securityControlID string, parameters map[string]any, lastUpdateReason string) error
// Automation Rules
CreateAutomationRule(rule map[string]any) (string, string)
ListAutomationRules(nextToken string, maxResults int) ([]*AutomationRuleMetadata, string)
BatchGetAutomationRules(automationRulesArns []string) ([]*AutomationRule, []map[string]any)
BatchDeleteAutomationRules(automationRulesArns []string) ([]string, []map[string]any)
BatchUpdateAutomationRules(updates []map[string]any) ([]string, []map[string]any)
// Tags
TagResource(resourceArn string, tags map[string]string) error
UntagResource(resourceArn string, tagKeys []string) error
ListTagsForResource(resourceArn string) (map[string]string, error)
// Members
CreateMembers(accounts []map[string]any) ([]*Member, []map[string]any)
DeleteMembers(accountIDs []string) ([]string, []map[string]any)
GetMembers(accountIDs []string) ([]*Member, []map[string]any)
InviteMembers(accountIDs []string) []map[string]any
ListMembers(onlyAssociated bool, nextToken string, maxResults int) ([]*Member, string)
DisassociateMembers(accountIDs []string) error
// Invitations / Admin
AcceptAdministratorInvitation(administratorID, invitationID string) error
AcceptInvitation(masterID, invitationID string) error
DeclineInvitations(accountIDs []string) ([]map[string]any, []map[string]any)
DeleteInvitations(accountIDs []string) ([]map[string]any, []map[string]any)
GetInvitationsCount() int
ListInvitations(nextToken string, maxResults int) ([]*Invitation, string)
GetAdministratorAccount() (*AdminAccount, error)
GetMasterAccount() (*AdminAccount, error)
DisassociateFromAdministratorAccount() error
DisassociateFromMasterAccount() error
// Organization
DescribeOrganizationConfiguration() *OrgConfig
UpdateOrganizationConfiguration(autoEnable bool, autoEnableStandards string, orgConfigType string) error
EnableOrganizationAdminAccount(accountID string) error
DisableOrganizationAdminAccount(accountID string) error
ListOrganizationAdminAccounts(nextToken string, maxResults int) ([]*OrgAdminAccount, string)
// Finding Aggregator
CreateFindingAggregator(regionLinkingMode string, regions []string) (*FindingAggregator, error)
GetFindingAggregator(arn string) (*FindingAggregator, error)
ListFindingAggregators(nextToken string, maxResults int) ([]*FindingAggregator, string)
UpdateFindingAggregator(arn, regionLinkingMode string, regions []string) (*FindingAggregator, error)
DeleteFindingAggregator(arn string) error
// Configuration Policy
CreateConfigurationPolicy(
name, description string,
policy map[string]any,
tags map[string]string,
) (*ConfigurationPolicy, error)
GetConfigurationPolicy(identifier string) (*ConfigurationPolicy, error)
UpdateConfigurationPolicy(identifier, name, description string, policy map[string]any) (*ConfigurationPolicy, error)
DeleteConfigurationPolicy(identifier string) error
ListConfigurationPolicies(nextToken string, maxResults int) ([]*ConfigurationPolicy, string)
StartConfigurationPolicyAssociation(
configPolicyIdentifier, targetID, targetType string,
) (*ConfigurationPolicyAssociation, error)
StartConfigurationPolicyDisassociation(configPolicyIdentifier, targetID, targetType string) error
GetConfigurationPolicyAssociation(targetID, targetType string) (*ConfigurationPolicyAssociation, error)
ListConfigurationPolicyAssociations(
filterPolicyID, filterType, nextToken string,
maxResults int,
) ([]*ConfigurationPolicyAssociation, string)
BatchGetConfigurationPolicyAssociations(
requests []map[string]any,
) ([]*ConfigurationPolicyAssociation, []map[string]any)
// Hub V2
EnableSecurityHubV2(tags map[string]string) error
DisableSecurityHubV2() error
DescribeSecurityHubV2() (*HubV2, error)
EnableSecurityHubFeatureV2(featureName string) error
DisableSecurityHubFeatureV2(featureName string) error
// CSPM Connectors (third-party cloud provider connectors, distinct from
// Connectors V2's ticketing-system connectors)
CreateConnector(name, description string, provider map[string]any, tags map[string]string) (*CspmConnector, error)
GetConnector(connectorID string) (*CspmConnector, error)
UpdateConnector(connectorID, description string, provider map[string]any) (*CspmConnector, error)
DeleteConnector(connectorID string) (string, error)
ListConnectors(
connectorStatus, enablementStatus, providerName, nextToken string,
maxResults int,
) ([]*CspmConnector, string)
// Aggregator V2
CreateAggregatorV2(regionLinkingMode string, regions []string) (*AggregatorV2, error)
GetAggregatorV2(arn string) (*AggregatorV2, error)
ListAggregatorsV2(nextToken string, maxResults int) ([]*AggregatorV2, string)
UpdateAggregatorV2(arn, regionLinkingMode string, regions []string) (*AggregatorV2, error)
DeleteAggregatorV2(arn string) error
// Automation Rules V2
CreateAutomationRuleV2(
ruleName, ruleStatus, description string,
criteria map[string]any,
actions []map[string]any,
ruleOrder float64,
tags map[string]string,
) (*AutomationRuleV2, error)
GetAutomationRuleV2(identifier string) (*AutomationRuleV2, error)
ListAutomationRulesV2(nextToken string, maxResults int) ([]*AutomationRuleV2, string)
UpdateAutomationRuleV2(identifier string, updates map[string]any) (*AutomationRuleV2, error)
DeleteAutomationRuleV2(identifier string) error
// Connectors V2
CreateConnectorV2(name, description string, provider map[string]any, tags map[string]string) (*ConnectorV2, error)
GetConnectorV2(connectorID string) (*ConnectorV2, error)
ListConnectorsV2(nextToken string, maxResults int) ([]*ConnectorV2, string)
UpdateConnectorV2(connectorID, name, description string, provider map[string]any) (*ConnectorV2, error)
DeleteConnectorV2(connectorID string) error
RegisterConnectorV2(authCode, authState string) (*ConnectorV2, error)
// Tickets V2
CreateTicketV2(connectorID, findingMetadataUID, mode string) (*TicketV2, error)
// Findings V2
GetFindingsV2(
filters map[string]any,
sortCriteria []map[string]any,
nextToken string,
maxResults int,
) ([]map[string]any, string)
BatchUpdateFindingsV2(
findingIdentifiers []map[string]any,
metadataUids []string,
updates map[string]any,
) ([]map[string]any, []map[string]any)
GetFindingStatisticsV2(groupByFields []string) []map[string]any
GetFindingsTrendsV2(startTime, endTime string) []map[string]any
// Resources V2
GetResourcesV2(filters map[string]any, nextToken string, maxResults int) ([]map[string]any, string)
GetResourcesStatisticsV2(groupByFields []string) []map[string]any
GetResourcesTrendsV2(startTime, endTime string) []map[string]any
// Products V2
DescribeProductsV2(nextToken string, maxResults int) ([]*Product, string)
// Recommended Policy V2
GenerateRecommendedPolicyV2(metadataUID string) (*RecommendedPolicyV2, error)
GetRecommendedPolicyV2(metadataUID string) (*RecommendedPolicyV2, error)
// Metadata
AccountID() string
Region() string
Reset()
Snapshot(ctx context.Context) []byte
Restore(ctx context.Context, data []byte) error
}
StorageBackend is the interface for SecurityHub storage operations.
type TaggedEntry ¶ added in v1.3.1
TaggedEntry pairs a resource ARN with its tags.
type TicketV2 ¶
type TicketV2 struct {
//nolint:revive,staticcheck // matches the AWS wire field name, like ConnectorId below.
TicketId string `json:"TicketId"`
//nolint:revive,staticcheck // matches the AWS wire field name.
TicketSrcUrl string `json:"TicketSrcUrl"`
//nolint:revive,staticcheck // existing pattern in this file.
ConnectorId string `json:"ConnectorId"`
//nolint:revive,staticcheck // matches the AWS wire field name.
FindingMetadataUid string `json:"FindingMetadataUid"`
Mode string `json:"Mode"`
CreatedAt string `json:"CreatedAt"`
}
TicketV2 represents a Security Hub V2 ticket linking a third-party ITSM ticket to a finding. TicketSrcUrl is left permanently empty: the real field carries a URL into the caller's ITSM system, which this backend never integrates with, so there is no real state to populate it from.
Source Files
¶
- action_targets.go
- aggregators_v2.go
- analytics_v2.go
- automation_rules.go
- configuration_policies.go
- connectors.go
- connectors_v2.go
- controls.go
- errors.go
- finding_aggregators.go
- findings.go
- findings_v2.go
- handler.go
- handler_action_targets.go
- handler_aggregators_v2.go
- handler_automation_rules.go
- handler_configuration_policies.go
- handler_connectors.go
- handler_connectors_v2.go
- handler_controls.go
- handler_finding_aggregators.go
- handler_findings.go
- handler_hub.go
- handler_insights.go
- handler_invitations.go
- handler_members.go
- handler_organizations.go
- handler_products.go
- handler_resources_v2.go
- handler_standards.go
- handler_tags.go
- hub.go
- insights.go
- interfaces.go
- invitations.go
- members.go
- models.go
- organizations.go
- persistence.go
- products.go
- provider.go
- resources_v2.go
- standards.go
- store.go
- store_setup.go
- tags.go