efs

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 22 Imported by: 0

README

EFS

Parity grade: A · SDK aws-sdk-go-v2/service/efs@v1.41.12 · last audited 2026-07-12 (b949a420d182f21667bfd64382228ffe985eeab1)

Coverage

Operations audited 31 (24 ok, 1 partial, 6 other)
Feature families 9 (8 ok, 1 partial)
Known gaps 4
Deferred items 2
Resource leaks clean
Known gaps
  • DescribeReplicationConfigurations does not implement NextToken pagination (always returns the full list in one page); low priority since AWS caps replication configs at 1 per file system, so lists stay small in practice.
  • ReplicationDestination.LastReplicatedTimestamp is typed string in services/efs/backend.go but the real SDK's types.Destination.LastReplicatedTimestamp is *time.Time (epoch-seconds on the wire). Currently dormant -- CreateReplicationConfiguration never populates this field, so it's always omitted (omitempty) and never serializes incorrectly. Would need a type change (string -> time.Time, epoch marshalling) before this field is ever populated.
  • PutFileSystemPolicy returns ValidationException for malformed policy JSON; real AWS has a distinct InvalidPolicyException (HTTP 400, same status so SDK-observable behavior is unaffected, but the ErrorCode string differs). Not fixed this pass -- low blast radius since both are 400s and message-based assertions would need updating regardless.
  • FileSystemLimitExceeded / AccessPointLimitExceeded (account-level quota errors, HTTP 403) are not simulated -- no quota enforcement in the mock. Out of scope for a single-account/region mock; deferred.
Deferred
  • InvalidPolicyException vs ValidationException error-code distinction for PutFileSystemPolicy (see gaps)
  • DescribeReplicationConfigurations pagination (see gaps)

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a requested resource does not exist.
	ErrNotFound = awserr.New("FileSystemNotFound", awserr.ErrNotFound)
	// ErrAlreadyExists is returned when a resource with the same token already exists but args differ.
	ErrAlreadyExists = awserr.New("FileSystemAlreadyExists", awserr.ErrConflict)
	// ErrCreationTokenExists is returned when the same creation token with identical args is reused.
	ErrCreationTokenExists = awserr.New("FileSystemAlreadyExists", errTokenIdentical)
	// ErrMountTargetNotFound is returned when a requested mount target does not exist.
	ErrMountTargetNotFound = awserr.New("MountTargetNotFound", awserr.ErrNotFound)
	// ErrAccessPointNotFound is returned when a requested access point does not exist.
	ErrAccessPointNotFound = awserr.New("AccessPointNotFound", awserr.ErrNotFound)
	// ErrPolicyNotFound is returned when no resource policy is configured for a file system.
	ErrPolicyNotFound = awserr.New("PolicyNotFound", awserr.ErrNotFound)
	// ErrValidation is returned when input validation fails.
	ErrValidation = awserr.New("ValidationException", awserr.ErrInvalidParameter)
	// ErrFileSystemInUse is returned when attempting to delete a file system that has mount targets.
	ErrFileSystemInUse = awserr.New("FileSystemInUse", awserr.ErrConflict)
	// ErrMountTargetConflict is returned when a duplicate mount target is created in the same subnet.
	ErrMountTargetConflict = awserr.New("MountTargetConflict", awserr.ErrConflict)
	// ErrSecurityGroupLimitExceeded is returned when too many security groups are specified.
	ErrSecurityGroupLimitExceeded = awserr.New("SecurityGroupLimitExceeded", awserr.ErrConflict)
	// ErrTooManyRequests is returned when a throughput change cooldown is violated.
	ErrTooManyRequests = awserr.New("TooManyRequests", errThrottled)
)
View Source
var ErrNilAppContext = errors.New("appContext must not be nil")

ErrNilAppContext is returned when Init is called with a nil application context.

Functions

This section is empty.

Types

type AccessPoint

type AccessPoint struct {
	AccessPointID  string         `json:"accessPointId"`
	AccessPointArn string         `json:"accessPointArn"`
	FileSystemID   string         `json:"fileSystemId"`
	ClientToken    string         `json:"clientToken,omitempty"`
	Name           string         `json:"name,omitempty"`
	LifeCycleState string         `json:"lifeCycleState"`
	Tags           *tags.Tags     `json:"tags,omitempty"`
	PosixUser      *PosixUser     `json:"posixUser,omitempty"`
	RootDirectory  *RootDirectory `json:"rootDirectory,omitempty"`
	OwnerID        string         `json:"ownerId"`
	// contains filtered or unexported fields
}

AccessPoint represents an EFS access point.

The Tags field is backend-owned. Callers must treat the returned pointer as read-only; mutate tags only via TagResource.

type AccountPreferences

type AccountPreferences struct {
	ResourceIDType string `json:"ResourceIdType"`
}

AccountPreferences represents EFS account preferences.

type CreateAccessPointRequest

type CreateAccessPointRequest struct {
	Tags          map[string]string
	PosixUser     *PosixUser
	RootDirectory *RootDirectory
	FileSystemID  string
	ClientToken   string
}

CreateAccessPointRequest holds parameters for creating an EFS access point.

type CreateFileSystemRequest

type CreateFileSystemRequest struct {
	Tags                     map[string]string
	CreationToken            string
	PerformanceMode          string
	ThroughputMode           string
	KmsKeyID                 string
	AvailabilityZoneName     string
	ProvisionedThroughputMib float64
	Encrypted                bool
}

CreateFileSystemRequest holds parameters for creating an EFS file system.

type CreateMountTargetRequest

type CreateMountTargetRequest struct {
	FileSystemID   string
	SubnetID       string
	IPAddress      string
	SecurityGroups []string
}

CreateMountTargetRequest holds parameters for creating an EFS mount target.

type CreationInfo

type CreationInfo struct {
	Permissions string `json:"Permissions"`
	OwnerUID    int64  `json:"OwnerUid"`
	OwnerGID    int64  `json:"OwnerGid"`
}

CreationInfo specifies the POSIX IDs and permissions to apply to the access point's RootDirectory when it does not exist.

type FileSystem

type FileSystem struct {
	CreationTime                   time.Time  `json:"creationTime"`
	Tags                           *tags.Tags `json:"tags,omitempty"`
	LastThroughputChange           time.Time  `json:"lastThroughputChange,omitzero"`
	PerformanceMode                string     `json:"performanceMode"`
	FileSystemArn                  string     `json:"fileSystemArn"`
	CreationToken                  string     `json:"creationToken"`
	Name                           string     `json:"name,omitempty"`
	FileSystemID                   string     `json:"fileSystemId"`
	ThroughputMode                 string     `json:"throughputMode"`
	LifeCycleState                 string     `json:"lifeCycleState"`
	AccountID                      string     `json:"accountId"`
	Region                         string     `json:"region"`
	KmsKeyID                       string     `json:"kmsKeyId,omitempty"`
	AvailabilityZoneName           string     `json:"availabilityZoneName,omitempty"`
	AvailabilityZoneID             string     `json:"availabilityZoneId,omitempty"`
	ReplicationOverwriteProtection string     `json:"replicationOverwriteProtection,omitempty"`
	ProvisionedThroughputMib       float64    `json:"provisionedThroughputMib,omitempty"`
	NumberOfMountTargets           int32      `json:"numberOfMountTargets"`
	Encrypted                      bool       `json:"encrypted"`
}

FileSystem represents an EFS file system.

The Tags field is backend-owned. Callers must treat the returned pointer as read-only; mutate tags only via TagResource / CreateFileSystem.

type Handler

type Handler struct {
	Backend *InMemoryBackend
	// contains filtered or unexported fields
}

Handler is the Echo HTTP handler for AWS EFS operations (REST-JSON protocol).

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates a new EFS 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 EFS instance 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 EFS operation name from the REST path.

func (*Handler) ExtractResource

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

ExtractResource extracts the primary resource identifier from the URL path.

func (*Handler) GetSupportedOperations

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

GetSupportedOperations returns the list of supported EFS operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function for EFS 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 backend state.

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 AWS EFS REST requests.

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 the in-memory store for EFS resources.

The four resource collections below (fileSystems, mountTargets, accessPoints, replicationConfigs) were previously nested by region (outer key = region) so that same-named resources in different regions were fully isolated. Phase 3.3 flattens each into a single *store.Table[T] keyed by the composite "region|id" string (see regionKey in store_setup.go), with a companion *store.Index grouping entries by region for the old per-region scans, and -- for fileSystemsByARN/mountTargetsByARN/accessPointsByARN/ accessPointsByClientToken -- an unregistered derived-cache *store.Table (same pattern as services/ecs's taskDefByArn) providing O(1) region-scoped lookup by the resource's own ARN/ClientToken. accountPreferences is account-level state in AWS and so is not region-nested.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates a new in-memory EFS backend.

func (*InMemoryBackend) AddAccessPointInternal

func (b *InMemoryBackend) AddAccessPointInternal(ap *AccessPoint)

AddAccessPointInternal inserts a pre-built AccessPoint directly into the backend (test seed helper).

func (*InMemoryBackend) AddFileSystemInternal

func (b *InMemoryBackend) AddFileSystemInternal(fs *FileSystem)

AddFileSystemInternal inserts a pre-built FileSystem directly into the backend (test seed helper).

func (*InMemoryBackend) AddMountTargetInternal

func (b *InMemoryBackend) AddMountTargetInternal(mt *MountTarget)

AddMountTargetInternal inserts a pre-built MountTarget directly into the backend (test seed helper).

func (*InMemoryBackend) CreateAccessPoint

func (b *InMemoryBackend) CreateAccessPoint(
	ctx context.Context,
	req CreateAccessPointRequest,
) (*AccessPoint, error)

CreateAccessPoint creates an access point for a file system. Supports ClientToken idempotency.

func (*InMemoryBackend) CreateFileSystem

func (b *InMemoryBackend) CreateFileSystem(
	ctx context.Context,
	req CreateFileSystemRequest,
) (*FileSystem, error)

CreateFileSystem creates a new EFS file system.

func (*InMemoryBackend) CreateMountTarget

func (b *InMemoryBackend) CreateMountTarget(
	ctx context.Context,
	req CreateMountTargetRequest,
) (*MountTarget, error)

CreateMountTarget creates a mount target for a file system. Returns ErrMountTargetConflict if a mount target already exists in the same subnet.

func (*InMemoryBackend) CreateReplicationConfiguration

func (b *InMemoryBackend) CreateReplicationConfiguration(
	ctx context.Context,
	sourceFileSystemID string,
	destinations []ReplicationDestination,
) (*ReplicationConfiguration, error)

CreateReplicationConfiguration creates a replication configuration for a file system.

func (*InMemoryBackend) CreateTags

func (b *InMemoryBackend) CreateTags(ctx context.Context, fileSystemID string, kv map[string]string) error

CreateTags adds tags to a file system (legacy operation, delegates to TagResource).

func (*InMemoryBackend) DeleteAccessPoint

func (b *InMemoryBackend) DeleteAccessPoint(ctx context.Context, accessPointID string) error

DeleteAccessPoint deletes an access point by ID.

func (*InMemoryBackend) DeleteFileSystem

func (b *InMemoryBackend) DeleteFileSystem(ctx context.Context, fileSystemID string) error

DeleteFileSystem deletes a file system by ID. Returns ErrFileSystemInUse if any mount targets exist.

func (*InMemoryBackend) DeleteFileSystemPolicy

func (b *InMemoryBackend) DeleteFileSystemPolicy(ctx context.Context, fileSystemID string) error

DeleteFileSystemPolicy removes the resource-based policy from a file system.

func (*InMemoryBackend) DeleteMountTarget

func (b *InMemoryBackend) DeleteMountTarget(ctx context.Context, mountTargetID string) error

DeleteMountTarget deletes a mount target by ID.

func (*InMemoryBackend) DeleteReplicationConfiguration

func (b *InMemoryBackend) DeleteReplicationConfiguration(
	ctx context.Context,
	sourceFileSystemID string,
) error

DeleteReplicationConfiguration deletes the replication configuration for a file system. The destination file system (if tracked) becomes a standalone writable file system with ReplicationOverwriteProtection set to ENABLED.

func (*InMemoryBackend) DeleteTags

func (b *InMemoryBackend) DeleteTags(ctx context.Context, fileSystemID string, tagKeys []string) error

DeleteTags removes tags from a file system by key (legacy operation).

func (*InMemoryBackend) DescribeAccessPoints

func (b *InMemoryBackend) DescribeAccessPoints(
	ctx context.Context,
	fileSystemID, accessPointID, marker string, maxItems int,
) ([]*AccessPoint, string, error)

DescribeAccessPoints returns access points, optionally filtered by file system ID or access point ID.

func (*InMemoryBackend) DescribeAccountPreferences

func (b *InMemoryBackend) DescribeAccountPreferences() AccountPreferences

DescribeAccountPreferences returns the current account preferences.

func (*InMemoryBackend) DescribeBackupPolicy

func (b *InMemoryBackend) DescribeBackupPolicy(ctx context.Context, fileSystemID string) (string, error)

DescribeBackupPolicy returns the backup policy for a file system.

func (*InMemoryBackend) DescribeFileSystemPolicy

func (b *InMemoryBackend) DescribeFileSystemPolicy(ctx context.Context, fileSystemID string) (string, error)

DescribeFileSystemPolicy returns the resource-based policy for a file system.

func (*InMemoryBackend) DescribeFileSystems

func (b *InMemoryBackend) DescribeFileSystems(
	ctx context.Context,
	fileSystemID, creationToken, marker string,
	maxItems int,
) ([]*FileSystem, string, error)

DescribeFileSystems returns file systems, optionally filtered by ID or creation token, with pagination support.

func (*InMemoryBackend) DescribeLifecycleConfiguration

func (b *InMemoryBackend) DescribeLifecycleConfiguration(
	ctx context.Context,
	fileSystemID string,
) ([]LifecyclePolicy, error)

DescribeLifecycleConfiguration returns lifecycle policies for a file system.

func (*InMemoryBackend) DescribeMountTargetSecurityGroups

func (b *InMemoryBackend) DescribeMountTargetSecurityGroups(
	ctx context.Context,
	mountTargetID string,
) ([]string, error)

DescribeMountTargetSecurityGroups returns the security groups for a mount target.

func (*InMemoryBackend) DescribeMountTargets

func (b *InMemoryBackend) DescribeMountTargets(
	ctx context.Context,
	fileSystemID, mountTargetID, marker string, maxItems int,
) ([]*MountTarget, string, error)

DescribeMountTargets returns mount targets, optionally filtered by file system ID or mount target ID.

func (*InMemoryBackend) DescribeReplicationConfigurations

func (b *InMemoryBackend) DescribeReplicationConfigurations(
	ctx context.Context,
	fileSystemID string,
) ([]*ReplicationConfiguration, error)

DescribeReplicationConfigurations returns replication configurations, optionally filtered by file system ID.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(
	ctx context.Context,
	resourceID string,
) (map[string]string, error)

ListTagsForResource lists tags for a resource by ID or ARN.

func (*InMemoryBackend) ModifyMountTargetSecurityGroups

func (b *InMemoryBackend) ModifyMountTargetSecurityGroups(
	ctx context.Context,
	mountTargetID string,
	securityGroups []string,
) error

ModifyMountTargetSecurityGroups replaces the security groups for a mount target. Enforces a maximum of 5 security groups.

func (*InMemoryBackend) PutAccountPreferences

func (b *InMemoryBackend) PutAccountPreferences(resourceIDType string) (AccountPreferences, error)

PutAccountPreferences sets the account-level resource ID preference.

func (*InMemoryBackend) PutBackupPolicy

func (b *InMemoryBackend) PutBackupPolicy(ctx context.Context, fileSystemID, status string) error

PutBackupPolicy sets the backup policy status for a file system. Valid values: ENABLED, ENABLING, DISABLED, DISABLING.

func (*InMemoryBackend) PutFileSystemPolicy

func (b *InMemoryBackend) PutFileSystemPolicy(ctx context.Context, fileSystemID, policy string) error

PutFileSystemPolicy sets the resource-based policy for a file system. The policy must be valid JSON and no larger than 20 KB.

func (*InMemoryBackend) PutLifecycleConfiguration

func (b *InMemoryBackend) PutLifecycleConfiguration(
	ctx context.Context,
	fileSystemID string,
	policies []LifecyclePolicy,
) ([]LifecyclePolicy, error)

PutLifecycleConfiguration sets lifecycle policies for a file system.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the AWS region this backend is configured for.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all stored resources, returning the backend to its empty initial state.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads backend state from a JSON snapshot produced by Snapshot.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state to JSON.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(ctx context.Context, resourceID string, kv map[string]string) error

TagResource adds or updates tags on a resource (file system or access point) by ARN or ID.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(ctx context.Context, resourceID string, tagKeys []string) error

UntagResource removes tags from a resource (file system or access point) by ARN or ID.

func (*InMemoryBackend) UpdateFileSystem

func (b *InMemoryBackend) UpdateFileSystem(
	ctx context.Context,
	fileSystemID string,
	req UpdateFileSystemRequest,
) (*FileSystem, error)

UpdateFileSystem updates throughput settings for a file system. Enforces a 24-hour cooldown between throughput mode changes.

func (*InMemoryBackend) UpdateFileSystemProtection

func (b *InMemoryBackend) UpdateFileSystemProtection(
	ctx context.Context,
	fileSystemID, replicationOverwriteProtection string,
) error

UpdateFileSystemProtection sets the replication overwrite protection for a file system.

type LifecyclePolicy

type LifecyclePolicy struct {
	TransitionToIA                  string `json:"TransitionToIA,omitempty"`
	TransitionToPrimaryStorageClass string `json:"TransitionToPrimaryStorageClass,omitempty"`
	TransitionToArchive             string `json:"TransitionToArchive,omitempty"`
}

LifecyclePolicy represents an EFS lifecycle management policy.

type MountTarget

type MountTarget struct {
	MountTargetID        string   `json:"mountTargetId"`
	MountTargetArn       string   `json:"mountTargetArn"`
	FileSystemID         string   `json:"fileSystemId"`
	SubnetID             string   `json:"subnetId"`
	VpcID                string   `json:"vpcId"`
	AvailabilityZoneName string   `json:"availabilityZoneName"`
	AvailabilityZoneID   string   `json:"availabilityZoneId"`
	NetworkInterfaceID   string   `json:"networkInterfaceId"`
	IPAddress            string   `json:"ipAddress"`
	LifeCycleState       string   `json:"lifeCycleState"`
	OwnerID              string   `json:"ownerId"`
	SecurityGroups       []string `json:"securityGroups,omitempty"`
	// contains filtered or unexported fields
}

MountTarget represents an EFS mount target.

type PosixUser

type PosixUser struct {
	SecondaryGids []int64 `json:"SecondaryGids,omitempty"`
	UID           int64   `json:"Uid"`
	GID           int64   `json:"Gid"`
}

PosixUser represents the POSIX identity used for all file system operations by NFS clients using the access point.

type Provider

type Provider struct{}

Provider implements service.Provider for AWS EFS.

func (*Provider) Init

Init initializes the EFS service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type ReplicationConfiguration

type ReplicationConfiguration struct {
	OriginalSourceFileSystemARN string                   `json:"OriginalSourceFileSystemArn"`
	SourceFileSystemARN         string                   `json:"SourceFileSystemArn"`
	SourceFileSystemID          string                   `json:"SourceFileSystemId"`
	SourceFileSystemRegion      string                   `json:"SourceFileSystemRegion"`
	SourceFileSystemOwnerID     string                   `json:"SourceFileSystemOwnerId"`
	Destinations                []ReplicationDestination `json:"Destinations"`
	CreationTime                int64                    `json:"CreationTime"`
}

ReplicationConfiguration represents an EFS replication configuration.

type ReplicationDestination

type ReplicationDestination struct {
	FileSystemID            string `json:"FileSystemId,omitempty"`
	FileSystemArn           string `json:"FileSystemArn,omitempty"`
	Region                  string `json:"Region,omitempty"`
	AvailabilityZoneName    string `json:"AvailabilityZoneName,omitempty"`
	KmsKeyID                string `json:"KmsKeyID,omitempty"`
	OwnerID                 string `json:"OwnerId,omitempty"`
	LastReplicatedTimestamp string `json:"LastReplicatedTimestamp,omitempty"`
	Status                  string `json:"Status,omitempty"`
}

ReplicationDestination represents a destination in an EFS replication configuration.

type RootDirectory

type RootDirectory struct {
	CreationInfo *CreationInfo `json:"CreationInfo,omitempty"`
	Path         string        `json:"Path,omitempty"`
}

RootDirectory specifies the directory on the Amazon EFS file system that the access point provides access to.

type UpdateFileSystemRequest

type UpdateFileSystemRequest struct {
	ThroughputMode           string  `json:"ThroughputMode,omitempty"`
	ProvisionedThroughputMib float64 `json:"ProvisionedThroughputInMibps,omitempty"`
}

UpdateFileSystemRequest holds parameters for updating an EFS file system.

Jump to

Keyboard shortcuts

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