Beispiel #1
0
func listBuckets(service *s34go.S3Service) {
	buckets, err := service.ListBuckets()
	checkError("retrieve bucket list", err)

	for _, bucket := range buckets {
		fmt.Println(bucket)
	}
}
Beispiel #2
0
func listObjects(service *s34go.S3Service, bucketName string) {
	bucket, err := service.GetBucket(bucketName)
	checkError("retrieve bucket", err)
	if bucket == nil {
		fmt.Fprintln(os.Stderr, "bucket "+bucketName+" does not exist")
		os.Exit(2)
	}

	objects, err := bucket.ListObjects()
	checkError("retrieve bucket contents", err)
	for _, object := range objects {
		fmt.Println(object)
	}
}