ram

package
v1.3.0 Latest Latest
Warning

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

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

README

Resource Access Manager

Parity grade: A · SDK aws-sdk-go-v2/service/ram@v1.36.1 · last audited 2026-07-23 (e259b2f8)

Coverage

Metric Value
Operations audited 37 (37 ok)
Feature families 2 (2 ok)
Known gaps none
Deferred items 2
Resource leaks clean
Deferred
  • PromoteResourceShareCreatedFromPolicy's featureSet state machine (CREATED_FROM_POLICY -> PROMOTING_TO_STANDARD -> STANDARD) is not modeled; every share created here is already STANDARD so this hasn't caused observed drift, but if CREATED_FROM_POLICY share creation is ever added, this needs revisiting.
  • permissionSummaryObject/permissionDetailObject emit a resourceRegionScope field that does not exist on the real ResourceSharePermissionSummary/ResourceSharePermissionDetail SDK types (harmless: the restjson1 deserializer ignores unrecognized fields, confirmed by reading deserializers.go). Not removed since it's a no-op field, not a bug -- kept as a deferred note rather than a gap since nothing is missing or wrong from the client's perspective.

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
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)
)
View Source
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

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

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

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

ChaosRegions returns all regions this handler handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

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

func (*Handler) ExtractOperation

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

ExtractOperation extracts the operation name from the request path.

func (*Handler) ExtractResource

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

ExtractResource extracts the resource share ARN from the request body or query.

func (*Handler) GetSupportedOperations

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

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

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all in-memory state from the backend. It is used by the POST /_gopherstack/reset endpoint for CI pipelines and rapid local development.

func (*Handler) Restore

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

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

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

RouteMatcher returns a 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.

func (*Handler) Snapshot

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

Snapshot implements persistence.Persistable by delegating to the backend.

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

Init initializes the RAM service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

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 {
	LastUpdatedTime         time.Time         `json:"lastUpdatedTime"`
	CreationTime            time.Time         `json:"creationTime"`
	Tags                    map[string]string `json:"tags,omitempty"`
	Name                    string            `json:"name"`
	ARN                     string            `json:"arn"`
	OwningAccountID         string            `json:"owningAccountId"`
	Status                  string            `json:"status"`
	StatusMessage           string            `json:"statusMessage,omitempty"`
	AllowExternalPrincipals bool              `json:"allowExternalPrincipals"`
}

ResourceShare represents an AWS RAM resource share.

type ResourceShareAssociation

type ResourceShareAssociation struct {
	LastUpdatedTime   time.Time `json:"lastUpdatedTime"`
	CreationTime      time.Time `json:"creationTime"`
	ResourceShareARN  string    `json:"resourceShareArn"`
	ResourceShareName string    `json:"resourceShareName"`
	AssociatedEntity  string    `json:"associatedEntity"`
	AssociationType   string    `json:"associationType"`
	Status            string    `json:"status"`
	StatusMessage     string    `json:"statusMessage,omitempty"`
	External          bool      `json:"external"`
}

ResourceShareAssociation represents a principal or resource associated with a resource share.

type ResourceShareInvitation

type ResourceShareInvitation struct {
	CreationTime      time.Time `json:"creationTime"`
	LastUpdatedTime   time.Time `json:"lastUpdatedTime"`
	InvitationARN     string    `json:"invitationArn"`
	ResourceShareARN  string    `json:"resourceShareArn"`
	ResourceShareName string    `json:"resourceShareName"`
	SenderAccountID   string    `json:"senderAccountId"`
	ReceiverAccountID string    `json:"receiverAccountId"`
	Status            string    `json:"status"`
}

ResourceShareInvitation represents an invitation to access a resource share.

type ResourceSharePermissionDetail

type ResourceSharePermissionDetail struct {
	Permission *Permission
	Version    int32
}

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 {
	ShareARN      string
	PermissionARN string
	Version       int32
}

SharePermissionAssociation represents a share-permission link for ListPermissionAssociations.

type StorageBackend

type StorageBackend interface {
	// Resource share operations
	CreateResourceShare(
		name string,
		allowExternalPrincipals bool,
		tags map[string]string,
		principals, resourceARNs []string,
	) (*ResourceShare, error)
	GetResourceShare(shareARN string) (*ResourceShare, error)
	ListResourceShares(resourceOwner, status string) []*ResourceShare
	UpdateResourceShare(shareARN, name string, allowExternalPrincipals *bool) (*ResourceShare, error)
	DeleteResourceShare(shareARN string) error
	AssociateResourceShare(shareARN string, principals, resourceARNs []string) ([]*ResourceShareAssociation, error)
	DisassociateResourceShare(shareARN string, principals, resourceARNs []string) ([]*ResourceShareAssociation, error)
	GetResourceShareAssociations(assocType string, shareARNs []string) []*ResourceShareAssociation
	// 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)
	AssociateResourceSharePermission(shareARN, permissionARN string, replace bool, permissionVersion *int32) error
	DisassociateResourceSharePermission(shareARN, permissionARN string) error
	ListResourceSharePermissions(shareARN string) []*ResourceSharePermissionDetail

	// Invitation operations
	AcceptResourceShareInvitation(invitationARN string) (*ResourceShareInvitation, error)
	RejectResourceShareInvitation(invitationARN string) (*ResourceShareInvitation, error)
	GetResourceShareInvitations(invitationARNs, shareARNs []string) []*ResourceShareInvitation
	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)
	PromoteResourceShareCreatedFromPolicy(shareARN string) (*ResourceShare, 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.

Jump to

Keyboard shortcuts

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