-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (32 loc) · 786 Bytes
/
main.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
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
func main() {
var sess *session.Session
var err error
awsConfig := aws.Config{
S3ForcePathStyle: aws.Bool(true),
Region: aws.String("TODO"),
Endpoint: aws.String("TODO"),
Credentials: credentials.NewStaticCredentials("TODO", "TODO", ""),
}
sess, err = session.NewSession(&awsConfig)
if err != nil {
panic(err)
}
sessionClient := s3.New(sess)
response, err := sessionClient.ListObjects(&s3.ListObjectsInput{
Bucket: aws.String("TODO"),
Prefix: aws.String("TODO"),
})
if err != nil {
fmt.Println(err)
panic(err)
}
fmt.Println(response)
}