Documentation
¶
Index ¶
- Constants
- Variables
- type AuthDecision
- type AuthorizationRequest
- type BatchGetPolicyItem
- type BatchGetPolicyResult
- type CognitoGroupConfig
- type CreatePolicyParams
- 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 IdentitySource
- type IdentitySourceConfig
- type InMemoryBackend
- func (b *InMemoryBackend) AccountID() string
- func (b *InMemoryBackend) AddIdentitySourceInternal(is *IdentitySource)
- func (b *InMemoryBackend) AddPolicyInternal(p *Policy)
- func (b *InMemoryBackend) AddPolicyStoreInternal(ps *PolicyStore)
- func (b *InMemoryBackend) AddPolicyTemplateInternal(pt *PolicyTemplate)
- func (b *InMemoryBackend) BatchGetPolicy(items []BatchGetPolicyItem) BatchGetPolicyResult
- func (b *InMemoryBackend) BatchIsAuthorized(policyStoreID string, requests []AuthorizationRequest) ([]AuthDecision, error)
- func (b *InMemoryBackend) BatchIsAuthorizedWithToken(policyStoreID string, requests []AuthorizationRequest) ([]AuthDecision, error)
- func (b *InMemoryBackend) CreateIdentitySource(policyStoreID, principalEntityType string, cfg IdentitySourceConfig) (*IdentitySource, error)
- func (b *InMemoryBackend) CreatePolicy(policyStoreID string, params CreatePolicyParams) (*Policy, error)
- func (b *InMemoryBackend) CreatePolicyStore(description string, tags map[string]string, ...) (*PolicyStore, error)
- func (b *InMemoryBackend) CreatePolicyTemplate(policyStoreID, description, statement string) (*PolicyTemplate, error)
- func (b *InMemoryBackend) DeleteIdentitySource(policyStoreID, identitySourceID string) error
- func (b *InMemoryBackend) DeletePolicy(policyStoreID, policyID string) error
- func (b *InMemoryBackend) DeletePolicyStore(policyStoreID string) error
- func (b *InMemoryBackend) DeletePolicyTemplate(policyStoreID, policyTemplateID string) error
- func (b *InMemoryBackend) GetIdentitySource(policyStoreID, identitySourceID string) (*IdentitySource, error)
- func (b *InMemoryBackend) GetPolicy(policyStoreID, policyID string) (*Policy, error)
- func (b *InMemoryBackend) GetPolicyStore(policyStoreID string) (*PolicyStore, error)
- func (b *InMemoryBackend) GetPolicyTemplate(policyStoreID, policyTemplateID string) (*PolicyTemplate, error)
- func (b *InMemoryBackend) GetSchema(policyStoreID string) (*PolicyStoreSchema, error)
- func (b *InMemoryBackend) IsAuthorized(policyStoreID string, req AuthorizationRequest) (*AuthDecision, error)
- func (b *InMemoryBackend) IsAuthorizedWithToken(policyStoreID string, req AuthorizationRequest) (*AuthDecision, error)
- func (b *InMemoryBackend) ListIdentitySources(policyStoreID, nextToken string, maxResults int, principalEntityTypes []string) ([]IdentitySource, string, error)
- func (b *InMemoryBackend) ListPolicies(policyStoreID string, filter ListPoliciesFilter, nextToken string, ...) ([]Policy, string, error)
- func (b *InMemoryBackend) ListPolicyStores(nextToken string, maxResults int) ([]PolicyStore, string)
- func (b *InMemoryBackend) ListPolicyTemplates(policyStoreID, nextToken string, maxResults int) ([]PolicyTemplate, string, error)
- func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)
- func (b *InMemoryBackend) PutSchema(policyStoreID, schema string) ([]string, 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) TagResource(resourceARN string, tags map[string]string) error
- func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error
- func (b *InMemoryBackend) UpdateIdentitySource(policyStoreID, identitySourceID, principalEntityType string, ...) (*IdentitySource, error)
- func (b *InMemoryBackend) UpdatePolicy(policyStoreID, policyID string, params UpdatePolicyParams) (*Policy, error)
- func (b *InMemoryBackend) UpdatePolicyStore(policyStoreID, description, validationMode, deletionProtection string) (*PolicyStore, error)
- func (b *InMemoryBackend) UpdatePolicyTemplate(policyStoreID, policyTemplateID, description, statement string) (*PolicyTemplate, error)
- type ListPoliciesFilter
- type OIDCGroupConfig
- type OIDCTokenSelection
- type Policy
- type PolicyStore
- type PolicyStoreSchema
- type PolicyTemplate
- type Provider
- type StorageBackend
- type UpdatePolicyParams
Constants ¶
const ( ValidationModeOff = "OFF" ValidationModeStrict = "STRICT" )
ValidationMode constants for policy store validation settings.
const ( DeletionProtectionEnabled = "ENABLED" DeletionProtectionDisabled = "DISABLED" )
DeletionProtection constants for policy store deletion protection.
Variables ¶
var ( // ErrPolicyStoreNotFound is returned when a policy store is not found. ErrPolicyStoreNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrPolicyNotFound is returned when a policy is not found. ErrPolicyNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrPolicyTemplateNotFound is returned when a policy template is not found. ErrPolicyTemplateNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrIdentitySourceNotFound is returned when an identity source is not found. ErrIdentitySourceNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrSchemaNotFound is returned when no schema has been set for a policy store. ErrSchemaNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrValidation is returned when input fails validation. ErrValidation = awserr.New("ValidationException", awserr.ErrInvalidParameter) // ErrConflict is returned when a resource conflict prevents an operation. ErrConflict = awserr.New("ConflictException", awserr.ErrConflict) // ErrTooManyTags is returned when TagResource would push a resource's tag // count over the 50-tag limit. Real AWS only declares TooManyTagsException // for TagResource -- CreatePolicyStore's tag-count overflow stays a plain // ValidationException (ErrValidation), per the SDK's per-op error models. ErrTooManyTags = awserr.New("TooManyTagsException", awserr.ErrInvalidParameter) )
var ErrNilAppContext = errors.New("verifiedpermissions: nil AppContext")
ErrNilAppContext is returned when a nil AppContext is passed to Init.
Functions ¶
This section is empty.
Types ¶
type AuthDecision ¶
type AuthDecision struct {
Request AuthorizationRequest `json:"request"`
Decision string `json:"decision"`
DeterminingPolicies []string `json:"determiningPolicies"`
Errors []string `json:"errors"`
}
AuthDecision is the result of a single authorization evaluation.
type AuthorizationRequest ¶
type AuthorizationRequest struct {
PrincipalEntityType string `json:"principalEntityType,omitempty"`
PrincipalEntityID string `json:"principalEntityId,omitempty"`
ActionType string `json:"actionType,omitempty"`
ActionID string `json:"actionId,omitempty"`
ResourceEntityType string `json:"resourceEntityType,omitempty"`
ResourceEntityID string `json:"resourceEntityId,omitempty"`
}
AuthorizationRequest represents a single authorization evaluation request.
type BatchGetPolicyItem ¶
type BatchGetPolicyItem struct {
PolicyStoreID string `json:"policyStoreId"`
PolicyID string `json:"policyId"`
}
BatchGetPolicyItem identifies a policy to retrieve in a batch request.
type BatchGetPolicyResult ¶
type BatchGetPolicyResult struct {
Results []Policy `json:"results"`
Errors []batchGetPolicyErrorItem `json:"errors"`
}
BatchGetPolicyResult holds the results of a BatchGetPolicy call.
type CognitoGroupConfig ¶
type CognitoGroupConfig struct {
GroupEntityType string `json:"groupEntityType,omitempty"`
}
CognitoGroupConfig holds Cognito group-to-Cedar-entity mapping configuration.
type CreatePolicyParams ¶
type CreatePolicyParams struct {
PolicyType string // "STATIC" or "TEMPLATE_LINKED"
Statement string // STATIC only
Description string // STATIC only
PolicyTemplateID string // TEMPLATE_LINKED only
PrincipalEntityType string // TEMPLATE_LINKED only
PrincipalEntityID string // TEMPLATE_LINKED only
ResourceEntityType string // TEMPLATE_LINKED only
ResourceEntityID string // TEMPLATE_LINKED only
}
CreatePolicyParams holds parameters for creating a policy.
type Handler ¶
type Handler struct {
Backend StorageBackend
// contains filtered or unexported fields
}
Handler is the Echo HTTP handler for Amazon Verified Permissions operations.
func NewHandler ¶
func NewHandler(backend StorageBackend) *Handler
NewHandler creates a new Verified Permissions handler.
func (*Handler) ChaosOperations ¶
ChaosOperations returns all operations that can be fault-injected.
func (*Handler) ChaosRegions ¶
ChaosRegions returns all regions this handler handles.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase AWS service name for fault rule matching.
func (*Handler) ExtractOperation ¶
ExtractOperation extracts the Verified Permissions action from the X-Amz-Target header.
func (*Handler) ExtractResource ¶
ExtractResource extracts the resource identifier from the request body.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations returns the list of supported Verified Permissions operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler function for Verified Permissions requests.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) RouteMatcher ¶
RouteMatcher returns a function that matches Verified Permissions API requests.
type IdentitySource ¶
type IdentitySource struct {
CreatedDate time.Time `json:"createdDate"`
LastUpdated time.Time `json:"lastUpdated"`
CognitoGroupConfig *CognitoGroupConfig `json:"cognitoGroupConfig,omitempty"`
OIDCGroupConfig *OIDCGroupConfig `json:"oidcGroupConfig,omitempty"`
OIDCTokenSelection *OIDCTokenSelection `json:"oidcTokenSelection,omitempty"`
IdentitySourceID string `json:"identitySourceId"`
PolicyStoreID string `json:"policyStoreId"`
PrincipalEntityType string `json:"principalEntityType"`
UserPoolArn string `json:"userPoolArn,omitempty"`
OpenIDIssuer string `json:"openIdIssuer,omitempty"`
EntityIDPrefix string `json:"entityIdPrefix,omitempty"`
ClientIDs []string `json:"clientIds,omitempty"`
}
IdentitySource represents an Amazon Verified Permissions identity source.
type IdentitySourceConfig ¶
type IdentitySourceConfig struct {
// Cognito
UserPoolArn string
ClientIDs []string
CognitoGroupEntityType string
// OIDC
Issuer string
EntityIDPrefix string
OIDCGroupClaim string
OIDCGroupEntityType string
// Token selection
TokenType string // "IDENTITY" or "ACCESS"
PrincipalIDClaim string
Audiences []string
}
IdentitySourceConfig holds full identity source configuration for create/update.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend is the in-memory store for Verified Permissions resources.
policyStores registers directly on b.registry, keyed by its real PolicyStoreID field. policies, policyTemplates, and identitySources were previously nested by policy store (map[string]map[string]*T); each is now a flat *store.Table keyed by the composite "policyStoreID/id" string (see policyKey/policyTemplateKey/identitySourceKey), with a companion *store.Index grouping entries by policy store for the per-store scans the nested maps used to answer directly -- the same pattern services/codeartifact uses for its region-nested maps. All three carry real, wire-visible PolicyStoreID fields, so each is a "clean" table registered directly on b.registry, no DTO wrapper needed (see persistence.go).
schemas has no wire-visible identity field at all (one schema per policy store, keyed only by the outer map's policyStoreID), so it gained a hidden policyStoreID field purely for this key; it is a "dirty" table (store.New only, deliberately NOT store.Register-ed onto b.registry) round-tripped through a DTO wrapper in persistence.go.
arnIndex is a derived cache rebuilt from the tables above on Restore, so it is never itself persisted. resourceTags, policySetCache, and policySetDirty remain plain maps: resourceTags is a non-*T value map (map[string]string) still persisted directly; policySetCache/policySetDirty are ephemeral caches that are never persisted.
func NewInMemoryBackend ¶
func NewInMemoryBackend(accountID, region string) *InMemoryBackend
NewInMemoryBackend creates a new InMemoryBackend.
func (*InMemoryBackend) AccountID ¶
func (b *InMemoryBackend) AccountID() string
AccountID returns the AWS account ID configured for this backend.
func (*InMemoryBackend) AddIdentitySourceInternal ¶
func (b *InMemoryBackend) AddIdentitySourceInternal(is *IdentitySource)
AddIdentitySourceInternal inserts a pre-built IdentitySource directly into the backend (for test seeding).
func (*InMemoryBackend) AddPolicyInternal ¶
func (b *InMemoryBackend) AddPolicyInternal(p *Policy)
AddPolicyInternal inserts a pre-built Policy directly into the backend (for test seeding).
func (*InMemoryBackend) AddPolicyStoreInternal ¶
func (b *InMemoryBackend) AddPolicyStoreInternal(ps *PolicyStore)
AddPolicyStoreInternal inserts a pre-built PolicyStore directly into the backend (for test seeding).
func (*InMemoryBackend) AddPolicyTemplateInternal ¶
func (b *InMemoryBackend) AddPolicyTemplateInternal(pt *PolicyTemplate)
AddPolicyTemplateInternal inserts a pre-built PolicyTemplate directly into the backend (for test seeding).
func (*InMemoryBackend) BatchGetPolicy ¶
func (b *InMemoryBackend) BatchGetPolicy(items []BatchGetPolicyItem) BatchGetPolicyResult
BatchGetPolicy retrieves multiple policies in a single request.
func (*InMemoryBackend) BatchIsAuthorized ¶
func (b *InMemoryBackend) BatchIsAuthorized( policyStoreID string, requests []AuthorizationRequest, ) ([]AuthDecision, error)
BatchIsAuthorized evaluates a batch of authorization requests.
func (*InMemoryBackend) BatchIsAuthorizedWithToken ¶
func (b *InMemoryBackend) BatchIsAuthorizedWithToken( policyStoreID string, requests []AuthorizationRequest, ) ([]AuthDecision, error)
BatchIsAuthorizedWithToken evaluates a batch of authorization requests using a token.
func (*InMemoryBackend) CreateIdentitySource ¶
func (b *InMemoryBackend) CreateIdentitySource( policyStoreID, principalEntityType string, cfg IdentitySourceConfig, ) (*IdentitySource, error)
CreateIdentitySource creates a new identity source in the given policy store.
func (*InMemoryBackend) CreatePolicy ¶
func (b *InMemoryBackend) CreatePolicy(policyStoreID string, params CreatePolicyParams) (*Policy, error)
CreatePolicy creates a new policy in the given policy store.
func (*InMemoryBackend) CreatePolicyStore ¶
func (b *InMemoryBackend) CreatePolicyStore( description string, tags map[string]string, validationMode, deletionProtection string, ) (*PolicyStore, error)
CreatePolicyStore creates a new policy store.
func (*InMemoryBackend) CreatePolicyTemplate ¶
func (b *InMemoryBackend) CreatePolicyTemplate(policyStoreID, description, statement string) (*PolicyTemplate, error)
CreatePolicyTemplate creates a new policy template in the given policy store.
func (*InMemoryBackend) DeleteIdentitySource ¶
func (b *InMemoryBackend) DeleteIdentitySource(policyStoreID, identitySourceID string) error
DeleteIdentitySource removes an identity source from the given policy store.
func (*InMemoryBackend) DeletePolicy ¶
func (b *InMemoryBackend) DeletePolicy(policyStoreID, policyID string) error
DeletePolicy removes a policy from the given policy store.
func (*InMemoryBackend) DeletePolicyStore ¶
func (b *InMemoryBackend) DeletePolicyStore(policyStoreID string) error
DeletePolicyStore removes a policy store and all its policies and templates.
func (*InMemoryBackend) DeletePolicyTemplate ¶
func (b *InMemoryBackend) DeletePolicyTemplate(policyStoreID, policyTemplateID string) error
DeletePolicyTemplate removes a policy template from the given policy store.
func (*InMemoryBackend) GetIdentitySource ¶
func (b *InMemoryBackend) GetIdentitySource(policyStoreID, identitySourceID string) (*IdentitySource, error)
GetIdentitySource returns the identity source with the given ID.
func (*InMemoryBackend) GetPolicy ¶
func (b *InMemoryBackend) GetPolicy(policyStoreID, policyID string) (*Policy, error)
GetPolicy returns the policy with the given ID.
func (*InMemoryBackend) GetPolicyStore ¶
func (b *InMemoryBackend) GetPolicyStore(policyStoreID string) (*PolicyStore, error)
GetPolicyStore returns the policy store with the given ID.
func (*InMemoryBackend) GetPolicyTemplate ¶
func (b *InMemoryBackend) GetPolicyTemplate(policyStoreID, policyTemplateID string) (*PolicyTemplate, error)
GetPolicyTemplate returns the policy template with the given ID.
func (*InMemoryBackend) GetSchema ¶
func (b *InMemoryBackend) GetSchema(policyStoreID string) (*PolicyStoreSchema, error)
GetSchema returns the schema for a policy store.
func (*InMemoryBackend) IsAuthorized ¶
func (b *InMemoryBackend) IsAuthorized(policyStoreID string, req AuthorizationRequest) (*AuthDecision, error)
IsAuthorized evaluates a single authorization request against stored Cedar policies.
func (*InMemoryBackend) IsAuthorizedWithToken ¶
func (b *InMemoryBackend) IsAuthorizedWithToken( policyStoreID string, req AuthorizationRequest, ) (*AuthDecision, error)
IsAuthorizedWithToken evaluates a single authorization request using a token.
func (*InMemoryBackend) ListIdentitySources ¶
func (b *InMemoryBackend) ListIdentitySources( policyStoreID, nextToken string, maxResults int, principalEntityTypes []string, ) ([]IdentitySource, string, error)
ListIdentitySources returns all identity sources for a policy store sorted by creation date. principalEntityTypes mirrors the wire "filters" list (each element's principalEntityType); when non-empty, only identity sources whose PrincipalEntityType matches one of them are returned (an OR across filters, matching AWS's ListIdentitySourcesInput.Filters semantics).
func (*InMemoryBackend) ListPolicies ¶
func (b *InMemoryBackend) ListPolicies( policyStoreID string, filter ListPoliciesFilter, nextToken string, maxResults int, ) ([]Policy, string, error)
ListPolicies returns policies in a policy store, with optional filter and pagination.
func (*InMemoryBackend) ListPolicyStores ¶
func (b *InMemoryBackend) ListPolicyStores(nextToken string, maxResults int) ([]PolicyStore, string)
ListPolicyStores returns all policy stores sorted by creation date (newest first).
func (*InMemoryBackend) ListPolicyTemplates ¶
func (b *InMemoryBackend) ListPolicyTemplates( policyStoreID, nextToken string, maxResults int, ) ([]PolicyTemplate, string, error)
ListPolicyTemplates returns all policy templates in a policy store sorted by creation date.
func (*InMemoryBackend) ListTagsForResource ¶
func (b *InMemoryBackend) ListTagsForResource(resourceARN string) (map[string]string, error)
ListTagsForResource returns the tags for a resource identified by its ARN. Supports policy stores, policies, policy templates, and identity sources.
func (*InMemoryBackend) PutSchema ¶
func (b *InMemoryBackend) PutSchema(policyStoreID, schema string) ([]string, error)
PutSchema creates or replaces the schema for a policy store, extracts namespaces, and returns them.
func (*InMemoryBackend) Reset ¶
func (b *InMemoryBackend) Reset()
Reset clears all policy store state.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serialises the backend state to JSON. It implements persistence.Persistable.
func (*InMemoryBackend) TagResource ¶
func (b *InMemoryBackend) TagResource(resourceARN string, tags map[string]string) error
TagResource adds or updates tags on a resource identified by its ARN. Supports policy stores, policies, policy templates, and identity sources.
func (*InMemoryBackend) UntagResource ¶
func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error
UntagResource removes tags from a resource identified by its ARN. Supports policy stores, policies, policy templates, and identity sources.
func (*InMemoryBackend) UpdateIdentitySource ¶
func (b *InMemoryBackend) UpdateIdentitySource( policyStoreID, identitySourceID, principalEntityType string, cfg IdentitySourceConfig, ) (*IdentitySource, error)
UpdateIdentitySource updates the configuration and principal entity type of an identity source.
func (*InMemoryBackend) UpdatePolicy ¶
func (b *InMemoryBackend) UpdatePolicy(policyStoreID, policyID string, params UpdatePolicyParams) (*Policy, error)
UpdatePolicy updates an existing policy.
func (*InMemoryBackend) UpdatePolicyStore ¶
func (b *InMemoryBackend) UpdatePolicyStore( policyStoreID, description, validationMode, deletionProtection string, ) (*PolicyStore, error)
UpdatePolicyStore updates a policy store.
func (*InMemoryBackend) UpdatePolicyTemplate ¶
func (b *InMemoryBackend) UpdatePolicyTemplate( policyStoreID, policyTemplateID, description, statement string, ) (*PolicyTemplate, error)
UpdatePolicyTemplate updates the description and statement of a policy template.
type ListPoliciesFilter ¶
type ListPoliciesFilter struct {
PolicyType string
PolicyTemplateID string
PrincipalEntityType string
PrincipalEntityID string
ResourceEntityType string
ResourceEntityID string
PrincipalUnspecified bool
ResourceUnspecified bool
}
ListPoliciesFilter holds filter params for ListPolicies. PrincipalUnspecified / ResourceUnspecified mirror the wire filter's EntityReference "unspecified" variant: when set, only policies with no principal/resource scope match.
type OIDCGroupConfig ¶
type OIDCGroupConfig struct {
GroupClaim string `json:"groupClaim,omitempty"`
GroupEntityType string `json:"groupEntityType,omitempty"`
}
OIDCGroupConfig holds OIDC group claim to Cedar entity mapping configuration.
type OIDCTokenSelection ¶
type OIDCTokenSelection struct {
TokenType string `json:"tokenType,omitempty"` // IDENTITY | ACCESS
PrincipalIDClaim string `json:"principalIdClaim,omitempty"`
Audiences []string `json:"audiences,omitempty"`
}
OIDCTokenSelection holds configuration for which OIDC token to use for authorization.
type Policy ¶
type Policy struct {
CreatedDate time.Time `json:"createdDate"`
LastUpdated time.Time `json:"lastUpdated"`
PolicyStoreID string `json:"policyStoreID"`
PolicyID string `json:"policyID"`
PolicyType string `json:"policyType"` // STATIC | TEMPLATE_LINKED
Statement string `json:"statement"`
Description string `json:"description,omitempty"`
PolicyTemplateID string `json:"policyTemplateID,omitempty"`
PrincipalEntityType string `json:"principalEntityType,omitempty"`
PrincipalEntityID string `json:"principalEntityID,omitempty"`
ResourceEntityType string `json:"resourceEntityType,omitempty"`
ResourceEntityID string `json:"resourceEntityID,omitempty"`
}
Policy represents a policy in a Verified Permissions policy store.
type PolicyStore ¶
type PolicyStore struct {
CreatedDate time.Time `json:"createdDate"`
LastUpdated time.Time `json:"lastUpdated"`
Tags map[string]string `json:"tags,omitempty"`
PolicyStoreID string `json:"policyStoreID"`
Arn string `json:"arn"`
Description string `json:"description"`
AccountID string `json:"accountID"`
Region string `json:"region"`
ValidationMode string `json:"validationMode"`
DeletionProtection string `json:"deletionProtection"`
}
PolicyStore represents an Amazon Verified Permissions policy store.
type PolicyStoreSchema ¶
type PolicyStoreSchema struct {
CreatedDate time.Time `json:"createdDate"`
LastUpdated time.Time `json:"lastUpdated"`
Schema string `json:"schema"`
Namespaces []string `json:"namespaces,omitempty"`
// contains filtered or unexported fields
}
PolicyStoreSchema holds the Cedar schema for a policy store.
type PolicyTemplate ¶
type PolicyTemplate struct {
CreatedDate time.Time `json:"createdDate"`
LastUpdated time.Time `json:"lastUpdated"`
PolicyStoreID string `json:"policyStoreID"`
PolicyTemplateID string `json:"policyTemplateID"`
Description string `json:"description"`
Statement string `json:"statement"`
}
PolicyTemplate represents a policy template in a Verified Permissions policy store.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for Amazon Verified Permissions.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the Verified Permissions service backend and handler.
type StorageBackend ¶
type StorageBackend interface {
AccountID() string
CreatePolicyStore(
description string,
tags map[string]string,
validationMode, deletionProtection string,
) (*PolicyStore, error)
GetPolicyStore(policyStoreID string) (*PolicyStore, error)
ListPolicyStores(nextToken string, maxResults int) ([]PolicyStore, string)
UpdatePolicyStore(policyStoreID, description, validationMode, deletionProtection string) (*PolicyStore, error)
DeletePolicyStore(policyStoreID string) error
CreatePolicy(policyStoreID string, params CreatePolicyParams) (*Policy, error)
GetPolicy(policyStoreID, policyID string) (*Policy, error)
ListPolicies(
policyStoreID string,
filter ListPoliciesFilter,
nextToken string,
maxResults int,
) ([]Policy, string, error)
UpdatePolicy(policyStoreID, policyID string, params UpdatePolicyParams) (*Policy, error)
DeletePolicy(policyStoreID, policyID string) error
CreatePolicyTemplate(policyStoreID, description, statement string) (*PolicyTemplate, error)
GetPolicyTemplate(policyStoreID, policyTemplateID string) (*PolicyTemplate, error)
ListPolicyTemplates(policyStoreID, nextToken string, maxResults int) ([]PolicyTemplate, string, error)
UpdatePolicyTemplate(policyStoreID, policyTemplateID, description, statement string) (*PolicyTemplate, error)
DeletePolicyTemplate(policyStoreID, policyTemplateID string) error
Reset()
TagResource(resourceARN string, tags map[string]string) error
UntagResource(resourceARN string, tagKeys []string) error
ListTagsForResource(resourceARN string) (map[string]string, error)
IsAuthorized(policyStoreID string, req AuthorizationRequest) (*AuthDecision, error)
IsAuthorizedWithToken(policyStoreID string, req AuthorizationRequest) (*AuthDecision, error)
BatchGetPolicy(items []BatchGetPolicyItem) BatchGetPolicyResult
BatchIsAuthorized(policyStoreID string, requests []AuthorizationRequest) ([]AuthDecision, error)
BatchIsAuthorizedWithToken(policyStoreID string, requests []AuthorizationRequest) ([]AuthDecision, error)
CreateIdentitySource(policyStoreID, principalEntityType string, cfg IdentitySourceConfig) (*IdentitySource, error)
GetIdentitySource(policyStoreID, identitySourceID string) (*IdentitySource, error)
DeleteIdentitySource(policyStoreID, identitySourceID string) error
ListIdentitySources(
policyStoreID, nextToken string,
maxResults int,
principalEntityTypes []string,
) ([]IdentitySource, string, error)
UpdateIdentitySource(
policyStoreID, identitySourceID, principalEntityType string,
cfg IdentitySourceConfig,
) (*IdentitySource, error)
PutSchema(policyStoreID, schema string) ([]string, error)
GetSchema(policyStoreID string) (*PolicyStoreSchema, error)
Snapshot(ctx context.Context) []byte
Restore(ctx context.Context, data []byte) error
}
StorageBackend is the interface for Verified Permissions storage operations.
type UpdatePolicyParams ¶
type UpdatePolicyParams struct {
// For STATIC updates:
Statement string
Description string
// For TEMPLATE_LINKED principal/resource updates (template id is immutable):
PrincipalEntityType string
PrincipalEntityID string
ResourceEntityType string
ResourceEntityID string
}
UpdatePolicyParams holds parameters for updating a policy.
Source Files
¶
- authorization.go
- errors.go
- handler.go
- handler_authorization.go
- handler_identity_sources.go
- handler_policies.go
- handler_policy_stores.go
- handler_policy_templates.go
- handler_schema.go
- handler_tags.go
- identity_sources.go
- interfaces.go
- models.go
- persistence.go
- policies.go
- policy_stores.go
- policy_templates.go
- provider.go
- schema.go
- store.go
- store_setup.go
- tags.go