Documentation ¶
Index ¶
- Constants
- type AWSClient
- func (c *AWSClient) BucketContent(bucket string) (BucketObject, error)
- func (c *AWSClient) CreateBucket(bucket string) error
- func (c *AWSClient) DeleteBucket(bucket string) error
- func (c *AWSClient) DeleteObject(bucket, objectName, versionId string) error
- func (c *AWSClient) GetObject(bucket, objectName string) ([]byte, error)
- func (c *AWSClient) GetS3Link(bucket, objectName string, expiresIn time.Duration) (string, error)
- func (c *AWSClient) Initialize() error
- func (c *AWSClient) ListBuckets() ([]BucketInfo, error)
- func (c *AWSClient) ListObjects(bucket string) ([]ObjectInfo, error)
- func (c *AWSClient) UploadFile(bucketName, fileName string) error
- func (c *AWSClient) UploadObject(bucket, objectName, contentType string, reader io.Reader, size int64) error
- type BucketInfo
- type BucketObject
- type MinioBucketObject
- type MinioClient
- func (c *MinioClient) BucketContent(bucket string) (BucketObject, error)
- func (c *MinioClient) CreateBucket(bucket string) error
- func (c *MinioClient) DeleteBucket(bucket string) error
- func (c *MinioClient) DeleteObject(bucket, objectName, versionId string) error
- func (c *MinioClient) GetObject(bucket, objectName string) ([]byte, error)
- func (c *MinioClient) GetS3Link(bucket, objectName string, expiresIn time.Duration) (string, error)
- func (c *MinioClient) Initialize() error
- func (c *MinioClient) ListBuckets() ([]BucketInfo, error)
- func (c *MinioClient) ListObjects(bucket string) ([]ObjectInfo, error)
- func (c *MinioClient) UploadFile(bucketName, fileName string) error
- func (c *MinioClient) UploadObject(bucket, objectName, contentType string, reader io.Reader, size int64) error
- type ObjectInfo
- type S3
- type S3Client
Constants ¶
const LargeFileThreshold = 5 * 1024 * 1024 // 5 MB threshold for large files
LargeFileThreshold define threshold for large files
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AWSClient ¶ added in v0.5.9
AWSClient represents AWS S3 client
func (*AWSClient) BucketContent ¶ added in v0.5.9
func (c *AWSClient) BucketContent(bucket string) (BucketObject, error)
BucketContent retrieves all objects in a bucket
func (*AWSClient) CreateBucket ¶ added in v0.5.9
CreateBucket creates a new bucket
func (*AWSClient) DeleteBucket ¶ added in v0.5.9
DeleteBucket deletes an existing bucket
func (*AWSClient) DeleteObject ¶ added in v0.5.9
DeleteObject deletes an object from a bucket
func (*AWSClient) GetS3Link ¶ added in v0.5.9
GetS3Link generates a URL for an object in the S3 bucket or a bucket itself if objectName is empty. If expiresIn is 0, it generates a permanent link (for public buckets or objects with appropriate ACL).
func (*AWSClient) Initialize ¶ added in v0.5.9
Initialize initializes the S3 client for AWS S3 storage
func (*AWSClient) ListBuckets ¶ added in v0.5.9
func (c *AWSClient) ListBuckets() ([]BucketInfo, error)
ListBuckets retrieves all available buckets
func (*AWSClient) ListObjects ¶ added in v0.5.9
func (c *AWSClient) ListObjects(bucket string) ([]ObjectInfo, error)
ListObjects lists all objects in a bucket
func (*AWSClient) UploadFile ¶ added in v0.6.0
UploadFile upload given file to a bucket
type BucketInfo ¶ added in v0.5.7
BucketInfo provides information about S3 bucket
type BucketObject ¶
type BucketObject struct { Bucket string `json:"bucket"` Objects []ObjectInfo `json:"objects"` }
BucketObject represents S3 bucket object
type MinioBucketObject ¶ added in v0.5.7
type MinioBucketObject struct { Bucket string `json:"bucket"` Objects []minio.ObjectInfo `json:"objects"` }
MinioBucketObject represents s3 object
type MinioClient ¶ added in v0.5.9
MinioClient represents Minio S3 client
func (*MinioClient) BucketContent ¶ added in v0.5.9
func (c *MinioClient) BucketContent(bucket string) (BucketObject, error)
BucketContent retrieves all objects in a bucket
func (*MinioClient) CreateBucket ¶ added in v0.5.9
func (c *MinioClient) CreateBucket(bucket string) error
CreateBucket creates a new bucket
func (*MinioClient) DeleteBucket ¶ added in v0.5.9
func (c *MinioClient) DeleteBucket(bucket string) error
DeleteBucket deletes an existing bucket
func (*MinioClient) DeleteObject ¶ added in v0.5.9
func (c *MinioClient) DeleteObject(bucket, objectName, versionId string) error
DeleteObject deletes an object from a bucket
func (*MinioClient) GetObject ¶ added in v0.5.9
func (c *MinioClient) GetObject(bucket, objectName string) ([]byte, error)
GetObject retrieves an object from a bucket
func (*MinioClient) GetS3Link ¶ added in v0.5.9
GetS3Link generates a URL for an object in the bucket or a bucket itself if objectName is empty. If expiresIn is 0, it generates a permanent link (for public buckets or objects with appropriate ACL).
func (*MinioClient) Initialize ¶ added in v0.5.9
func (c *MinioClient) Initialize() error
Initialize initializes the S3 client for MinIO S3 storage
func (*MinioClient) ListBuckets ¶ added in v0.5.9
func (c *MinioClient) ListBuckets() ([]BucketInfo, error)
ListBuckets retrieves all available buckets
func (*MinioClient) ListObjects ¶ added in v0.5.9
func (c *MinioClient) ListObjects(bucket string) ([]ObjectInfo, error)
ListObjects lists all objects in a bucket
func (*MinioClient) UploadFile ¶ added in v0.6.0
func (c *MinioClient) UploadFile(bucketName, fileName string) error
UploadFile upload given file to a bucket
func (*MinioClient) UploadObject ¶ added in v0.5.9
func (c *MinioClient) UploadObject(bucket, objectName, contentType string, reader io.Reader, size int64) error
UploadObject uploads an object to a bucket
type ObjectInfo ¶ added in v0.5.7
type ObjectInfo struct { Name string `json:"name"` // Name of the object LastModified time.Time `json:"last_modified"` // Date and time the object was last modified. Size int64 `json:"size"` // Size in bytes of the object. ContentType string `json:"content_type"` // A standard MIME type describing the format of the object data. Expires time.Time `json:"expires"` // The date and time at which the object is no longer able to be cached. }
ObjectInfo provides information about S3 object
type S3Client ¶ added in v0.5.9
type S3Client interface { Initialize() error BucketContent(bucket string) (BucketObject, error) ListBuckets() ([]BucketInfo, error) ListObjects(bucket string) ([]ObjectInfo, error) CreateBucket(bucket string) error DeleteBucket(bucket string) error UploadObject(bucket, objectName, contentType string, reader io.Reader, size int64) error DeleteObject(bucket, objectName, versionId string) error GetObject(bucket, objectName string) ([]byte, error) GetS3Link(bucket, objectName string, expiresIn time.Duration) (string, error) UploadFile(bucketName, fileName string) error }
Generic S3Client interface
func InitializeS3Client ¶ added in v0.5.9
InitializeS3Client initializes either AWSClient or MinioClient based on the option.