-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths3client.go
53 lines (38 loc) · 2.08 KB
/
s3client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package s3
import (
"context"
"net/url"
"time"
)
// Client holds all callable methods.
type Client interface {
// UploadFile uploads data under a given s3 path.
UploadFile(ctx context.Context, upload *Upload, options ...UploadOption) (*UploadInfo, error)
// GetFile returns the file from given s3 path.
GetFile(ctx context.Context, path string, options ...GetOption) (File, error)
// GetObjectInfo returns an minio.ObjectInfo for the given s3 path.
GetFileInfo(ctx context.Context, path string) (*FileInfo, error)
// GetDirectory returns a list of files from given s3 folder.
GetDirectory(ctx context.Context, path string, options ...GetDirectoryOption) ([]File, error)
// GetDirectoryInfos returns a list of file infos for all files from given s3 folder.
GetDirectoryInfos(ctx context.Context, path string) ([]*FileInfo, error)
// DownloadFile downloads the requested file to the file system under given localPath.
DownloadFile(ctx context.Context, path, localPath string, options ...DownloadOption) error
// DownloadDirectory downloads the requested folder to the file system.
// The recursive option also downloads all sub folders.
DownloadDirectory(ctx context.Context, path, localPath string, recursive bool, options ...DownloadOption) error
// RemoveFile deletes the file under given s3 path.
RemoveFile(ctx context.Context, path string, options ...RemoveOption) error
// AddLifeCycleRule adds a lifecycle rule to the given folder.
AddLifeCycleRule(ctx context.Context, ruleID, folderPath string, daysToExpiry int) error
// CreateFileLink creates a link with expiration for a file under the given path.
CreateFileLink(ctx context.Context, path string, expiration time.Duration) (*url.URL, error)
// Close closes the s3 client.
Close()
// IsOnline reports true if the client is online. If the health-check has not been enabled this will always return true.
IsOnline() bool
// IsHealthy reports true if the client is online. If the health-check has not been enabled this will always return true.
IsHealthy() bool
// GetName returns the name of the client.
GetName() string
}