-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
43 lines (34 loc) · 949 Bytes
/
main.go
File metadata and controls
43 lines (34 loc) · 949 Bytes
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
package main
import (
"log"
"github.com/GotoRen/storage-api-sample/client"
"github.com/GotoRen/storage-api-sample/config"
)
func main() {
cfg := config.Get()
// s3 クライアントを作成
client, err := client.NewS3Client(cfg)
if err != nil {
log.Fatal(err)
}
// // 1. ローカルファイルをアップロード
// if err := client.Upload(cfg); err != nil {
// log.Fatal(err)
// }
// // 2. オブジェクトファイルを読込
// if err := client.Read(cfg); err != nil {
// log.Fatal(err)
// }
// // 3. オブジェクトファイルをダウンロード
// if err := client.Download(cfg); err != nil {
// log.Fatal(err)
// }
// // 4. オブジェクトファイルを削除
// if err := client.Delete(cfg); err != nil {
// log.Fatal(err)
// }
// 5. Presigned URL を使用してファイルをアップロード
if err := client.UploadWithPreSignedRequest(cfg); err != nil {
log.Fatal(err)
}
}