Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
not working :(
Browse files Browse the repository at this point in the history
  • Loading branch information
jriquelme committed Nov 9, 2020
0 parents commit c9a2cf7
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
s3test
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module github.com/jriquelme/s3test

go 1.15

require (
github.com/aws/aws-sdk-go-v2 v0.29.0
github.com/aws/aws-sdk-go-v2/config v0.2.2
github.com/aws/aws-sdk-go-v2/service/s3 v0.29.0
)
30 changes: 30 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
github.com/aws/aws-sdk-go-v2 v0.29.0 h1:V/KKvuMO2hwHRg2SXJc5aasBHhD1AWbS6KMWg/Ueq1w=
github.com/aws/aws-sdk-go-v2 v0.29.0/go.mod h1:4d1/Ee0vCwCF7BfG1hCT3zu82493cRy5+VZ8JHvMPf0=
github.com/aws/aws-sdk-go-v2/config v0.2.2 h1:CBZGPlpL5h+BDoNBNTgypqMxlWgCome/O/i8gdjaOtE=
github.com/aws/aws-sdk-go-v2/config v0.2.2/go.mod h1:rty/i5U/IiXxO4kQmSXKwneNiTVqCxYVoO5BVXjCbfY=
github.com/aws/aws-sdk-go-v2/credentials v0.1.4 h1:ReVvyoYW/HriCnCWMoWC2ftvh0g9U4wS7lB5GFYK/ZE=
github.com/aws/aws-sdk-go-v2/credentials v0.1.4/go.mod h1:o0z92KOE6YJ/DyGSJmt83dG9YlGUc2n04QYwbfNsA8Q=
github.com/aws/aws-sdk-go-v2/ec2imds v0.1.4 h1:N3atV6naU7rFtS3gg/XU2ZuiPqzFm3HONBbnGDdPq1A=
github.com/aws/aws-sdk-go-v2/ec2imds v0.1.4/go.mod h1:h5WB2P4CTnVroyw/gvIiyMTtl/zvnKAC4H74EWiKOco=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v0.3.0 h1:OGNwNNeQvOZsa+zAK5nE7r6e0serfSAFznoXqbvbzFE=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v0.3.0/go.mod h1:bMiNrEKNefchodwRJnuwaiAZj2NJq8ZHAYASve6mbFs=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v0.3.1 h1:5dV7pN0xCrnecvbn7+qkK1XbsYwSqbDoSCzVeaW2LJE=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v0.3.1/go.mod h1:XHXNMjAkjOXqnmixax5P9IsLhJd6mEU+yrsGls4b5zk=
github.com/aws/aws-sdk-go-v2/service/s3 v0.29.0 h1:rFcFgFNUgnsY1Xdl93lz/oMUvxtReICkt4uVJ+cxY0U=
github.com/aws/aws-sdk-go-v2/service/s3 v0.29.0/go.mod h1:AczwX1lIFRCemJqc/Jl8xaoc/V7QlAUenAT9pMGqPQw=
github.com/aws/aws-sdk-go-v2/service/sts v0.29.0 h1:EOEsrzOQh+xU4lKbrkRoTybsP704I32GczRFsW6apEw=
github.com/aws/aws-sdk-go-v2/service/sts v0.29.0/go.mod h1:zV0Fx4GE1wPZJ3iHn1g7UxoPb+uJfqOkvBp3UQAq3bc=
github.com/awslabs/smithy-go v0.2.1/go.mod h1:hPOQwnmBLHsUphH13tVSjQhTAFma0/0XoZGbBcOuABI=
github.com/awslabs/smithy-go v0.3.0 h1:I1EQ1P+VtxpuNnGYymATewaKrlnaYQwFvO8lNTsafbs=
github.com/awslabs/smithy-go v0.3.0/go.mod h1:hPOQwnmBLHsUphH13tVSjQhTAFma0/0XoZGbBcOuABI=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/go-cmp v0.4.1 h1:/exdXoGamhu5ONeUJH0deniYLWYvQwW66yvlfiiKTu0=
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
31 changes: 31 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main

import (
"context"
"io/ioutil"
"log"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/s3"
)

func main() {
cfg, err := config.LoadDefaultConfig()
if err != nil {
log.Fatal(err)
}
client := s3.NewFromConfig(cfg)
output, err := client.GetObject(context.Background(), &s3.GetObjectInput{
Bucket: aws.String("my-bucket"),
Key: aws.String("my-file.csv"),
})
if err != nil {
log.Fatal(err)
}
b, err := ioutil.ReadAll(output.Body)
if err != nil {
log.Fatal(err)
}
log.Printf("%s", b)
}

0 comments on commit c9a2cf7

Please sign in to comment.