Documentation
¶
Index ¶
- Variables
- type Handler
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Snapshot(ctx context.Context) []byte
- type InMemoryBackend
- func (b *InMemoryBackend) AcceptResourceShareInvitation(invitationARN string) (*ResourceShareInvitation, error)
- func (b *InMemoryBackend) AccountID() string
- func (b *InMemoryBackend) AddInvitationInternal(inv *ResourceShareInvitation)
- func (b *InMemoryBackend) AddPermissionInternal(p *Permission)
- func (b *InMemoryBackend) AddResourceShareInternal(rs *ResourceShare)
- func (b *InMemoryBackend) AssociateResourceShare(shareARN string, principals, resourceARNs []string) ([]*ResourceShareAssociation, error)
- func (b *InMemoryBackend) AssociateResourceSharePermission(shareARN, permissionARN string, replace bool, permissionVersion *int32) error
- func (b *InMemoryBackend) AutoAssociateDefaultPermissions(shareARN string) error
- func (b *InMemoryBackend) CreateInvitation(shareARN, shareNm, senderAcctID, receiverAcctID string) *ResourceShareInvitation
- func (b *InMemoryBackend) CreatePermission(name, resourceType, policyTemplate string, tags map[string]string) (*Permission, error)
- func (b *InMemoryBackend) CreatePermissionVersion(permissionARN, policyTemplate string) (*Permission, error)
- func (b *InMemoryBackend) CreateResourceShare(name string, allowExternalPrincipals bool, tags map[string]string, ...) (*ResourceShare, error)
- func (b *InMemoryBackend) DeletePermission(permissionARN string) error
- func (b *InMemoryBackend) DeletePermissionVersion(permissionARN string, permissionVersion int32) error
- func (b *InMemoryBackend) DeleteResourceShare(shareARN string) error
- func (b *InMemoryBackend) DisassociateResourceShare(shareARN string, principals, resourceARNs []string) ([]*ResourceShareAssociation, error)
- func (b *InMemoryBackend) DisassociateResourceSharePermission(shareARN, permissionARN string) error
- func (b *InMemoryBackend) GetPermission(permissionARN string, permissionVersion *int32) (*Permission, *PermissionVersion, error)
- func (b *InMemoryBackend) GetResourcePolicies(resourceARNs []string) []string
- func (b *InMemoryBackend) GetResourceShare(shareARN string) (*ResourceShare, error)
- func (b *InMemoryBackend) GetResourceShareAssociations(associationType string, shareARNs []string) []*ResourceShareAssociation
- func (b *InMemoryBackend) GetResourceShareInvitations(invitationARNs, shareARNs []string) []*ResourceShareInvitation
- func (b *InMemoryBackend) ListPendingInvitationResources(invitationARN string) ([]*ResourceShareAssociation, error)
- func (b *InMemoryBackend) ListPermissionAssociations(permissionARN string) []SharePermissionAssociation
- func (b *InMemoryBackend) ListPermissionVersions(permissionARN string) ([]*PermissionVersion, error)
- func (b *InMemoryBackend) ListPermissions(resourceType string) []*Permission
- func (b *InMemoryBackend) ListPrincipals(resourceOwner, shareARN string) []*ResourceShareAssociation
- func (b *InMemoryBackend) ListReplacePermissionAssociationsWork(workIDs []string, status string) []*ReplacePermissionAssociationsWork
- func (b *InMemoryBackend) ListResourceSharePermissions(shareARN string) []*ResourceSharePermissionDetail
- func (b *InMemoryBackend) ListResourceShares(resourceOwner, status string) []*ResourceShare
- func (b *InMemoryBackend) ListResources(resourceOwner, shareARN, resourceType string) []*ResourceShareAssociation
- func (b *InMemoryBackend) ListTagsForResource(shareARN string) (map[string]string, error)
- func (b *InMemoryBackend) PromotePermissionCreatedFromPolicy(permissionARN string, name string) (*Permission, error)
- func (b *InMemoryBackend) PromoteResourceShareCreatedFromPolicy(shareARN string) (*ResourceShare, error)
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) RejectResourceShareInvitation(invitationARN string) (*ResourceShareInvitation, error)
- func (b *InMemoryBackend) ReplacePermissionAssociations(fromPermissionARN, toPermissionARN string, fromPermissionVersion *int32) (*ReplacePermissionAssociationsWork, error)
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) SetDefaultPermissionVersion(permissionARN string, version int32) (*Permission, error)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) TagResource(shareARN string, kv map[string]string) error
- func (b *InMemoryBackend) UntagResource(shareARN string, keys []string) error
- func (b *InMemoryBackend) UpdateResourceShare(shareARN, name string, allowExternalPrincipals *bool) (*ResourceShare, error)
- type Permission
- type PermissionVersion
- type Provider
- type ReplacePermissionAssociationsWork
- type ResourceShare
- type ResourceShareAssociation
- type ResourceShareInvitation
- type ResourceSharePermissionDetail
- type SharePermissionAssociation
- type StorageBackend
Constants ¶
This section is empty.
Variables ¶
var ( // ErrValidation is returned when a request contains an invalid or missing parameter. ErrValidation = awserr.New("MalformedQueryStringException", awserr.ErrInvalidParameter) // ErrNotFound is returned when a resource share does not exist. ErrNotFound = awserr.New("UnknownResourceException", awserr.ErrNotFound) // ErrAlreadyExists is returned when a resource share already exists. ErrAlreadyExists = awserr.New("ResourceShareAlreadyExistsException", awserr.ErrConflict) // ErrPermissionNotFound is returned when a permission does not exist. ErrPermissionNotFound = awserr.New("InvalidParameterException", awserr.ErrNotFound) // ErrInvitationNotFound is returned when an invitation does not exist. ErrInvitationNotFound = awserr.New( "ResourceShareInvitationArnNotFoundException", awserr.ErrNotFound, ) // ErrInvitationAlreadyAccepted is returned when accepting an already-accepted invitation. ErrInvitationAlreadyAccepted = awserr.New( "ResourceShareInvitationAlreadyAcceptedException", awserr.ErrConflict, ) // ErrInvitationAlreadyRejected is returned when accepting or rejecting an already-rejected invitation. ErrInvitationAlreadyRejected = awserr.New( "ResourceShareInvitationAlreadyRejectedException", awserr.ErrConflict, ) // ErrInvitationExpired is returned when acting on an expired invitation. ErrInvitationExpired = awserr.New( "ResourceShareInvitationExpiredException", awserr.ErrConflict, ) // ErrPermissionVersionNotFound is returned when a permission version does not exist. ErrPermissionVersionNotFound = awserr.New("InvalidParameterException", awserr.ErrNotFound) // ErrOperationNotPermitted is returned when an operation is not permitted on an AWS-managed resource. ErrOperationNotPermitted = awserr.New("OperationNotPermittedException", awserr.ErrConflict) // ErrPermissionInUse is returned when deleting a permission that is associated with active shares. ErrPermissionInUse = awserr.New("PermissionInUseException", awserr.ErrConflict) // ErrInvalidParameter is returned when a parameter value is out of the allowed range. ErrInvalidParameter = awserr.New("InvalidParameterException", awserr.ErrInvalidParameter) )
var ErrNilAppContext = errors.New("ram: nil AppContext")
ErrNilAppContext is returned when the AppContext passed to Init is nil.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
Backend StorageBackend
AccountID string
Region string
}
Handler is the HTTP handler for the AWS RAM REST API.
func NewHandler ¶
func NewHandler(backend StorageBackend) *Handler
NewHandler creates a new RAM 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 operation name from the request path.
func (*Handler) ExtractResource ¶
ExtractResource extracts the resource share ARN from the request body or query.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations returns the list of supported RAM operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler function for RAM requests.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) Reset ¶
func (h *Handler) Reset()
Reset clears all in-memory state from the backend. It is used by the POST /_gopherstack/reset endpoint for CI pipelines and rapid local development.
func (*Handler) RouteMatcher ¶
RouteMatcher returns a function that matches RAM API requests. All path-based matches are gated on the SigV4 service name to prevent routing conflicts with other services that share similar REST paths.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend is an in-memory store for AWS RAM resources.
func NewInMemoryBackend ¶
func NewInMemoryBackend(accountID, region string) *InMemoryBackend
NewInMemoryBackend creates a new in-memory RAM backend seeded with AWS-managed permissions.
func (*InMemoryBackend) AcceptResourceShareInvitation ¶
func (b *InMemoryBackend) AcceptResourceShareInvitation( invitationARN string, ) (*ResourceShareInvitation, error)
AcceptResourceShareInvitation accepts a pending resource share invitation.
func (*InMemoryBackend) AccountID ¶
func (b *InMemoryBackend) AccountID() string
func (*InMemoryBackend) AddInvitationInternal ¶
func (b *InMemoryBackend) AddInvitationInternal(inv *ResourceShareInvitation)
AddInvitationInternal adds a pre-built invitation for testing or seeding.
func (*InMemoryBackend) AddPermissionInternal ¶
func (b *InMemoryBackend) AddPermissionInternal(p *Permission)
AddPermissionInternal inserts a permission directly, bypassing validation. Useful for seeding test state.
func (*InMemoryBackend) AddResourceShareInternal ¶
func (b *InMemoryBackend) AddResourceShareInternal(rs *ResourceShare)
AddResourceShareInternal inserts a resource share directly, bypassing validation. Useful for seeding test state.
func (*InMemoryBackend) AssociateResourceShare ¶
func (b *InMemoryBackend) AssociateResourceShare( shareARN string, principals, resourceARNs []string, ) ([]*ResourceShareAssociation, error)
AssociateResourceShare associates principals or resource ARNs with a resource share. Entities already ASSOCIATED are silently skipped (idempotent), matching AWS behavior. An entity with an existing DISASSOCIATED row (produced by a prior DisassociateResourceShare) is reactivated in place -- a real re-association, since AWS keeps a single row per (share, entity) pair and transitions its status rather than accumulating duplicates. Returns deep copies of the associations that changed state so callers cannot mutate backend state.
func (*InMemoryBackend) AssociateResourceSharePermission ¶
func (b *InMemoryBackend) AssociateResourceSharePermission( shareARN, permissionARN string, replace bool, permissionVersion *int32, ) error
AssociateResourceSharePermission associates a managed permission with a resource share.
func (*InMemoryBackend) AutoAssociateDefaultPermissions ¶ added in v1.2.0
func (b *InMemoryBackend) AutoAssociateDefaultPermissions(shareARN string) error
AutoAssociateDefaultPermissions attaches the AWS-managed default permission for every resource type present in the share's active resource associations that does not already have an associated permission. Mirrors real AWS: CreateResourceShare and AssociateResourceShare automatically associate the default managed permission for each resource type included in the share when no explicit permission covers that type yet (CreateResourceShare's caller-supplied permissionArns skip this; the handler only calls this when none were supplied. AssociateResourceShare never accepts permissionArns at all, so real AWS always runs this step for it). Idempotent: calling it again after nothing changed is a no-op.
func (*InMemoryBackend) CreateInvitation ¶
func (b *InMemoryBackend) CreateInvitation( shareARN, shareNm, senderAcctID, receiverAcctID string, ) *ResourceShareInvitation
CreateInvitation creates a pending invitation for a resource share. This is a helper for the mock that mirrors what AWS does when AssociateResourceShare is called with principals.
func (*InMemoryBackend) CreatePermission ¶
func (b *InMemoryBackend) CreatePermission( name, resourceType, policyTemplate string, tags map[string]string, ) (*Permission, error)
CreatePermission creates a new customer-managed RAM permission.
func (*InMemoryBackend) CreatePermissionVersion ¶
func (b *InMemoryBackend) CreatePermissionVersion( permissionARN, policyTemplate string, ) (*Permission, error)
CreatePermissionVersion creates a new version of an existing customer-managed RAM permission.
func (*InMemoryBackend) CreateResourceShare ¶
func (b *InMemoryBackend) CreateResourceShare( name string, allowExternalPrincipals bool, tags map[string]string, principals, resourceARNs []string, ) (*ResourceShare, error)
CreateResourceShare creates a new resource share.
func (*InMemoryBackend) DeletePermission ¶
func (b *InMemoryBackend) DeletePermission(permissionARN string) error
DeletePermission soft-deletes a customer-managed RAM permission and removes it from all shares. AWS-managed permissions cannot be deleted.
func (*InMemoryBackend) DeletePermissionVersion ¶
func (b *InMemoryBackend) DeletePermissionVersion( permissionARN string, permissionVersion int32, ) error
DeletePermissionVersion deletes a specific version of a customer-managed RAM permission. The default version cannot be deleted. If the latest version is deleted, LatestVersion is updated to the next-highest remaining version.
func (*InMemoryBackend) DeleteResourceShare ¶
func (b *InMemoryBackend) DeleteResourceShare(shareARN string) error
DeleteResourceShare deletes a resource share and removes it from the store. Associations for the share are disassociated before the share is removed so that ListResources / ListPrincipals no longer return them.
func (*InMemoryBackend) DisassociateResourceShare ¶
func (b *InMemoryBackend) DisassociateResourceShare( shareARN string, principals, resourceARNs []string, ) ([]*ResourceShareAssociation, error)
DisassociateResourceShare marks principals or resource ARNs on a resource share as DISASSOCIATED. Rows are kept in place (soft-deleted), matching the same pattern DeleteResourceShare uses for every association on a deleted share -- this lets GetResourceShareAssociations(associationStatus=DISASSOCIATED) see the history, and lets a later AssociateResourceShare reactivate the row instead of accumulating duplicates (see reactivateOrCreateLocked). Only currently-ASSOCIATED rows are affected; disassociating an entity that is not currently associated is a no-op for that entity.
func (*InMemoryBackend) DisassociateResourceSharePermission ¶
func (b *InMemoryBackend) DisassociateResourceSharePermission( shareARN, permissionARN string, ) error
DisassociateResourceSharePermission removes a managed permission from a resource share. Real AWS refuses the request while any resource of the permission's resource type is still actively attached to the share, per the documented rule: you can remove a managed permission from a resource share only if there are currently no resources of the relevant resource type currently attached to the resource share.
func (*InMemoryBackend) GetPermission ¶
func (b *InMemoryBackend) GetPermission( permissionARN string, permissionVersion *int32, ) (*Permission, *PermissionVersion, error)
GetPermission returns the details of a RAM permission, optionally at a specific version.
func (*InMemoryBackend) GetResourcePolicies ¶
func (b *InMemoryBackend) GetResourcePolicies(resourceARNs []string) []string
GetResourcePolicies returns resource-based policy documents for shared resources. Only ARNs that are actively associated with a resource share receive a policy entry; ARNs not in any share are omitted, matching real AWS behaviour.
func (*InMemoryBackend) GetResourceShare ¶
func (b *InMemoryBackend) GetResourceShare(shareARN string) (*ResourceShare, error)
GetResourceShare returns a resource share by ARN.
func (*InMemoryBackend) GetResourceShareAssociations ¶
func (b *InMemoryBackend) GetResourceShareAssociations( associationType string, shareARNs []string, ) []*ResourceShareAssociation
GetResourceShareAssociations returns associations for the given resource share ARNs and type.
func (*InMemoryBackend) GetResourceShareInvitations ¶
func (b *InMemoryBackend) GetResourceShareInvitations( invitationARNs, shareARNs []string, ) []*ResourceShareInvitation
GetResourceShareInvitations returns invitations filtered by ARN or resource share ARN, sorted by creation time (oldest first) for deterministic output.
func (*InMemoryBackend) ListPendingInvitationResources ¶
func (b *InMemoryBackend) ListPendingInvitationResources( invitationARN string, ) ([]*ResourceShareAssociation, error)
ListPendingInvitationResources returns the resource associations for the resource share associated with the given invitation, filtered to resources that are in an active state.
func (*InMemoryBackend) ListPermissionAssociations ¶
func (b *InMemoryBackend) ListPermissionAssociations( permissionARN string, ) []SharePermissionAssociation
ListPermissionAssociations returns all share-permission associations filtered optionally by permissionARN, sorted by share ARN + permission ARN.
func (*InMemoryBackend) ListPermissionVersions ¶
func (b *InMemoryBackend) ListPermissionVersions( permissionARN string, ) ([]*PermissionVersion, error)
ListPermissionVersions returns all versions of a permission, sorted ascending by version number.
func (*InMemoryBackend) ListPermissions ¶
func (b *InMemoryBackend) ListPermissions(resourceType string) []*Permission
ListPermissions returns all non-deleted customer-managed permissions, optionally filtered by resource type, sorted by ARN.
func (*InMemoryBackend) ListPrincipals ¶
func (b *InMemoryBackend) ListPrincipals( resourceOwner, shareARN string, ) []*ResourceShareAssociation
ListPrincipals returns principal associations for shares, filtered by resourceOwner ("SELF" or "OTHER-ACCOUNTS") and share ARN. Sorted by associated entity.
func (*InMemoryBackend) ListReplacePermissionAssociationsWork ¶ added in v1.2.0
func (b *InMemoryBackend) ListReplacePermissionAssociationsWork( workIDs []string, status string, ) []*ReplacePermissionAssociationsWork
ListReplacePermissionAssociationsWork returns recorded ReplacePermissionAssociations background work items, optionally filtered by work ID and/or status, sorted newest-first.
func (*InMemoryBackend) ListResourceSharePermissions ¶
func (b *InMemoryBackend) ListResourceSharePermissions(shareARN string) []*ResourceSharePermissionDetail
ListResourceSharePermissions returns the permissions associated with a resource share, each paired with the version actually associated with that share (which may differ from the permission's current default version), sorted by ARN for deterministic output.
func (*InMemoryBackend) ListResourceShares ¶
func (b *InMemoryBackend) ListResourceShares(resourceOwner, status string) []*ResourceShare
ListResourceShares returns resource shares matching the given owner and optional status filter. resourceOwner must be "SELF" or "OTHER-ACCOUNTS".
- "SELF": shares owned by this account (not deleted, optionally filtered by status).
- "OTHER-ACCOUNTS": shares owned by another account where this account is a PRINCIPAL.
Pass status="" to return all matching shares, or e.g. "ACTIVE" to filter by status.
func (*InMemoryBackend) ListResources ¶
func (b *InMemoryBackend) ListResources( resourceOwner, shareARN, resourceType string, ) []*ResourceShareAssociation
ListResources returns resources (resource-type associations) for shares, filtered by resourceOwner ("SELF" or "OTHER-ACCOUNTS"), share ARN, and resource type.
func (*InMemoryBackend) ListTagsForResource ¶
func (b *InMemoryBackend) ListTagsForResource(shareARN string) (map[string]string, error)
ListTagsForResource returns tags for a resource share identified by ARN.
func (*InMemoryBackend) PromotePermissionCreatedFromPolicy ¶
func (b *InMemoryBackend) PromotePermissionCreatedFromPolicy( permissionARN string, name string, ) (*Permission, error)
PromotePermissionCreatedFromPolicy promotes a CREATED_FROM_POLICY permission to a CUSTOMER_MANAGED permission with the given name.
func (*InMemoryBackend) PromoteResourceShareCreatedFromPolicy ¶
func (b *InMemoryBackend) PromoteResourceShareCreatedFromPolicy( shareARN string, ) (*ResourceShare, error)
PromoteResourceShareCreatedFromPolicy promotes a resource share to standard feature set. In this mock, it simply returns the existing share unchanged.
func (*InMemoryBackend) Region ¶
func (b *InMemoryBackend) Region() string
Region returns the AWS region this backend is configured for.
func (*InMemoryBackend) RejectResourceShareInvitation ¶
func (b *InMemoryBackend) RejectResourceShareInvitation( invitationARN string, ) (*ResourceShareInvitation, error)
RejectResourceShareInvitation rejects a pending resource share invitation.
func (*InMemoryBackend) ReplacePermissionAssociations ¶
func (b *InMemoryBackend) ReplacePermissionAssociations( fromPermissionARN, toPermissionARN string, fromPermissionVersion *int32, ) (*ReplacePermissionAssociationsWork, error)
ReplacePermissionAssociations replaces all associations using fromPermissionARN with toPermissionARN across all resource shares. If fromPermissionVersion is non-nil, only shares currently pinned to that specific version are replaced (matching AWS's documented per-version filtering); otherwise every share using fromPermissionARN at any version is replaced. The replacement always associates toPermissionARN's current default version, matching real AWS.
This mock performs the swap synchronously, so the returned work item's Status is always the terminal COMPLETED state -- there is no separate async completion step to model. Returns the work item for ListReplacePermissionAssociationsWork lookups.
func (*InMemoryBackend) Reset ¶
func (b *InMemoryBackend) Reset()
Reset clears all in-memory state from the backend and re-seeds built-in permissions. It is used by the POST /_gopherstack/reset endpoint for CI pipelines and rapid local development.
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) SetDefaultPermissionVersion ¶
func (b *InMemoryBackend) SetDefaultPermissionVersion( permissionARN string, version int32, ) (*Permission, error)
SetDefaultPermissionVersion updates the default version of a customer-managed permission.
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(shareARN string, kv map[string]string) error
TagResource adds or updates tags on a resource share identified by ARN.
func (*InMemoryBackend) UntagResource ¶
func (b *InMemoryBackend) UntagResource(shareARN string, keys []string) error
UntagResource removes specified tag keys from a resource share.
func (*InMemoryBackend) UpdateResourceShare ¶
func (b *InMemoryBackend) UpdateResourceShare( shareARN, name string, allowExternalPrincipals *bool, ) (*ResourceShare, error)
UpdateResourceShare updates an existing resource share. If name is changed, all matching associations are updated to reflect the new name.
type Permission ¶
type Permission struct {
CreationTime time.Time `json:"creationTime"`
LastUpdatedTime time.Time `json:"lastUpdatedTime"`
Tags map[string]string `json:"tags,omitempty"`
Versions map[int32]*PermissionVersion `json:"versions"`
ARN string `json:"arn"`
Name string `json:"name"`
ResourceType string `json:"resourceType"`
PermissionType string `json:"permissionType"`
ResourceRegionScope string `json:"resourceRegionScope"`
LatestVersion int32 `json:"latestVersion"`
DefaultVersion int32 `json:"defaultVersion"`
IsResourceTypeDefault bool `json:"isResourceTypeDefault"`
Deleted bool `json:"deleted"`
}
Permission represents a managed RAM permission (AWS-managed or customer-managed).
type PermissionVersion ¶
type PermissionVersion struct {
CreationTime time.Time `json:"creationTime"`
LastUpdatedTime time.Time `json:"lastUpdatedTime"`
PolicyTemplate string `json:"policyTemplate"`
Version int32 `json:"version"`
}
PermissionVersion holds a single versioned policy document for a managed permission.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for AWS RAM.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the RAM service backend and handler.
type ReplacePermissionAssociationsWork ¶ added in v1.2.0
type ReplacePermissionAssociationsWork struct {
CreationTime time.Time
LastUpdatedTime time.Time
ID string
FromPermissionARN string
ToPermissionARN string
Status string
StatusMessage string
FromPermissionVersion int32
ToPermissionVersion int32
}
ReplacePermissionAssociationsWork tracks the background task created by a ReplacePermissionAssociations call, retrievable via ListReplacePermissionAssociationsWork. This mock performs the underlying association swap synchronously, so a work item's Status is always terminal (COMPLETED) by the time it is stored -- there is no separate async completion step to model.
type ResourceShare ¶
type ResourceShare struct {
}
ResourceShare represents an AWS RAM resource share.
type ResourceShareAssociation ¶
type ResourceShareAssociation struct {
}
ResourceShareAssociation represents a principal or resource associated with a resource share.
type ResourceShareInvitation ¶
type ResourceShareInvitation struct {
}
ResourceShareInvitation represents an invitation to access a resource share.
type ResourceSharePermissionDetail ¶
type ResourceSharePermissionDetail struct {
}
ResourceSharePermissionDetail pairs a managed permission with the specific version that is associated with a particular resource share. AWS tracks the associated version per (share, permission) pair -- AssociateResourceSharePermission can pin a non-default version -- so this must be reported per share rather than assumed to be the permission's current default version.
type SharePermissionAssociation ¶
type SharePermissionAssociation struct {
}
SharePermissionAssociation represents a share-permission link for ListPermissionAssociations.
type StorageBackend ¶
type StorageBackend interface {
CreateResourceShare(
name string,
allowExternalPrincipals bool,
tags map[string]string,
principals, resourceARNs []string,
) (*ResourceShare, error)
// AutoAssociateDefaultPermissions attaches the AWS-managed default permission for
// every resource type present in the share's active resource associations that
// does not already have an associated permission. Idempotent; safe to call after
// any resource association even when nothing needs attaching.
AutoAssociateDefaultPermissions(shareARN string) error
// Tag operations
TagResource(shareARN string, tags map[string]string) error
UntagResource(shareARN string, tagKeys []string) error
ListTagsForResource(shareARN string) (map[string]string, error)
// Permission operations
CreatePermission(name, resourceType, policyTemplate string, tags map[string]string) (*Permission, error)
CreatePermissionVersion(permissionARN, policyTemplate string) (*Permission, error)
DeletePermission(permissionARN string) error
DeletePermissionVersion(permissionARN string, permissionVersion int32) error
GetPermission(permissionARN string, permissionVersion *int32) (*Permission, *PermissionVersion, error)
// Invitation operations
ListPendingInvitationResources(invitationARN string) ([]*ResourceShareAssociation, error)
// Permission list/version/promotion operations
ListPermissions(resourceType string) []*Permission
ListPermissionVersions(permissionARN string) ([]*PermissionVersion, error)
ListPermissionAssociations(permissionARN string) []SharePermissionAssociation
SetDefaultPermissionVersion(permissionARN string, version int32) (*Permission, error)
PromotePermissionCreatedFromPolicy(permissionARN, name string) (*Permission, error)
ReplacePermissionAssociations(
fromPermissionARN, toPermissionARN string,
fromPermissionVersion *int32,
) (*ReplacePermissionAssociationsWork, error)
ListReplacePermissionAssociationsWork(workIDs []string, status string) []*ReplacePermissionAssociationsWork
// Resource and principal list operations
ListResources(resourceOwner, shareARN, resourceType string) []*ResourceShareAssociation
ListPrincipals(resourceOwner, shareARN string) []*ResourceShareAssociation
// Resource policy operations
GetResourcePolicies(resourceARNs []string) []string
// Persistence
Snapshot(ctx context.Context) []byte
Restore(ctx context.Context, data []byte) error
// Lifecycle
Reset()
AccountID() string
Region() string
}
StorageBackend defines the interface for the AWS RAM in-memory backend. All mutating methods must be safe for concurrent use.
Source Files
¶
- errors.go
- handler.go
- handler_permission_versions.go
- handler_permissions.go
- handler_principals.go
- handler_resource_shares.go
- handler_resources.go
- handler_share_associations.go
- handler_share_invitations.go
- handler_share_permissions.go
- handler_tags.go
- interfaces.go
- models.go
- permission_versions.go
- permissions.go
- persistence.go
- principals.go
- provider.go
- resource_shares.go
- resources.go
- share_associations.go
- share_invitations.go
- share_permissions.go
- store.go
- store_setup.go
- tags.go