예제 #1
0
func getObject(client *s3.S3) {
	req := s3.GetObjectRequest{}
	req.Bucket = aws.String("kyokomi-foo")
	req.Key = aws.String("bar/media.json")

	res, err := client.GetObject(&req)
	if err != nil {
		log.Fatalln(err)
	}

	defer res.Body.Close()
}
예제 #2
0
func printGetObject(client *s3.S3) {
	req := s3.GetObjectRequest{}
	req.Bucket = aws.String("kyokomi-foo")
	req.Key = aws.String("bar/media.json")

	res, err := client.GetObject(&req)
	if err != nil {
		log.Fatalln(err)
	}

	defer res.Body.Close()

	data, err := ioutil.ReadAll(res.Body)
	if err != nil {
		log.Fatalln(err)
	}

	fmt.Println(string(data))
}