diff --git a/go.mod b/go.mod index b29f8262b..952309464 100644 --- a/go.mod +++ b/go.mod @@ -7,14 +7,17 @@ require ( github.com/Azure/azure-storage-blob-go v0.15.0 github.com/DisposaBoy/JsonConfigReader v0.0.0-20201129172854-99cf318d67e7 github.com/awalterschulze/gographviz v2.0.3+incompatible - github.com/aws/aws-sdk-go v1.45.8 github.com/cavaliergopher/grab/v3 v3.0.1 github.com/cheggaaa/pb v1.0.29 github.com/gin-gonic/gin v1.9.1 + github.com/go-playground/validator/v10 v10.15.4 // indirect github.com/h2non/filetype v1.1.3 + github.com/jlaffaye/ftp v0.2.0 // indirect github.com/kjk/lzma v0.0.0-20161016003348-3fd93898850d github.com/klauspost/compress v1.16.7 github.com/klauspost/pgzip v1.2.6 + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mattn/go-shellwords v1.0.12 github.com/mkrautz/goar v0.0.0-20150919110319-282caa8bd9da github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f @@ -25,7 +28,6 @@ require ( github.com/rs/zerolog v1.30.0 github.com/smira/commander v0.0.0-20140515201010-f408b00e68d5 github.com/smira/flag v0.0.0-20170926215700-695ea5e84e76 - github.com/smira/go-aws-auth v0.0.0-20180731211914-8b73995fd8d1 github.com/smira/go-ftp-protocol v0.0.0-20140829150050-066b75c2b70d github.com/smira/go-xz v0.1.0 github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d @@ -35,11 +37,25 @@ require ( golang.org/x/sys v0.12.0 golang.org/x/term v0.12.0 golang.org/x/time v0.3.0 + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c ) require ( github.com/Azure/azure-pipeline-go v0.2.3 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.14 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.6 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.15 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.38 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.6 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.15.2 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.23.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bytedance/sonic v1.10.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect @@ -49,24 +65,19 @@ require ( github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.15.4 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.3.1 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/jlaffaye/ftp v0.2.0 // indirect - github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/leodido/go-urn v1.2.4 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-ieproxy v0.0.11 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/mattn/go-runewidth v0.0.15 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect @@ -76,12 +87,17 @@ require ( github.com/prometheus/procfs v0.11.1 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - github.com/smartystreets/assertions v1.0.1 // indirect - github.com/smartystreets/gunit v1.0.4 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect golang.org/x/arch v0.5.0 // indirect golang.org/x/net v0.15.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +require ( + github.com/aws/aws-sdk-go-v2 v1.21.2 + github.com/aws/aws-sdk-go-v2/config v1.18.45 + github.com/aws/aws-sdk-go-v2/credentials v1.13.43 + github.com/aws/aws-sdk-go-v2/service/s3 v1.40.2 + github.com/aws/smithy-go v1.15.0 +) diff --git a/go.sum b/go.sum index fc04cec64..e0b527ab3 100644 --- a/go.sum +++ b/go.sum @@ -19,8 +19,42 @@ github.com/DisposaBoy/JsonConfigReader v0.0.0-20201129172854-99cf318d67e7 h1:AJK github.com/DisposaBoy/JsonConfigReader v0.0.0-20201129172854-99cf318d67e7/go.mod h1:GCzqZQHydohgVLSIqRKZeTt8IGb1Y4NaFfim3H40uUI= github.com/awalterschulze/gographviz v2.0.3+incompatible h1:9sVEXJBJLwGX7EQVhLm2elIKCm7P2YHFC8v6096G09E= github.com/awalterschulze/gographviz v2.0.3+incompatible/go.mod h1:GEV5wmg4YquNw7v1kkyoX9etIk8yVmXj+AkDHuuETHs= -github.com/aws/aws-sdk-go v1.45.8 h1:QbOMBTuRYx11fBwNSAJuztXmQf47deFz+CVYjakqmRo= -github.com/aws/aws-sdk-go v1.45.8/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go-v2 v1.21.2 h1:+LXZ0sgo8quN9UOKXXzAWRT3FWd4NxeXWOZom9pE7GA= +github.com/aws/aws-sdk-go-v2 v1.21.2/go.mod h1:ErQhvNuEMhJjweavOYhxVkn2RUx7kQXVATHrjKtxIpM= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.14 h1:Sc82v7tDQ/vdU1WtuSyzZ1I7y/68j//HJ6uozND1IDs= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.14/go.mod h1:9NCTOURS8OpxvoAVHq79LK81/zC78hfRWFn+aL0SPcY= +github.com/aws/aws-sdk-go-v2/config v1.18.45 h1:Aka9bI7n8ysuwPeFdm77nfbyHCAKQ3z9ghB3S/38zes= +github.com/aws/aws-sdk-go-v2/config v1.18.45/go.mod h1:ZwDUgFnQgsazQTnWfeLWk5GjeqTQTL8lMkoE1UXzxdE= +github.com/aws/aws-sdk-go-v2/credentials v1.13.43 h1:LU8vo40zBlo3R7bAvBVy/ku4nxGEyZe9N8MqAeFTzF8= +github.com/aws/aws-sdk-go-v2/credentials v1.13.43/go.mod h1:zWJBz1Yf1ZtX5NGax9ZdNjhhI4rgjfgsyk6vTY1yfVg= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13 h1:PIktER+hwIG286DqXyvVENjgLTAwGgoeriLDD5C+YlQ= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13/go.mod h1:f/Ib/qYjhV2/qdsf79H3QP/eRE4AkVyEf6sk7XfZ1tg= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43 h1:nFBQlGtkbPzp/NjZLuFxRqmT91rLJkgvsEQs68h962Y= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43/go.mod h1:auo+PiyLl0n1l8A0e8RIeR8tOzYPfZZH/JNlrJ8igTQ= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37 h1:JRVhO25+r3ar2mKGP7E0LDl8K9/G36gjlqca5iQbaqc= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37/go.mod h1:Qe+2KtKml+FEsQF/DHmDV+xjtche/hwoF75EG4UlHW8= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45 h1:hze8YsjSh8Wl1rYa1CJpRmXP21BvOBuc76YhW0HsuQ4= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45/go.mod h1:lD5M20o09/LCuQ2mE62Mb/iSdSlCNuj6H5ci7tW7OsE= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.6 h1:wmGLw2i8ZTlHLw7a9ULGfQbuccw8uIiNr6sol5bFzc8= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.6/go.mod h1:Q0Hq2X/NuL7z8b1Dww8rmOFl+jzusKEcyvkKspwdpyc= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.15 h1:7R8uRYyXzdD71KWVCL78lJZltah6VVznXBazvKjfH58= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.15/go.mod h1:26SQUPcTNgV1Tapwdt4a1rOsYRsnBsJHLMPoxK2b0d8= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.38 h1:skaFGzv+3kA+v2BPKhuekeb1Hbb105+44r8ASC+q5SE= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.38/go.mod h1:epIZoRSSbRIwLPJU5F+OldHhwZPBdpDeQkRdCeY3+00= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37 h1:WWZA/I2K4ptBS1kg0kV1JbBtG/umed0vwHRrmcr9z7k= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37/go.mod h1:vBmDnwWXWxNPFRMmG2m/3MKOe+xEcMDo1tanpaWCcck= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.6 h1:9ulSU5ClouoPIYhDQdg9tpl83d5Yb91PXTKK+17q+ow= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.6/go.mod h1:lnc2taBsR9nTlz9meD+lhFZZ9EWY712QHrRflWpTcOA= +github.com/aws/aws-sdk-go-v2/service/s3 v1.40.2 h1:Ll5/YVCOzRB+gxPqs2uD0R7/MyATC0w85626glSKmp4= +github.com/aws/aws-sdk-go-v2/service/s3 v1.40.2/go.mod h1:Zjfqt7KhQK+PO1bbOsFNzKgaq7TcxzmEoDWN8lM0qzQ= +github.com/aws/aws-sdk-go-v2/service/sso v1.15.2 h1:JuPGc7IkOP4AaqcZSIcyqLpFSqBWK32rM9+a1g6u73k= +github.com/aws/aws-sdk-go-v2/service/sso v1.15.2/go.mod h1:gsL4keucRCgW+xA85ALBpRFfdSLH4kHOVSnLMSuBECo= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3 h1:HFiiRkf1SdaAmV3/BHOFZ9DjFynPHj8G/UIO1lQS+fk= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3/go.mod h1:a7bHA82fyUXOm+ZSWKU6PIoBxrjSprdLoM8xPYvzYVg= +github.com/aws/aws-sdk-go-v2/service/sts v1.23.2 h1:0BkLfgeDjfZnZ+MhB3ONb01u9pwFYTCZVhlsSSBvlbU= +github.com/aws/aws-sdk-go-v2/service/sts v1.23.2/go.mod h1:Eows6e1uQEsc4ZaHANmsPRzAKcVDrcmjjWiih2+HUUQ= +github.com/aws/smithy-go v1.15.0 h1:PS/durmlzvAFpQHDs4wi4sNNP9ExsqZh6IlfdHXgKK8= +github.com/aws/smithy-go v1.15.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= @@ -74,6 +108,7 @@ github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -92,9 +127,7 @@ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/jlaffaye/ftp v0.2.0 h1:lXNvW7cBu7R/68bknOX3MrRIIqZ61zELs1P2RAiA3lg= github.com/jlaffaye/ftp v0.2.0/go.mod h1:is2Ds5qkhceAPy2xD6RLI6hmp/qysSoymZ+Z2uTnspI= -github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= @@ -179,16 +212,10 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c= github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= -github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= -github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= -github.com/smartystreets/gunit v1.0.4 h1:tpTjnuH7MLlqhoD21vRoMZbMIi5GmBsAJDFyF67GhZA= -github.com/smartystreets/gunit v1.0.4/go.mod h1:EH5qMBab2UclzXUcpR8b93eHsIlp9u+pDQIRp5DZNzQ= github.com/smira/commander v0.0.0-20140515201010-f408b00e68d5 h1:jLFwP6SDEUHmb6QSu5n2FHseWzMio1ou1FV9p7W6p7I= github.com/smira/commander v0.0.0-20140515201010-f408b00e68d5/go.mod h1:XTQy55hw5s3pxmC42m7X0/b+9naXQ1rGN9Of6BGIZmU= github.com/smira/flag v0.0.0-20170926215700-695ea5e84e76 h1:OM075OkN4x9IB1mbzkzaKaJjFxx8Mfss8Z3E1LHwawQ= github.com/smira/flag v0.0.0-20170926215700-695ea5e84e76/go.mod h1:KQ5bP0mZypI2qXa4Wjk+r7B6Wt/0L8/DvJwpbR1UWg4= -github.com/smira/go-aws-auth v0.0.0-20180731211914-8b73995fd8d1 h1:VPv+J50mFyP42/GzYhGuT4MJK8w/dlLt4jkoO5yhJRs= -github.com/smira/go-aws-auth v0.0.0-20180731211914-8b73995fd8d1/go.mod h1:KKhbssKjyR//TUP31t3ksE2b6oeAw328JzwmFJnzRCw= github.com/smira/go-ftp-protocol v0.0.0-20140829150050-066b75c2b70d h1:rvtR4+9N2LWPo0UHe6/aHvWpqD9Dhf10P2bfGFht74g= github.com/smira/go-ftp-protocol v0.0.0-20140829150050-066b75c2b70d/go.mod h1:Jm7yHrROA5tC42gyJ5EwiR8EWp0PUy0qOc4sE7Y8Uzo= github.com/smira/go-xz v0.1.0 h1:1zVLT1sITUKcWNysfHMLZWJ2Yh7yJfhREsgmUdK4zb0= @@ -212,31 +239,22 @@ github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4d github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0 h1:3UeQBvD0TFrlVjOeLOBz+CPAI8dnbqNSVwUwRrkp7vQ= github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0/go.mod h1:IXCdmsXIht47RaVFLEdVnh1t+pgYtTAhQGj73kz+2DM= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.5.0 h1:jpGode6huXQxcskEIpOCvrU+tzo81b6+oFLUYXWtH/Y= golang.org/x/arch v0.5.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -245,36 +263,24 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191112214154-59a1497f0cea/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/s3/public.go b/s3/public.go index 67edca09f..d575b1668 100644 --- a/s3/public.go +++ b/s3/public.go @@ -1,6 +1,7 @@ package s3 import ( + "context" "fmt" "io" "os" @@ -9,28 +10,46 @@ import ( "github.com/aptly-dev/aptly/aptly" "github.com/aptly-dev/aptly/utils" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/corehandlers" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/s3" + + "github.com/aws/aws-sdk-go-v2/aws" + v4 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/config" + "github.com/aws/aws-sdk-go-v2/credentials" + "github.com/aws/aws-sdk-go-v2/service/s3" + "github.com/aws/aws-sdk-go-v2/service/s3/types" + "github.com/aws/smithy-go" + "github.com/aws/smithy-go/logging" "github.com/pkg/errors" - awsauth "github.com/smira/go-aws-auth" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" ) const errCodeNotFound = "NotFound" +type logger struct{} + +func (l *logger) Logf(classification logging.Classification, format string, v ...interface{}) { + var e *zerolog.Event + switch classification { + case logging.Debug: + e = log.Logger.Debug() + case logging.Warn: + e = log.Logger.Warn() + default: + e = log.Logger.Error() + } + e.Msgf(format, v...) +} + // PublishedStorage abstract file system with published files (actually hosted on S3) type PublishedStorage struct { - s3 *s3.S3 + s3 *s3.Client config *aws.Config bucket string - acl string + acl types.ObjectCannedACL prefix string - storageClass string - encryptionMethod string + storageClass types.StorageClass + encryptionMethod types.ServerSideEncryption plusWorkaround bool disableMultiDel bool pathCache map[string]string @@ -44,32 +63,31 @@ var ( // NewPublishedStorageRaw creates published storage from raw aws credentials func NewPublishedStorageRaw( bucket, defaultACL, prefix, storageClass, encryptionMethod string, - plusWorkaround, disabledMultiDel bool, - config *aws.Config, + plusWorkaround, disabledMultiDel, forceVirtualHostedStyle bool, + config *aws.Config, opts ...func(o *s3.Options), ) (*PublishedStorage, error) { + + var acl types.ObjectCannedACL if defaultACL == "" { - defaultACL = "private" + acl = types.ObjectCannedACLPrivate } else if defaultACL == "none" { - defaultACL = "" + acl = "" } - if storageClass == "STANDARD" { + if storageClass == string(types.StorageClassStandard) { storageClass = "" } - sess, err := session.NewSession(config) - if err != nil { - return nil, err - } - result := &PublishedStorage{ - s3: s3.New(sess), + s3: s3.NewFromConfig(*config, append(opts, func(o *s3.Options) { + o.HTTPSignerV4 = v4.NewSigner() + })...), bucket: bucket, config: config, - acl: defaultACL, + acl: acl, prefix: prefix, - storageClass: storageClass, - encryptionMethod: encryptionMethod, + storageClass: types.StorageClass(storageClass), + encryptionMethod: types.ServerSideEncryption(encryptionMethod), plusWorkaround: plusWorkaround, disableMultiDel: disabledMultiDel, } @@ -81,53 +99,47 @@ func NewPublishedStorageRaw( // keys, region and bucket name func NewPublishedStorage( accessKey, secretKey, sessionToken, region, endpoint, bucket, defaultACL, prefix, storageClass, encryptionMethod string, - plusWorkaround, disableMultiDel, forceSigV2, forceVirtualHostedStyle, debug bool) (*PublishedStorage, error) { - - config := &aws.Config{ - Region: aws.String(region), - } - - if endpoint != "" { - config = config.WithEndpoint(endpoint) - if !forceVirtualHostedStyle { - config = config.WithS3ForcePathStyle(true) - } - } + plusWorkaround, disableMultiDel, _, forceVirtualHostedStyle, debug bool) (*PublishedStorage, error) { + opts := []func(*config.LoadOptions) error{config.WithRegion(region)} if accessKey != "" { - config.Credentials = credentials.NewStaticCredentials(accessKey, secretKey, sessionToken) + opts = append(opts, config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(accessKey, secretKey, sessionToken))) } if debug { - config = config.WithLogLevel(aws.LogDebug) + opts = append(opts, config.WithLogger(&logger{})) } - result, err := NewPublishedStorageRaw(bucket, defaultACL, prefix, storageClass, - encryptionMethod, plusWorkaround, disableMultiDel, config) + if endpoint != "" { + opts = append(opts, config.WithEndpointResolverWithOptions(aws.EndpointResolverWithOptionsFunc( + func(service, region string, options ...interface{}) (aws.Endpoint, error) { + return aws.Endpoint{URL: endpoint}, nil + }, + ))) + } - if err == nil && forceSigV2 { - creds := []awsauth.Credentials{} + config, err := config.LoadDefaultConfig(context.TODO(), opts...) + if err != nil { + return nil, err + } - if accessKey != "" { - creds = append(creds, awsauth.Credentials{ - AccessKeyID: accessKey, - SecretAccessKey: secretKey, - }) + s3Opts := []func(o *s3.Options){func(o *s3.Options) { + if endpoint != "" { + o.BaseEndpoint = &endpoint } + o.UsePathStyle = !forceVirtualHostedStyle + o.Region = region + }} - result.s3.Handlers.Sign.Clear() - result.s3.Handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler) - result.s3.Handlers.Sign.PushBack(func(req *request.Request) { - awsauth.SignS3(req.HTTPRequest, creds...) - }) - } + result, err := NewPublishedStorageRaw(bucket, defaultACL, prefix, storageClass, + encryptionMethod, plusWorkaround, disableMultiDel, forceVirtualHostedStyle, &config, s3Opts...) return result, err } // String func (storage *PublishedStorage) String() string { - return fmt.Sprintf("S3: %s:%s/%s", *storage.config.Region, storage.bucket, storage.prefix) + return fmt.Sprintf("S3: %s:%s/%s", storage.config.Region, storage.bucket, storage.prefix) } // MkDir creates directory recursively under public path @@ -162,12 +174,12 @@ func (storage *PublishedStorage) getMD5(path string) (string, error) { Bucket: aws.String(storage.bucket), Key: aws.String(filepath.Join(storage.prefix, path)), } - output, err := storage.s3.HeadObject(params) + output, err := storage.s3.HeadObject(context.TODO(), params) if err != nil { return "", err } - return aws.StringValue(output.Metadata["Md5"]), nil + return output.Metadata["Md5"], nil } // putFile uploads file-like object to @@ -177,21 +189,21 @@ func (storage *PublishedStorage) putFile(path string, source io.ReadSeeker, sour Bucket: aws.String(storage.bucket), Key: aws.String(filepath.Join(storage.prefix, path)), Body: source, - ACL: aws.String(storage.acl), + ACL: storage.acl, } if storage.storageClass != "" { - params.StorageClass = aws.String(storage.storageClass) + params.StorageClass = types.StorageClass(storage.storageClass) } if storage.encryptionMethod != "" { - params.ServerSideEncryption = aws.String(storage.encryptionMethod) + params.ServerSideEncryption = types.ServerSideEncryption(storage.encryptionMethod) } if sourceMD5 != "" { - params.Metadata = map[string]*string{ - "Md5": aws.String(sourceMD5), + params.Metadata = map[string]string{ + "Md5": sourceMD5, } } - _, err := storage.s3.PutObject(params) + _, err := storage.s3.PutObject(context.TODO(), params) if err != nil { return err } @@ -213,13 +225,12 @@ func (storage *PublishedStorage) Remove(path string) error { Bucket: aws.String(storage.bucket), Key: aws.String(filepath.Join(storage.prefix, path)), } - _, err := storage.s3.DeleteObject(params) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - if aerr.Code() == s3.ErrCodeNoSuchBucket { - // ignore 'no such bucket' errors on removal - return nil - } + + if _, err := storage.s3.DeleteObject(context.TODO(), params); err != nil { + var notFoundErr *smithy.GenericAPIError + if errors.As(err, ¬FoundErr) && notFoundErr.Code == "NoSuchBucket" { + // ignore 'no such bucket' errors on removal + return nil } return errors.Wrap(err, fmt.Sprintf("error deleting %s from %s", path, storage)) } @@ -237,11 +248,9 @@ func (storage *PublishedStorage) RemoveDirs(path string, _ aptly.Progress) error filelist, _, err := storage.internalFilelist(path, false) if err != nil { - if aerr, ok := errors.Cause(err).(awserr.Error); ok { - if aerr.Code() == s3.ErrCodeNoSuchBucket { - // ignore 'no such bucket' errors on removal - return nil - } + if errors.Is(err, &types.NoSuchBucket{}) { + // ignore 'no such bucket' errors on removal + return nil } return err } @@ -252,7 +261,7 @@ func (storage *PublishedStorage) RemoveDirs(path string, _ aptly.Progress) error Bucket: aws.String(storage.bucket), Key: aws.String(filepath.Join(storage.prefix, path, filelist[i])), } - _, err := storage.s3.DeleteObject(params) + _, err := storage.s3.DeleteObject(context.TODO(), params) if err != nil { return fmt.Errorf("error deleting path %s from %s: %s", filelist[i], storage, err) } @@ -267,23 +276,23 @@ func (storage *PublishedStorage) RemoveDirs(path string, _ aptly.Progress) error } else { part = filelist[i*page : (i+1)*page] } - paths := make([]*s3.ObjectIdentifier, len(part)) + paths := make([]types.ObjectIdentifier, len(part)) for i := range part { - paths[i] = &s3.ObjectIdentifier{ + paths[i] = types.ObjectIdentifier{ Key: aws.String(filepath.Join(storage.prefix, path, part[i])), } } params := &s3.DeleteObjectsInput{ Bucket: aws.String(storage.bucket), - Delete: &s3.Delete{ + Delete: &types.Delete{ Objects: paths, - Quiet: aws.Bool(true), + Quiet: true, }, } - _, err := storage.s3.DeleteObjects(params) + _, err := storage.s3.DeleteObjects(context.TODO(), params) if err != nil { return fmt.Errorf("error deleting multiple paths from %s: %s", storage, err) } @@ -378,14 +387,21 @@ func (storage *PublishedStorage) internalFilelist(prefix string, hidePlusWorkaro prefix += "/" } - params := &s3.ListObjectsInput{ + params := &s3.ListObjectsV2Input{ Bucket: aws.String(storage.bucket), Prefix: aws.String(prefix), - MaxKeys: aws.Int64(1000), + MaxKeys: 1000, } - err = storage.s3.ListObjectsPages(params, func(contents *s3.ListObjectsOutput, lastPage bool) bool { - for _, key := range contents.Contents { + p := s3.NewListObjectsV2Paginator(storage.s3, params) + for i := 1; p.HasMorePages(); i++ { + page, err := p.NextPage(context.TODO()) + if err != nil { + return nil, nil, fmt.Errorf("failed to get page %d: %w", i, err) + } + + // Log the objects found + for _, key := range page.Contents { if storage.plusWorkaround && hidePlusWorkaround && strings.Contains(*key.Key, " ") { // if we use plusWorkaround, we want to hide those duplicates /// from listing @@ -399,9 +415,7 @@ func (storage *PublishedStorage) internalFilelist(prefix string, hidePlusWorkaro } md5s = append(md5s, strings.Replace(*key.ETag, "\"", "", -1)) } - - return true - }) + } if err != nil { return nil, nil, errors.WithMessagef(err, "error listing under prefix %s in %s: %s", prefix, storage, err) @@ -418,17 +432,17 @@ func (storage *PublishedStorage) RenameFile(oldName, newName string) error { Bucket: aws.String(storage.bucket), CopySource: aws.String(source), Key: aws.String(filepath.Join(storage.prefix, newName)), - ACL: aws.String(storage.acl), + ACL: storage.acl, } if storage.storageClass != "" { - params.StorageClass = aws.String(storage.storageClass) + params.StorageClass = storage.storageClass } if storage.encryptionMethod != "" { - params.ServerSideEncryption = aws.String(storage.encryptionMethod) + params.ServerSideEncryption = storage.encryptionMethod } - _, err := storage.s3.CopyObject(params) + _, err := storage.s3.CopyObject(context.TODO(), params) if err != nil { return fmt.Errorf("error copying %s -> %s in %s: %s", oldName, newName, storage, err) } @@ -443,21 +457,21 @@ func (storage *PublishedStorage) SymLink(src string, dst string) error { Bucket: aws.String(storage.bucket), CopySource: aws.String(filepath.Join(storage.bucket, storage.prefix, src)), Key: aws.String(filepath.Join(storage.prefix, dst)), - ACL: aws.String(storage.acl), - Metadata: map[string]*string{ - "SymLink": aws.String(src), + ACL: types.ObjectCannedACL(storage.acl), + Metadata: map[string]string{ + "SymLink": src, }, - MetadataDirective: aws.String("REPLACE"), + MetadataDirective: types.MetadataDirective("REPLACE"), } if storage.storageClass != "" { - params.StorageClass = aws.String(storage.storageClass) + params.StorageClass = types.StorageClass(storage.storageClass) } if storage.encryptionMethod != "" { - params.ServerSideEncryption = aws.String(storage.encryptionMethod) + params.ServerSideEncryption = types.ServerSideEncryption(storage.encryptionMethod) } - _, err := storage.s3.CopyObject(params) + _, err := storage.s3.CopyObject(context.TODO(), params) if err != nil { return fmt.Errorf("error symlinking %s -> %s in %s: %s", src, dst, storage, err) } @@ -476,10 +490,10 @@ func (storage *PublishedStorage) FileExists(path string) (bool, error) { Bucket: aws.String(storage.bucket), Key: aws.String(filepath.Join(storage.prefix, path)), } - _, err := storage.s3.HeadObject(params) + _, err := storage.s3.HeadObject(context.TODO(), params) if err != nil { - aerr, ok := err.(awserr.Error) - if ok && aerr.Code() == errCodeNotFound { + var notFoundErr *types.NotFound + if errors.As(err, ¬FoundErr) { return false, nil } @@ -496,10 +510,10 @@ func (storage *PublishedStorage) ReadLink(path string) (string, error) { Bucket: aws.String(storage.bucket), Key: aws.String(filepath.Join(storage.prefix, path)), } - output, err := storage.s3.HeadObject(params) + output, err := storage.s3.HeadObject(context.TODO(), params) if err != nil { return "", err } - return aws.StringValue(output.Metadata["SymLink"]), nil + return output.Metadata["SymLink"], nil } diff --git a/s3/public_test.go b/s3/public_test.go index 5a216a01e..2e6762340 100644 --- a/s3/public_test.go +++ b/s3/public_test.go @@ -2,14 +2,16 @@ package s3 import ( "bytes" + "context" "io/ioutil" "os" "path/filepath" . "gopkg.in/check.v1" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/s3" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/s3" + "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aptly-dev/aptly/files" "github.com/aptly-dev/aptly/utils" @@ -36,7 +38,11 @@ func (s *PublishedStorageSuite) SetUpTest(c *C) { s.noSuchBucketStorage, err = NewPublishedStorage("aa", "bb", "", "test-1", s.srv.URL(), "no-bucket", "", "", "", "", false, true, false, false, false) c.Assert(err, IsNil) - _, err = s.storage.s3.CreateBucket(&s3.CreateBucketInput{Bucket: aws.String("test")}) + _, err = s.storage.s3.CreateBucket(context.TODO(), &s3.CreateBucketInput{ + Bucket: aws.String("test"), + CreateBucketConfiguration: &types.CreateBucketConfiguration{ + LocationConstraint: "test-1", + }}) c.Assert(err, IsNil) } @@ -45,7 +51,7 @@ func (s *PublishedStorageSuite) TearDownTest(c *C) { } func (s *PublishedStorageSuite) GetFile(c *C, path string) []byte { - resp, err := s.storage.s3.GetObject(&s3.GetObjectInput{ + resp, err := s.storage.s3.GetObject(context.TODO(), &s3.GetObjectInput{ Bucket: aws.String(s.storage.bucket), Key: aws.String(path), }) @@ -59,20 +65,20 @@ func (s *PublishedStorageSuite) GetFile(c *C, path string) []byte { } func (s *PublishedStorageSuite) AssertNoFile(c *C, path string) { - _, err := s.storage.s3.HeadObject(&s3.HeadObjectInput{ + _, err := s.storage.s3.HeadObject(context.TODO(), &s3.HeadObjectInput{ Bucket: aws.String(s.storage.bucket), Key: aws.String(path), }) - c.Assert(err, ErrorMatches, ".*\n.*status code: 404.*") + c.Assert(err, ErrorMatches, ".*StatusCode: 404.*") } func (s *PublishedStorageSuite) PutFile(c *C, path string, data []byte) { - _, err := s.storage.s3.PutObject(&s3.PutObjectInput{ + _, err := s.storage.s3.PutObject(context.TODO(), &s3.PutObjectInput{ Bucket: aws.String(s.storage.bucket), Key: aws.String(path), Body: bytes.NewReader(data), ContentType: aws.String("binary/octet-stream"), - ACL: aws.String("private"), + ACL: types.ObjectCannedACLPrivate, }) c.Assert(err, IsNil) } @@ -228,7 +234,7 @@ func (s *PublishedStorageSuite) TestRemoveDirsPlusWorkaround(c *C) { func (s *PublishedStorageSuite) TestRemoveDirsNoSuchBucket(c *C) { err := s.noSuchBucketStorage.RemoveDirs("a/b", nil) - c.Check(err, IsNil) + c.Check(err, ErrorMatches, ".*StatusCode: 404.*") } func (s *PublishedStorageSuite) TestRenameFile(c *C) {