MCPcopy
hub / github.com/minio/minio-go / main

Function main

examples/s3/getbucketnotification.go:31–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29)
30
31func main() {
32 // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY and my-bucketname are
33 // dummy values, please replace them with original values.
34
35 // Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access.
36 // This boolean value is the last argument for New().
37
38 // New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically
39 // determined based on the Endpoint value.
40 s3Client, err := minio.New("s3.amazonaws.com", &minio.Options{
41 Creds: credentials.NewStaticV4("YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", ""),
42 Secure: true,
43 })
44 if err != nil {
45 log.Fatalln(err)
46 }
47
48 // s3Client.TraceOn(os.Stderr)
49
50 notifications, err := s3Client.GetBucketNotification(context.Background(), "my-bucketname")
51 if err != nil {
52 log.Fatalln(err)
53 }
54
55 log.Println("Bucket notification are successfully retrieved.")
56
57 for _, topicConfig := range notifications.TopicConfigs {
58 for _, e := range topicConfig.Events {
59 log.Println(e + " event is enabled.")
60 }
61 }
62}

Callers

nothing calls this directly

Calls 2

NewStaticV4Function · 0.92
GetBucketNotificationMethod · 0.80

Tested by

no test coverage detected