Documentation
¶
Index ¶
- Variables
- func Client() (*minio.Client, error)
- func EnsureBucket(ctx context.Context, buckets ...string) error
- func Exists(ctx context.Context, objectKey string, opts ...*ExistsOptions) (bool, error)
- func List(ctx context.Context, opts ...*ListOptions) iter.Seq2[ObjectInfo, error]
- func New(cfg config.Minio) (cli *minio.Client, err error)
- func PresignedGetURL(ctx context.Context, objectKey string, expires time.Duration, ...) (string, error)
- func PresignedPutURL(ctx context.Context, objectKey string, expires time.Duration, ...) (string, error)
- func Remove(ctx context.Context, objectKey string, opts ...*RemoveOptions) error
- type CopyOptions
- type ExistsOptions
- type GetOptions
- type ListOptions
- type ObjectInfo
- func Copy(ctx context.Context, srcKey, dstKey string, opts ...*CopyOptions) (*ObjectInfo, error)
- func Get(ctx context.Context, objectKey string, opts ...*GetOptions) (io.ReadCloser, *ObjectInfo, error)
- func Put(ctx context.Context, objectKey string, reader io.Reader, opts ...*PutOptions) (*ObjectInfo, error)
- func Stat(ctx context.Context, objectKey string, opts ...*StatOptions) (*ObjectInfo, error)
- type PutOptions
- type RemoveOptions
- type StatOptions
Constants ¶
This section is empty.
Variables ¶
var ErrObjectNotFound = errors.New("object not found")
ErrObjectNotFound is the error Get and Stat answer, wrapped, when the store answers 404 for the object, the object or the bucket named for it missing, as Exists answers false for both; tell it with errors.Is. The provider creates the buckets the configuration lists when it starts (see config.Minio.Bucket), so a missing bucket is one removed since, or one an option names that EnsureBucket never created.
Functions ¶
func EnsureBucket ¶
EnsureBucket creates each of the buckets that does not exist yet, skipping empty names. The provider does so for the buckets the configuration lists when it starts; EnsureBucket is for another bucket an option names.
func Exists ¶
Exists checks whether an object exists: false for an object the store does not hold, and for a missing bucket alike (see ErrObjectNotFound).
func List ¶
func List(ctx context.Context, opts ...*ListOptions) iter.Seq2[ObjectInfo, error]
List lists the objects under the prefix as a sequence of object and error pairs: every object comes with a nil error, and a listing that fails ends the sequence with one pair carrying the error, as a client not initialized yet does. Of a bucket holding list/a.txt and list/b.txt, List with Prefix "list/" and Recursive yields the two objects; over a bucket that does not exist it yields one error naming the bucket. Stopping the iteration early stops the listing.
func PresignedGetURL ¶
func PresignedGetURL(ctx context.Context, objectKey string, expires time.Duration, opts ...*GetOptions) (string, error)
PresignedGetURL generates a presigned GET URL with expiration capped at 7 days.
func PresignedPutURL ¶
func PresignedPutURL(ctx context.Context, objectKey string, expires time.Duration, opts ...*PutOptions) (string, error)
PresignedPutURL generates a presigned PUT URL with expiration capped at 7 days; of the upload options only the bucket applies.
Types ¶
type CopyOptions ¶
type CopyOptions struct {
Bucket string
}
CopyOptions configures object copy operations.
type ExistsOptions ¶
ExistsOptions configures existence checks.
type GetOptions ¶
type GetOptions struct {
VersionID string // object version ID when versioning is enabled
Range string // HTTP range header, e.g. "bytes=0-1024"
Bucket string // overwrite the bucket name set in config.
}
GetOptions represents download options.
type ListOptions ¶
ListOptions configures object listing.
type ObjectInfo ¶
type ObjectInfo struct {
Key string
Size int64
ContentType string
ETag string
LastModified time.Time
Metadata map[string]string
}
ObjectInfo describes object metadata.
func Copy ¶
func Copy(ctx context.Context, srcKey, dstKey string, opts ...*CopyOptions) (*ObjectInfo, error)
Copy copies an object within the same bucket.
func Get ¶
func Get(ctx context.Context, objectKey string, opts ...*GetOptions) (io.ReadCloser, *ObjectInfo, error)
Get downloads an object and returns a reader plus metadata. An object the store does not hold answers an error that is ErrObjectNotFound to errors.Is, as a missing bucket does (see ErrObjectNotFound).
func Put ¶
func Put(ctx context.Context, objectKey string, reader io.Reader, opts ...*PutOptions) (*ObjectInfo, error)
Put uploads an object to MinIO and returns its basic metadata.
func Stat ¶
func Stat(ctx context.Context, objectKey string, opts ...*StatOptions) (*ObjectInfo, error)
Stat returns object metadata. An object the store does not hold answers an error that is ErrObjectNotFound to errors.Is, as a missing bucket does (see ErrObjectNotFound).
type PutOptions ¶
type PutOptions struct {
ContentType string // MIME type, auto-detected if empty
Metadata map[string]string // custom metadata
ContentEncoding string
CacheControl string
Bucket string // overwrite the bucket name set in config.
Size int64
}
PutOptions represents upload options.
type RemoveOptions ¶
RemoveOptions configures delete behavior.
type StatOptions ¶
StatOptions configures stat lookups.