Documentation
¶
Index ¶
- Variables
- func Base(path string) string
- func GetClient(path string, opts ...Option) (*awsS3.Client, error)
- func HasAccess(ctx context.Context, path string, opts ...Option) bool
- func IsDir(ctx context.Context, path string, opts ...Option) bool
- func IsWithRetry(opts ...Option) bool
- func Join(elems ...string) string
- func Parse(path string) (string, string)
- func ReadDir(ctx context.Context, path string, opts ...Option) ([]fs.DirEntry, error)
- func Size(ctx context.Context, path string, opts ...Option) (int64, error)
- type DirEntry
- func (de *DirEntry) Info() (fs.FileInfo, error)
- func (de *DirEntry) IsDir() bool
- func (de *DirEntry) ModTime() time.Time
- func (de *DirEntry) Mode() fs.FileMode
- func (de *DirEntry) Name() string
- func (de *DirEntry) Size() int64
- func (de *DirEntry) Sys() interface{}
- func (de *DirEntry) Type() fs.FileMode
- type InfoDir
- type ObjectInfo
- func (oi *ObjectInfo) Bucket() string
- func (oi *ObjectInfo) IsDir() bool
- func (oi *ObjectInfo) LastModified() time.Time
- func (oi *ObjectInfo) ModTime() time.Time
- func (oi *ObjectInfo) Mode() fs.FileMode
- func (oi *ObjectInfo) Name() string
- func (oi *ObjectInfo) Path() string
- func (oi *ObjectInfo) Size() int64
- func (oi *ObjectInfo) StorageClass() string
- func (oi *ObjectInfo) Sys() any
- type Option
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMajorFailure is returned when an unexpected serious error occurred. Contact the development team. ErrMajorFailure = errors.New("major failure") // ErrNoAccess is returned when the access to the object or bucket is not available. ErrNoAccess = errors.New("no access") )
Functions ¶
func Base ¶
Base returns the last element of `path`. Trailing path separators are removed before extracting the last element. If the path is empty, Base returns "."
func GetClient ¶
GetClient returns a client for the bucket of `path`. It handles the option WithProfile.
func HasAccess ¶
HasAccess returns true if the object or prefix at`path`can be accessed even if it does not yet exist.
It supports the option WithProfile, and WithRetry.
func IsDir ¶
IsDir informs whether the path is a key with objects. The path may end with "/". The root of an accessible bucket is a directory.
If the bucket is not accessible, it returns false.
func IsWithRetry ¶
IsWithRetry returns true if the option is set to use a retry strategy.
func Join ¶
Join joins any number of path elements into a single s3URI. If the argument list is empty, Join returns an empty string. If an elems is "", it is skipped. The function supports ".." path elements.
Types ¶
type DirEntry ¶
type DirEntry struct {
InfoDir
// contains filtered or unexported fields
}
DirEntry is an entry read from a directory. It implements the fs.DirEntry interface.
func (*DirEntry) Info ¶
Info returns the FileInfo for the file or subdirectory described by the entry.
func (*DirEntry) Mode ¶
Mode systematically returns fs.ModeIrregular. It is necessary for fs.DirEntry interface compliance.
type InfoDir ¶
type InfoDir struct {
// contains filtered or unexported fields
}
InfoDir holds information about S3 repertory.
func (InfoDir) Bucket ¶
Bucket returns the name of the bucket. The name does not have the prefix "s3://"
func (InfoDir) CreationDate ¶
CreationDate returns the creation of the repertory.
type ObjectInfo ¶
type ObjectInfo struct {
// contains filtered or unexported fields
}
ObjectInfo holds the information related to an S3 object. It implements the interface io/fs/FileInfo.
func Info ¶
Info returns the ObjectInfo of the object at `path`. If it is a directory, then IsDir() is true and Size() and ModTime() is meaningless.
func (*ObjectInfo) Bucket ¶
func (oi *ObjectInfo) Bucket() string
Bucket returns the name of the bucket holding the object.
func (*ObjectInfo) IsDir ¶
func (oi *ObjectInfo) IsDir() bool
IsDir determines if the given ObjectInfo represents a directory based on its bucket and key attributes.
func (*ObjectInfo) LastModified ¶
func (oi *ObjectInfo) LastModified() time.Time
LastModified returns the last modification date of the object.
func (*ObjectInfo) ModTime ¶
func (oi *ObjectInfo) ModTime() time.Time
ModTime returns the last modification time of the object.
func (*ObjectInfo) Mode ¶
func (oi *ObjectInfo) Mode() fs.FileMode
Mode is mandatory for the fs.FileInfo interface.
func (*ObjectInfo) Name ¶
func (oi *ObjectInfo) Name() string
Name returns the base name of the object as defined by fs.FileInfo.
func (*ObjectInfo) Path ¶
func (oi *ObjectInfo) Path() string
Path returns the path of the object without the bucket.
func (*ObjectInfo) StorageClass ¶
func (oi *ObjectInfo) StorageClass() string
StorageClass returns the storage class of the object. It has one of the following values: "STANDARD", "REDUCED_REDUNDANCY", "GLACIER", "STANDARD_IA", "ONEZONE_IA", "INTELLIGENT_TIERING", "DEEP_ARCHIVE", "OUTPOSTS", or "GLACIER_IR".
func (*ObjectInfo) Sys ¶
func (oi *ObjectInfo) Sys() any
Sys is a placeholder method to satisfy the fs.FileInfo interface, always returning nil.
type Option ¶
type Option func(opts *options)
Option allows parameterizing a function
func WithProfile ¶
WithProfile indicates the operation should use the profile `p`