Documentation
¶
Index ¶
- Variables
- type AccessPoint
- type BucketResolver
- type CreateAccessPointInput
- type CreateFileSystemInput
- type CreateMountTargetInput
- type CreationPermissions
- type ExpirationDataRule
- type FileSystem
- 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 ImportDataRule
- type InMemoryBackend
- func (b *InMemoryBackend) CreateAccessPoint(ctx context.Context, in CreateAccessPointInput) (*AccessPoint, bool, error)
- func (b *InMemoryBackend) CreateFileSystem(ctx context.Context, in CreateFileSystemInput) (*FileSystem, bool, error)
- func (b *InMemoryBackend) CreateMountTarget(ctx context.Context, in CreateMountTargetInput) (*MountTarget, error)
- func (b *InMemoryBackend) DeleteAccessPoint(ctx context.Context, ref string) error
- func (b *InMemoryBackend) DeleteFileSystem(ctx context.Context, ref string, _ bool) error
- func (b *InMemoryBackend) DeleteFileSystemPolicy(ctx context.Context, ref string) error
- func (b *InMemoryBackend) DeleteMountTarget(ctx context.Context, id string) error
- func (b *InMemoryBackend) GetAccessPoint(ctx context.Context, ref string) (*AccessPoint, error)
- func (b *InMemoryBackend) GetFileSystem(ctx context.Context, ref string) (*FileSystem, error)
- func (b *InMemoryBackend) GetFileSystemPolicy(ctx context.Context, ref string) (string, string, error)
- func (b *InMemoryBackend) GetMountTarget(ctx context.Context, id string) (*MountTarget, error)
- func (b *InMemoryBackend) GetSynchronizationConfiguration(ctx context.Context, ref string) (*SyncConfiguration, error)
- func (b *InMemoryBackend) ListAccessPoints(ctx context.Context, fileSystemRef string, maxResults int, token string) (page.Page[*AccessPoint], error)
- func (b *InMemoryBackend) ListFileSystems(ctx context.Context, bucket string, maxResults int, token string) (page.Page[*FileSystem], error)
- func (b *InMemoryBackend) ListMountTargets(ctx context.Context, fileSystemRef, accessPointRef string, maxResults int, ...) (page.Page[*MountTarget], error)
- func (b *InMemoryBackend) ListTagsForResource(ctx context.Context, ref string, maxResults int, token string) (page.Page[KV], error)
- func (b *InMemoryBackend) PutFileSystemPolicy(ctx context.Context, ref, policy string) error
- func (b *InMemoryBackend) PutSynchronizationConfiguration(ctx context.Context, ref string, in PutSyncInput) error
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) SetBucketResolver(r BucketResolver)
- func (b *InMemoryBackend) SetClock(now func() time.Time)
- func (b *InMemoryBackend) SetLifecycleDelay(d time.Duration)
- func (b *InMemoryBackend) SetSubnetResolver(r SubnetResolver)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) TagResource(ctx context.Context, ref string, add map[string]string) error
- func (b *InMemoryBackend) UntagResource(ctx context.Context, ref string, keys []string) error
- func (b *InMemoryBackend) UpdateMountTarget(ctx context.Context, id string, sgs []string) (*MountTarget, error)
- type KV
- type Lifecycle
- type MountTarget
- type PosixUser
- type Provider
- type PutSyncInput
- type RootDirectory
- type SubnetInfo
- type SubnetResolver
- type SyncConfiguration
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned when a file system, mount target, access point or policy does not exist. ErrNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrConflict is returned when the request conflicts with the resource's current state. ErrConflict = awserr.New("ConflictException", awserr.ErrConflict) // ErrValidation is returned for malformed or out-of-range input. ErrValidation = awserr.New("ValidationException", awserr.ErrInvalidParameter) )
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 {
Tags map[string]string `json:"tags,omitempty"`
PosixUser *PosixUser `json:"posixUser,omitempty"`
RootDirectory *RootDirectory `json:"rootDirectory,omitempty"`
ID string `json:"id"`
ARN string `json:"arn"`
FileSystemID string `json:"fileSystemId"`
ClientToken string `json:"clientToken,omitempty"`
OwnerID string `json:"ownerId"`
Region string `json:"region"`
Lifecycle
}
AccessPoint is an application-specific entry point into a file system.
type BucketResolver ¶
BucketResolver checks that an S3 bucket exists in the emulated S3 service.
type CreateAccessPointInput ¶
type CreateAccessPointInput struct {
Tags map[string]string
PosixUser *PosixUser
RootDirectory *RootDirectory
FileSystemID string
ClientToken string
}
CreateAccessPointInput is the backend form of CreateAccessPoint.
type CreateFileSystemInput ¶
type CreateFileSystemInput struct {
Tags map[string]string
Bucket string
RoleARN string
ClientToken string
KMSKeyID string
Prefix string
}
CreateFileSystemInput is the backend form of CreateFileSystem.
type CreateMountTargetInput ¶
type CreateMountTargetInput struct {
FileSystemID string
SubnetID string
IPAddressType string
IPv4Address string
IPv6Address string
SecurityGroups []string
}
CreateMountTargetInput is the backend form of CreateMountTarget.
type CreationPermissions ¶
type CreationPermissions struct {
OwnerUID *int64 `json:"ownerUid"`
OwnerGID *int64 `json:"ownerGid"`
Permissions *string `json:"permissions"`
}
CreationPermissions are applied to a newly created root directory.
type ExpirationDataRule ¶
type ExpirationDataRule struct {
DaysAfterLastAccess *int32 `json:"daysAfterLastAccess"`
}
ExpirationDataRule controls when cached data expires from a file system.
type FileSystem ¶
type FileSystem struct {
Tags map[string]string `json:"tags,omitempty"`
Sync *SyncConfiguration `json:"sync,omitempty"`
ID string `json:"id"`
ARN string `json:"arn"`
Bucket string `json:"bucket"`
Prefix string `json:"prefix,omitempty"`
RoleARN string `json:"roleArn"`
KMSKeyID string `json:"kmsKeyId,omitempty"`
ClientToken string `json:"clientToken,omitempty"`
OwnerID string `json:"ownerId"`
Region string `json:"region"`
Policy string `json:"policy,omitempty"`
Lifecycle
}
FileSystem is an S3 file system scoped to a bucket or prefix.
type Handler ¶
type Handler struct {
Backend *InMemoryBackend
// contains filtered or unexported fields
}
Handler is the Echo handler for the S3 Files REST-JSON API.
func NewHandler ¶
func NewHandler(backend *InMemoryBackend) *Handler
NewHandler creates a handler over backend.
func (*Handler) ChaosOperations ¶
ChaosOperations lists the fault-injectable operations.
func (*Handler) ChaosRegions ¶
ChaosRegions lists the regions served.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase service name for fault rules.
func (*Handler) ExtractOperation ¶
ExtractOperation returns the operation name for the request.
func (*Handler) ExtractResource ¶
ExtractResource returns the primary resource identifier for the request.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations lists the implemented operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler function.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) RouteMatcher ¶
RouteMatcher matches requests signed for s3files. Its paths (/file-systems, /access-points, ...) carry no service prefix, so the SigV4 signing name or the s3files endpoint host is the discriminator.
type ImportDataRule ¶
type ImportDataRule struct {
Prefix *string `json:"prefix"`
SizeLessThan *int64 `json:"sizeLessThan"`
Trigger string `json:"trigger"`
}
ImportDataRule controls how S3 data is imported into a file system.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend is the in-memory S3 Files backend. One coarse lock guards all tables.
func NewInMemoryBackend ¶
func NewInMemoryBackend(accountID, region string) *InMemoryBackend
NewInMemoryBackend creates an empty backend.
func (*InMemoryBackend) CreateAccessPoint ¶
func (b *InMemoryBackend) CreateAccessPoint( ctx context.Context, in CreateAccessPointInput, ) (*AccessPoint, bool, error)
CreateAccessPoint creates an access point; created is false for an idempotent replay.
func (*InMemoryBackend) CreateFileSystem ¶
func (b *InMemoryBackend) CreateFileSystem( ctx context.Context, in CreateFileSystemInput, ) (*FileSystem, bool, error)
CreateFileSystem creates a file system on an S3 bucket; created is false for an idempotent replay.
func (*InMemoryBackend) CreateMountTarget ¶
func (b *InMemoryBackend) CreateMountTarget(ctx context.Context, in CreateMountTargetInput) (*MountTarget, error)
CreateMountTarget creates a mount target for an available file system.
func (*InMemoryBackend) DeleteAccessPoint ¶
func (b *InMemoryBackend) DeleteAccessPoint(ctx context.Context, ref string) error
DeleteAccessPoint deletes an access point.
func (*InMemoryBackend) DeleteFileSystem ¶
DeleteFileSystem deletes a file system that has no mount targets or access points.
func (*InMemoryBackend) DeleteFileSystemPolicy ¶
func (b *InMemoryBackend) DeleteFileSystemPolicy(ctx context.Context, ref string) error
DeleteFileSystemPolicy removes the resource policy of a file system.
func (*InMemoryBackend) DeleteMountTarget ¶
func (b *InMemoryBackend) DeleteMountTarget(ctx context.Context, id string) error
DeleteMountTarget deletes a mount target.
func (*InMemoryBackend) GetAccessPoint ¶
func (b *InMemoryBackend) GetAccessPoint(ctx context.Context, ref string) (*AccessPoint, error)
GetAccessPoint returns an access point by ID or ARN.
func (*InMemoryBackend) GetFileSystem ¶
func (b *InMemoryBackend) GetFileSystem(ctx context.Context, ref string) (*FileSystem, error)
GetFileSystem returns a file system by ID or ARN.
func (*InMemoryBackend) GetFileSystemPolicy ¶
func (b *InMemoryBackend) GetFileSystemPolicy(ctx context.Context, ref string) (string, string, error)
GetFileSystemPolicy returns the resource policy and the file system's ID.
func (*InMemoryBackend) GetMountTarget ¶
func (b *InMemoryBackend) GetMountTarget(ctx context.Context, id string) (*MountTarget, error)
GetMountTarget returns a mount target by ID.
func (*InMemoryBackend) GetSynchronizationConfiguration ¶
func (b *InMemoryBackend) GetSynchronizationConfiguration(ctx context.Context, ref string) (*SyncConfiguration, error)
GetSynchronizationConfiguration returns the sync configuration of a file system.
func (*InMemoryBackend) ListAccessPoints ¶
func (b *InMemoryBackend) ListAccessPoints( ctx context.Context, fileSystemRef string, maxResults int, token string, ) (page.Page[*AccessPoint], error)
ListAccessPoints lists the access points of one file system.
func (*InMemoryBackend) ListFileSystems ¶
func (b *InMemoryBackend) ListFileSystems( ctx context.Context, bucket string, maxResults int, token string, ) (page.Page[*FileSystem], error)
ListFileSystems lists file systems, optionally restricted to one bucket ARN.
func (*InMemoryBackend) ListMountTargets ¶
func (b *InMemoryBackend) ListMountTargets( ctx context.Context, fileSystemRef, accessPointRef string, maxResults int, token string, ) (page.Page[*MountTarget], error)
ListMountTargets lists mount targets, optionally filtered by file system or access point.
func (*InMemoryBackend) ListTagsForResource ¶
func (b *InMemoryBackend) ListTagsForResource( ctx context.Context, ref string, maxResults int, token string, ) (page.Page[KV], error)
ListTagsForResource lists a resource's tags sorted by key.
func (*InMemoryBackend) PutFileSystemPolicy ¶
func (b *InMemoryBackend) PutFileSystemPolicy(ctx context.Context, ref, policy string) error
PutFileSystemPolicy sets the resource policy of a file system.
func (*InMemoryBackend) PutSynchronizationConfiguration ¶
func (b *InMemoryBackend) PutSynchronizationConfiguration(ctx context.Context, ref string, in PutSyncInput) error
PutSynchronizationConfiguration creates or replaces the sync configuration, with optimistic versioning.
func (*InMemoryBackend) Region ¶
func (b *InMemoryBackend) Region() string
Region returns the default region.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore loads state produced by Snapshot.
func (*InMemoryBackend) SetBucketResolver ¶
func (b *InMemoryBackend) SetBucketResolver(r BucketResolver)
SetBucketResolver wires S3 bucket validation; nil leaves buckets unvalidated.
func (*InMemoryBackend) SetClock ¶
func (b *InMemoryBackend) SetClock(now func() time.Time)
SetClock replaces the time source (tests).
func (*InMemoryBackend) SetLifecycleDelay ¶
func (b *InMemoryBackend) SetLifecycleDelay(d time.Duration)
SetLifecycleDelay sets how long resources stay creating/deleting; zero is instant.
func (*InMemoryBackend) SetSubnetResolver ¶
func (b *InMemoryBackend) SetSubnetResolver(r SubnetResolver)
SetSubnetResolver wires EC2 subnet validation; nil leaves subnets unvalidated.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serialises the backend state to JSON.
func (*InMemoryBackend) TagResource ¶
TagResource adds or overwrites tags on a file system or access point.
func (*InMemoryBackend) UntagResource ¶
UntagResource removes tags by key; absent keys are ignored.
func (*InMemoryBackend) UpdateMountTarget ¶
func (b *InMemoryBackend) UpdateMountTarget(ctx context.Context, id string, sgs []string) (*MountTarget, error)
UpdateMountTarget replaces the mount target's security groups.
type Lifecycle ¶
type Lifecycle struct {
CreatedAt time.Time `json:"createdAt"`
DeleteRequestedAt *time.Time `json:"deleteRequestedAt,omitempty"`
Status string `json:"status"`
StatusMessage string `json:"statusMessage,omitempty"`
}
Lifecycle is the state shared by every S3 Files resource.
type MountTarget ¶
type MountTarget struct {
Lifecycle
IPv6Address string `json:"ipv6Address,omitempty"`
SubnetID string `json:"subnetId"`
VPCID string `json:"vpcId,omitempty"`
AvailabilityZoneID string `json:"availabilityZoneId,omitempty"`
IPv4Address string `json:"ipv4Address,omitempty"`
ID string `json:"id"`
IPAddressType string `json:"ipAddressType"`
NetworkInterfaceID string `json:"networkInterfaceId"`
OwnerID string `json:"ownerId"`
Region string `json:"region"`
FileSystemID string `json:"fileSystemId"`
SecurityGroups []string `json:"securityGroups,omitempty"`
}
MountTarget is a network endpoint for mounting a file system.
type PosixUser ¶
type PosixUser struct {
UID *int64 `json:"uid"`
GID *int64 `json:"gid"`
SecondaryGIDs []int64 `json:"secondaryGids,omitempty"`
}
PosixUser is the POSIX identity enforced through an access point.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for Amazon S3 Files.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init creates the backend and handler.
type PutSyncInput ¶
type PutSyncInput struct {
LatestVersion *int32
ImportRules []ImportDataRule
ExpireRules []ExpirationDataRule
}
PutSyncInput is the backend form of PutSynchronizationConfiguration.
type RootDirectory ¶
type RootDirectory struct {
CreationPermissions *CreationPermissions `json:"creationPermissions,omitempty"`
Path *string `json:"path,omitempty"`
}
RootDirectory is an access point's root directory.
type SubnetInfo ¶
SubnetInfo is the placement of an EC2 subnet.
type SubnetResolver ¶
type SubnetResolver interface {
Subnet(id string) (SubnetInfo, bool)
}
SubnetResolver looks up EC2 subnets.
type SyncConfiguration ¶
type SyncConfiguration struct {
ImportDataRules []ImportDataRule `json:"importDataRules"`
ExpirationDataRules []ExpirationDataRule `json:"expirationDataRules"`
Version int32 `json:"version"`
}
SyncConfiguration is a file system's synchronization configuration.